Fix Claude CLI runtime migration for gateway turns#82546
Conversation
|
Codex review: passed. Summary Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this patch or an equivalent model-scoped runtime migration after exact-head gates, while keeping legacy whole-agent runtime ignored. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence reproduction path: current main writes Is this the best way to solve the issue? Yes. The patch fixes the narrow contract mismatch by writing model-scoped What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 9b560b8a41f4. |
|
/clawsweeper automerge |
|
🦞✅ Source: What merged:
Automerge notes:
The automerge loop is complete. Automerge progress:
|
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf54484ff7d5dcee8774033dfcb188573fb77a. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf54484ff7d5dcee8774033dfcb188573fb77a Review: openclaw/openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf54484ff7d5dcee8774033dfcb188573fb77a. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf54484ff7d5dcee8774033dfcb188573fb77a Review: openclaw/openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary: - The PR adds model-scoped `claude-cli` runtime policy to Anthropic CLI migration/default backfill, updates the gateway CLI live-smoke config, tests, and changelog. - Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main writes `clau ... del/provider-scoped runtime policy. I did not run a live Telegram/Dashboard repro in this read-only review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head 62cf544. - Required merge gates passed before the squash merge. Prepared head SHA: 62cf544 Review: openclaw#82546 (comment) Co-authored-by: Alex Knight <15041791+amknight@users.noreply.github.com>
Summary
Fixes #82344 by moving the Claude CLI auth migration onto the runtime-selection contract the gateway actually uses.
The regression was that the Anthropic Claude CLI migration wrote
agents.defaults.agentRuntime.id = "claude-cli", but current runtime selection intentionally ignores that legacy whole-agent field. Gateway-mediated turns from Telegram and Dashboard could therefore resolve an Anthropic model without a model/provider-scoped runtime policy and fall through to Anthropic API billing, while direct Claude CLI use still worked.This PR:
agentRuntime: { id: "claude-cli" }onto migrated canonical Anthropic model entries during Claude CLI auth migration;automodel runtime policies;Reproduction
I reproduced the issue on Blacksmith before the fix with a source-level migration/resolver harness. The migrated config had the legacy default runtime, but the canonical model entry lacked
agentRuntime, soresolveModelRuntimePolicy({ provider: "anthropic", modelId: "claude-opus-4-7" })returned no runtime.Pre-fix Testbox:
tbx_01krr54ntaqd1hxqsad1ygmw82Observed pre-fix output shape:
{ "migratedEntry": { "alias": "Opus" }, "defaultRuntime": { "id": "claude-cli" } }The assertion expected
claude-clibut failed because the gateway resolver ignored the legacy whole-agent runtime.Verification
Behavior addressed: upgraded Claude CLI auth configs keep Telegram and Dashboard gateway turns on the local Claude CLI runtime instead of falling through to Anthropic API billing.
Real environment tested: Blacksmith Testbox Linux, post-rebase branch content,
tbx_01krr7e0pqfbw4az114zcwyg0s, GitHub Actions runhttps://github.com/openclaw/openclaw/actions/runs/25960349269.Exact steps or command run after this patch: Blacksmith command ran a migration/resolver assertion, then
pnpm check:changed, thenpnpm test extensions/anthropic/cli-migration.test.ts extensions/anthropic/index.test.ts src/agents/command/attempt-execution.cli.test.ts src/commands/models/auth.test.ts.Evidence after fix:
{ "migratedEntry": { "alias": "Opus", "agentRuntime": { "id": "claude-cli" } }, "defaultRuntime": { "id": "claude-cli" }, "resolved": "claude-cli", "source": "model" }Observed result after fix:
pnpm check:changedpassed, focused tests passed across 3 Vitest shards, and the Blacksmith run exited 0.What was not tested: live Claude account billing/auth was not exercised; the proof validates the config migration/defaulting path and the gateway runtime resolver contract that selects the CLI backend before any provider billing path.
I also attempted the default AWS Crabbox route during investigation. The raw AWS lease lacked Node, and Actions hydration was blocked by GitHub runner-registration permissions (
403); a manually prepared AWS lease reproduced the resolver result but later lost SSH on the configured port, so final proof uses Blacksmith Testbox as requested.