Repository navigation
Conversation
Confidence Score: 4/5
[Medium impact] The change reaches the agent-run page and the selected devbox’s session store. Fix repeated imports overwriting newer saved history before merging. FindingsSummaryAdds an “Open in devbox” action for agent runs with uploaded sessions.
Reviews (1) · Last reviewed commit: "import agent run into devbox" · Reviewed by Greptile |
There was a problem hiding this comment.
🟡 Changes recommended
A critical authorization flaw remains where for_writer/2 treats globally readable workbenches as writable via Rbac.globally_readable/3, potentially exposing instances through DevboxInstance.for_writable_workbenches/2, so the change needs correction before approval.
1 open issue
12 files not reviewed
go/deployment-operator/pkg/devbox/api/v1/control.pb.go: Generated filego/deployment-operator/pkg/devbox/api/v1/control_grpc.pb.go: Generated filego/deployment-operator/pkg/devbox/api/v1/daemon.pb.go: Generated filego/deployment-operator/pkg/devbox/api/v1/daemon_grpc.pb.go: Generated filego/deployment-operator/pkg/devbox/api/v1/gateway.pb.go: Generated filego/deployment-operator/pkg/devbox/api/v1/gateway_grpc.pb.go: Generated filego/kubernetes-agent/kas/pkg/devbox/api/v1/control.pb.go: Generated filego/kubernetes-agent/kas/pkg/devbox/api/v1/control_grpc.pb.go: Generated filego/kubernetes-agent/kas/pkg/devbox/api/v1/daemon.pb.go: Generated filego/kubernetes-agent/kas/pkg/devbox/api/v1/daemon_grpc.pb.go: Generated filego/kubernetes-agent/kas/pkg/devbox/api/v1/gateway.pb.go: Generated filego/kubernetes-agent/kas/pkg/devbox/api/v1/gateway_grpc.pb.go: Generated file
What changed in this PR
Implements an end-to-end flow to import an Agent Run session into a running Devbox instance by seeding the run’s uploaded session archive into the Devbox agent store, then importing/resuming it as a Devbox thread, with new RPCs, GraphQL API surface area, and a Console UI entrypoint.
Changes:
- Add
SeedAgentSessionRPCs and wire them through gateway/daemon/control layers. - Add backend domain + GraphQL query/mutation to import an Agent Run into Devbox and list compatible instances.
- Add Console UI (“Open in devbox”) and regenerate GraphQL/protobuf client artifacts.
| File | Description |
|---|---|
| test/support/devbox_control.ex | Extends the devbox control test support to include the new seed_agent_session/2 behavior. |
| test/console/devboxes/threads_test.exs | Adds tests covering importing an agent run into a devbox thread and selecting compatible instances. |
| schema/schema.graphql | Updates the GraphQL schema to expose compatible devbox instance discovery and an agent-run-to-devbox import mutation. |
| proto/devbox/v1/gateway.proto | Adds the SeedAgentSession RPC to the gateway service definition. |
| proto/devbox/v1/daemon.proto | Adds the SeedAgentSession RPC to the daemon service definition. |
| proto/devbox/v1/control.proto | Introduces control-layer request/response types for seeding agent sessions and extends import metadata (e.g., cwd). |
| lib/grpc/devbox/v1/gateway.pb.ex | Regenerates Elixir gRPC/protobuf bindings for the gateway API changes. |
| lib/grpc/devbox/v1/daemon.pb.ex | Regenerates Elixir gRPC/protobuf bindings for the daemon API changes. |
| lib/grpc/devbox/v1/control.pb.ex | Regenerates Elixir gRPC/protobuf bindings for new control messages and fields. |
| lib/console/schema/workbench.ex | Adds/updates workbench query helpers used to determine writer access for devbox compatibility filtering. |
| lib/console/schema/devbox_instance.ex | Adds instance scoping to return instances tied to writable workbenches for compatibility checks. |
| lib/console/graphql/resolvers/deployments/devbox.ex | Implements resolvers for listing compatible devbox instances and importing an agent run into devbox. |
| lib/console/graphql/deployments/devbox.ex | Wires new devbox-related GraphQL fields into the schema, including authorization/middleware as needed. |
| lib/console/devboxes/threads.ex | Implements the domain flow to seed an agent session and import/resume it as a devbox thread, plus compatibility logic. |
| lib/console/devboxes/session_archive.ex | Adds functionality to download and parse the agent-run session archive/manifest used during import. |
| lib/console/devboxes/control/grpc.ex | Adds gRPC client support for seed_agent_session and passes new import parameters to the control plane. |
| lib/console/devboxes/control.ex | Extends the control behaviour/interface to support seeding agent sessions. |
| js/console/src/graph/devbox.graphql | Adds GraphQL documents for compatible instance listing and agent-run import to devbox. |
| js/console/src/generated/persisted-queries/client.json | Updates persisted query artifacts to include the new devbox import operations. |
| js/console/src/generated/graphql.ts | Regenerates TypeScript GraphQL types/hooks for the new schema operations. |
| js/console/src/generated/graphql-operations.ts | Regenerates/exports the new GraphQL operation definitions for client usage. |
| js/console/src/generated/graphql-documents.ts | Regenerates the compiled GraphQL document nodes for the new query and mutation. |
| js/console/src/components/ai/agent-runs/details/AIAgentRunDevboxButton.tsx | Adds a UI control/modal to select a devbox instance and trigger importing the agent run into it. |
| js/console/src/components/ai/agent-runs/details/AIAgentRun.tsx | Integrates the new devbox import button into the agent run details page. |
| go/kubernetes-agent/kas/pkg/devbox/api/v1/gateway.pb.go | Regenerates KAS-side Go protobuf bindings for the gateway API updates. |
| go/kubernetes-agent/kas/pkg/devbox/api/v1/gateway_grpc.pb.go | Regenerates KAS-side Go gRPC stubs for the gateway service updates. |
| go/kubernetes-agent/kas/pkg/devbox/api/v1/daemon.pb.go | Regenerates KAS-side Go protobuf bindings for the daemon API updates. |
| go/kubernetes-agent/kas/pkg/devbox/api/v1/daemon_grpc.pb.go | Regenerates KAS-side Go gRPC stubs for the daemon service updates. |
| go/kubernetes-agent/kas/pkg/devbox/api/v1/control_grpc.pb.go | Regenerates KAS-side Go gRPC stubs for the control service updates. |
| go/deployment-operator/pkg/devbox/gateway/core/server.go | Implements gateway forwarding for the new seed-agent-session RPC to the running daemon. |
| go/deployment-operator/pkg/devbox/daemon/rpc.go | Implements the daemon RPC handler for seeding an agent session and returning metadata. |
| go/deployment-operator/pkg/devbox/daemon/agents/threads.go | Updates thread import behavior to support cwd and constrain/normalize imported session working directory behavior. |
| go/deployment-operator/pkg/devbox/daemon/agents/sessionseed.go | Adds the session seeding implementation to restore/download agent-run archives into the agent’s native session store. |
| go/deployment-operator/pkg/devbox/daemon/agents/sessionseed_test.go | Adds unit tests validating session seeding behavior across supported import paths and providers. |
| go/deployment-operator/pkg/devbox/api/v1/gateway.pb.go | Regenerates deployment-operator Go protobuf bindings for the gateway API updates. |
| go/deployment-operator/pkg/devbox/api/v1/gateway_grpc.pb.go | Regenerates deployment-operator Go gRPC stubs for the gateway service updates. |
| go/deployment-operator/pkg/devbox/api/v1/daemon.pb.go | Regenerates deployment-operator Go protobuf bindings for the daemon API updates. |
| go/deployment-operator/pkg/devbox/api/v1/daemon_grpc.pb.go | Regenerates deployment-operator Go gRPC stubs for the daemon service updates. |
| go/deployment-operator/pkg/devbox/api/v1/control.pb.go | Regenerates deployment-operator Go protobuf bindings for new control messages/fields. |
| go/deployment-operator/pkg/devbox/api/v1/control_grpc.pb.go | Regenerates deployment-operator Go gRPC stubs for the control service updates. |
Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
Global read access no longer lists instances the user cannot write, and reading the session manifest no longer loads the rest of the archive.
…port-agent-run-into-devbox
Sandbox egress DNS cannot resolve object-store hosts, so the gateway fetches session_url and forwards archive bytes for the daemon to plant. Co-authored-by: Cursor <cursoragent@cursor.com>

Test Plan
Test environment: https://console.your-env.onplural.sh/
Checklist
Plural Flow: console