Skip to content

fix(claude): retire the legacy command - #710

Merged
PedroGuerraPT merged 2 commits into
mainfrom
codex-retire-claude-cli
Nov 19, 2026
Merged

PedroGuerraPT merged 2 commits into
mainfrom
codex-retire-claude-cli

Conversation

@PedroGuerraPT

@PedroGuerraPT PedroGuerraPT commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude Code remote agents have been replaced by Managed Agents, but depot claude currently 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 claude invocation now hard-fails (including --local in draining sandboxes), so timing relative to API/session drain matters; unrelated commands are only covered by registration tests.

Overview
Replaces the full depot claude implementation with a hidden stub at the root CLI: it no longer registers NewCmdClaude() and instead wires newRetiredClaudeCommand(), 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 (and depot help claude) but is omitted from root --help and shell completion. Errors go to stderr only with no API traffic—even for prior paths like --local, sessions, repository flags, and secrets subcommands.

Tests were reshaped to assert hiding, the fixed retirement error, zero HTTP calls under DEPOT_* env, and that agent, sandbox, and checks agents commands remain registered.

Reviewed by Cursor Bugbot for commit 443a2e5. Bugbot is set up for automated code reviews on this repo. Configure here.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread pkg/cmd/root/root.go
Comment on lines +119 to +121
RunE: func(cmd *cobra.Command, args []string) error {
return errors.New(message)
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: medium. Approved; Cursor Bugbot completed successfully and reported no findings that need human review.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread pkg/cmd/root/root.go
return errors.New(message)
},
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 443a2e5. Configure here.

Comment thread pkg/cmd/root/root_test.go
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)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Triggered by team rule: Test Critic

Reviewed by Cursor Bugbot for commit 443a2e5. Configure here.

@PedroGuerraPT
PedroGuerraPT merged commit 8162d47 into main Nov 19, 2026
13 checks passed
@PedroGuerraPT
PedroGuerraPT deleted the codex-retire-claude-cli branch November 19, 2026 20:22
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.

2 participants