Repository navigation
fix(claude): retire the legacy command - #710
Conversation
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| return errors.New(message) | ||
| }, |
There was a problem hiding this comment.
🟡 (optional) Legacy sandboxes that run depot claude --local on this CLI now exit at once and are never shut down, so they keep running until the server reclaims them. RunE returns the retirement error without checking DEPOT_SANDBOX_ID, so the old deferred shutdownSandbox call never runs. Only the release-order note in the PR stops this, and nothing in the code enforces it. Fix: when DEPOT_SANDBOX_ID is set, still call the sandbox Shutdown API before returning the error. The no-API-request test should then cover only invocations outside a sandbox.
Why this was flagged
Trigger: a legacy remote session sandbox, which sets DEPOT_SANDBOX_ID and invokes depot claude --local, picks up a CLI built from this change. On the base branch, pkg/cmd/claude/claude.go:114-119 forces local mode and defers shutdownSandbox(ctx, sandboxID), which is at claude.go:661. That call sends agentv1.ShutdownRequest, so the sandbox is torn down even when the run fails. The new RunE at root.go:119-121 returns errors.New(message) without that cleanup. The test at root_test.go:104-146 asserts zero API requests even when DEPOT_SANDBOX_ID=sandbox-1. Each affected sandbox therefore stays up with no Claude process until a server-side timeout reclaims it, if one exists. The PR description says to release only after legacy sessions have drained. That is a deploy-process gate, not a code safeguard. Any sandbox that installs the latest CLI, or a resume that slips past the API block, hits this path.
Verification: On the base branch, pkg/cmd/claude/claude.go:113-123 reads sandboxID := os.Getenv("DEPOT_SANDBOX_ID"). If it is set, it forces local mode and defers shutdownSandbox(ctx, sandboxID). After this change, root.go registers newRetiredClaudeCommand() instead of claudeCmd.NewCmdClaude(). Its RunE is just return errors.New(message). It does not check DEPOT_SANDBOX_ID and never calls Shutdown.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 443a2e5. Configure here.
| return errors.New(message) | ||
| }, | ||
| } | ||
| } |
There was a problem hiding this comment.
Unused Claude package left behind
Low Severity
depot claude now always errors from a stub in root.go, but pkg/cmd/claude is no longer imported anywhere. The old implementation still deprecates and then runs, so the leftover package is dead code that contradicts the retired CLI.
Reviewed by Cursor Bugbot for commit 443a2e5. Configure here.
| found, remaining, err := cmd.Find(args) | ||
| if err != nil || len(remaining) != 0 || found.Name() != args[len(args)-1] { | ||
| t.Errorf("command %v not registered: found %v, remaining %v, error %v", args, found, remaining, err) | ||
| } |
There was a problem hiding this comment.
Low-value command registration test
Low Severity
TestRetiringClaudePreservesAgentAndSandboxCommands only calls cmd.Find to assert that agent, sandbox, and checks agents still exist. This PR does not change those commands, so the test restates registration rather than any retirement behavior. Please remove it or replace it with a caller-level test of the real preserved flows.
Triggered by team rule: Test Critic
Reviewed by Cursor Bugbot for commit 443a2e5. Configure here.




Claude Code remote agents have been replaced by Managed Agents, but
depot claudecurrently only warns and still runs. Replace its CLI entry point with a hidden command that exits with migration guidance for every legacy invocation, including local mode and secrets, while preserving managed agent and sandbox commands.Release only after the API blocks new legacy runs and existing remote sessions have drained, since legacy sandboxes invoke
depot claude --local.Created with Codex.
Catch up on this pull request in Depot
Note
Medium Risk
Every
depot claudeinvocation now hard-fails (including--localin draining sandboxes), so timing relative to API/session drain matters; unrelated commands are only covered by registration tests.Overview
Replaces the full
depot claudeimplementation with a hidden stub at the root CLI: it no longer registersNewCmdClaude()and instead wiresnewRetiredClaudeCommand(), which ignores flags/subcommands and always fails with a message directing users to Depot Managed Agents.The stub stays discoverable only via direct
depot claude(anddepot help claude) but is omitted from root--helpand shell completion. Errors go to stderr only with no API traffic—even for prior paths like--local, sessions, repository flags, andsecretssubcommands.Tests were reshaped to assert hiding, the fixed retirement error, zero HTTP calls under
DEPOT_*env, and thatagent,sandbox, andchecks agentscommands remain registered.Reviewed by Cursor Bugbot for commit 443a2e5. Bugbot is set up for automated code reviews on this repo. Configure here.