fix(agents): preserve compatible CLI session runtime pins#92476
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 12, 2026, 11:05 AM ET / 15:05 UTC. Summary PR surface: Source +12, Tests +47. Total +59 across 4 files. Reproducibility: yes. Current main has a high-confidence source reproduction: an anthropic session persisted with agentRuntimeOverride set to claude-cli reaches a resolver that accepts only openai/codex and therefore drops the compatible pin. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the registry-backed restoration rule so persisted CLI sessions retain their owning runtime only when the configured backend explicitly serves the selected provider. Do we have a high-confidence way to reproduce the issue? Yes. Current main has a high-confidence source reproduction: an anthropic session persisted with agentRuntimeOverride set to claude-cli reaches a resolver that accepts only openai/codex and therefore drops the compatible pin. Is this the best way to solve the issue? Yes. Reusing the canonical config-aware CLI backend binding is narrower and more maintainable than adding more hard-coded provider/runtime pairs, and the patch applies it consistently to the relevant reply and follow-up paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e728957989f6. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +12, Tests +47. Total +59 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
593de2a to
303b2f7
Compare
vincentkoc
left a comment
There was a problem hiding this comment.
Verified for maintainer merge.
What changed during maintainer review:
- Kept the PR's provider-scoped CLI runtime pin fix.
- Added the same compatible CLI-session guard to preflight compaction and memory flush, so
anthropicsessions pinned toclaude-clido not enter embedded maintenance paths.
Proof:
node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner-execution.test.ts src/auto-reply/reply/agent-runner-memory.test.ts src/agents/model-runtime-aliases.test.ts --maxWorkers=1passed.- Autoreview rerun clean: no accepted/actionable findings.
- Crabbox AWS
cbx_44400b494e97/coral-prawn, runrun_69dd43475e39:OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 corepack pnpm check:changedpassed. - Exact PR head
303b2f794f6c01fcf21b62b27c536b5f6eceb421: 135 success / 24 skipped / 1 neutral / 0 failures / 0 pending.
Summary
agentRuntimeOverridevalues for CLI runtimes when the runtime is registered to serve the selected provider.claude-clisession pin still does not leak into unrelated providers such asopenai.Real behavior proof
Behavior or issue addressed:
Persisted session runtime pins were only restored for the hard-coded
openai+codexpair. A session pinned to a setup-registered CLI runtime such asclaude-cliwould be dropped even when the selected provider was the matching model provider (anthropic). This could force the fallback/restore path away from the CLI runtime that originally owned the session. The fix keeps the existing stale-pin guard by restoring a CLI runtime only whenisCliRuntimeAliasForProviderconfirms that the runtime serves the selected provider.Real environment tested:
Local OpenClaw checkout on macOS, branch
codex/session-runtime-compat-provider, Node/Vitest through repository scripts.Exact steps or command run after this patch:
Evidence after fix:
2 passed | 188 skippedforresolveSessionRuntimeOverrideForProvider.agent-runner-execution.test.ts (190 tests)passed.All matched files use the correct format.{ "anthropic": "claude-cli", "openai": null }Observed result after fix:
With a setup-registered
claude-cliruntime bound toanthropic,resolveSessionRuntimeOverrideForProvider({ provider: "anthropic", agentRuntimeOverride: "claude-cli" })now returns"claude-cli"; the same persisted runtime pin still returnsundefinedforprovider: "openai".What was not tested:
End-to-end external CLI execution; this patch is limited to runtime override resolution and the reply/follow-up call sites that pass config into it.