Skip to content

feat(agent): resolve the project per request and add v1 ShellService - #62

Merged
cooper (czxtm) merged 1 commit into
mainfrom
feat/agent-shell-service
Sep 23, 2026
Merged

cooper (czxtm) merged 1 commit into
mainfrom
feat/agent-shell-service

Conversation

@czxtm

Copy link
Copy Markdown
Member

Project-scoped v1 services now run behind a project interceptor, inside authentication. The interceptor resolves the X-Stackpanel-Project header to a registered project. Without the header, it falls back to the agent's current project, then to the registry default. It attaches that project's runtime from the runtime registry, so v1 and the legacy handlers share the same instances.

ShellService is the first project-scoped service:

  • GetShellStatus
  • RebuildShell as a server stream of started, output and completed events. A failed rebuild ends the stream with a Connect error, and an overlapping rebuild returns FailedPrecondition.

ADRs 0004 and 0005 are corrected to match what shipped: GetAgentInfo is public, requests are capped before decoding, the header is named X-Stackpanel-Project, and header-less requests fall back in the order above.

The old GetShellStatus/RebuildShell RPCs stay until the web migrates in a follow-up PR.

Verification:

  • The lead ran go build, go vet and gofmt, all clean.
  • 14 v1 and registry tests pass twice under -race. The 6 new ones cover:
    • the shell status mapping
    • the rebuild stream: ordered events, an error after output, a concurrent rebuild returning FailedPrecondition, and the method mapping
    • the interceptor routing requests to the resolved project
    • the resolver's fallback order
  • In the devshell on this commit, go build ./... and go vet ./internal/agent/... pass. go test ./internal/agent/... fails only TestSetupAcknowledgementRequiresAuthAndProjectEvidence, which already fails on main.
  • Codegen is buf generate plus nix fmt, and connect_entities_gen.go is unchanged.

Refs stackpanel-thq.8.1.1, ADR 0005

Project-scoped v1 services now run behind a project interceptor, inside
authentication. It resolves the X-Stackpanel-Project header (the one the
Studio already sends and CORS already allows) to a registered project,
falling back to the agent's current project and then the registry
default. It attaches that project's runtime from the runtime registry,
so v1 and the legacy handlers share the same instances.

ShellService is the first project-scoped service: GetShellStatus with
typed timestamps, and RebuildShell streaming a started/output/completed
oneof. A failed rebuild ends the stream with a Connect error instead of
an in-band error event, and an overlapping rebuild returns
FailedPrecondition.

ADRs 0004 and 0005 now match what shipped: GetAgentInfo is exempt from
auth, requests are capped before decoding, the header is
X-Stackpanel-Project, and header-less requests use the current project
before the default.

Refs: stackpanel-thq.8.1.1
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Preview pr-62 has been destroyed.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview pr-62 has been destroyed.

@czxtm
cooper (czxtm) merged commit b4eb4b6 into main Sep 23, 2026
16 of 17 checks passed
@czxtm
cooper (czxtm) deleted the feat/agent-shell-service branch September 23, 2026 14:38
@linear-code

linear-code Bot commented Sep 23, 2026

Copy link
Copy Markdown

ENG-845

This branch was successfully deployed

2 active deployments
docs-preview — a8c532e9 Deployed Sep 23, 2026 by czxtm via deploy #206
pr-62 — a8c532e9 Deployed Sep 23, 2026 by czxtm via deploy #220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant