Skip to content

fix(agents): preserve compatible CLI session runtime pins#92476

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
yu-xin-c:codex/session-runtime-compat-provider
Jun 13, 2026
Merged

fix(agents): preserve compatible CLI session runtime pins#92476
vincentkoc merged 2 commits into
openclaw:mainfrom
yu-xin-c:codex/session-runtime-compat-provider

Conversation

@yu-xin-c

Copy link
Copy Markdown
Contributor

Summary

  • Preserve persisted agentRuntimeOverride values for CLI runtimes when the runtime is registered to serve the selected provider.
  • Keep stale CLI runtime pins isolated: a claude-cli session pin still does not leak into unrelated providers such as openai.
  • Pass runtime config through the reply/follow-up harness override resolver so setup-registered CLI runtime aliases can be validated.

Real behavior proof

Behavior or issue addressed:
Persisted session runtime pins were only restored for the hard-coded openai + codex pair. A session pinned to a setup-registered CLI runtime such as claude-cli would 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 when isCliRuntimeAliasForProvider confirms 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:

node scripts/run-vitest.mjs run src/auto-reply/reply/agent-runner-execution.test.ts -t "resolveSessionRuntimeOverrideForProvider" --reporter verbose
node scripts/run-vitest.mjs run src/auto-reply/reply/agent-runner-execution.test.ts --reporter default
./node_modules/.bin/oxfmt --check --threads=1 src/auto-reply/reply/agent-runner-execution.ts src/auto-reply/reply/agent-runner-execution.test.ts src/auto-reply/reply/dispatch-from-config.ts src/auto-reply/reply/followup-runner.ts
node --import tsx --input-type=module --eval "<resolveSessionRuntimeOverrideForProvider live proof>"

Evidence after fix:

  • Focused Vitest: 2 passed | 188 skipped for resolveSessionRuntimeOverrideForProvider.
  • Full related file: agent-runner-execution.test.ts (190 tests) passed.
  • oxfmt: All matched files use the correct format.
  • Live proof output:
{
  "anthropic": "claude-cli",
  "openai": null
}

Observed result after fix:
With a setup-registered claude-cli runtime bound to anthropic, resolveSessionRuntimeOverrideForProvider({ provider: "anthropic", agentRuntimeOverride: "claude-cli" }) now returns "claude-cli"; the same persisted runtime pin still returns undefined for provider: "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.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. size: S labels Jun 12, 2026
@clawsweeper

clawsweeper Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 12, 2026, 11:05 AM ET / 15:05 UTC.

Summary
The PR restores configured provider-compatible CLI runtime pins across reply, fallback, and follow-up resolution paths and adds matching-versus-stale regression coverage.

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: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • The proposed patch is correct and needs only normal maintainer review and completion of the remaining required checks, not a separate repair PR.

Security
Cleared: The patch changes internal runtime selection and tests without altering dependencies, secrets, permissions, downloads, package resolution, or other supply-chain surfaces.

Review details

Best 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 changes

Label changes:

  • add P2: The regression can redirect resumed sessions away from their configured CLI runtime, but it affects a bounded set of CLI-backend users and has a focused fix.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR provides after-fix live resolver output showing both compatible restoration and cross-provider rejection, supplemented by focused and full related-file tests.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR provides after-fix live resolver output showing both compatible restoration and cross-provider rejection, supplemented by focused and full related-file tests.

Label justifications:

  • P2: The regression can redirect resumed sessions away from their configured CLI runtime, but it affects a bounded set of CLI-backend users and has a focused fix.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR provides after-fix live resolver output showing both compatible restoration and cross-provider rejection, supplemented by focused and full related-file tests.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides after-fix live resolver output showing both compatible restoration and cross-provider rejection, supplemented by focused and full related-file tests.
Evidence reviewed

PR surface:

Source +12, Tests +47. Total +59 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 13 1 +12
Tests 1 47 0 +47
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 60 1 +59

What I checked:

Likely related people:

  • shakkernerd: Authored the recent commit that introduced the restrictive session runtime override resolver during agent-runtime internalization. (role: introduced current behavior; confidence: high; commits: f7ee25291a4b; files: src/auto-reply/reply/agent-runner-execution.ts)
  • steipete: Authored the merged agent-runtime internalization work and substantial surrounding CLI backend and runtime-routing history. (role: feature owner; confidence: high; commits: 995b055003c7, 859eb0666282; files: src/agents/cli-backends.ts, src/agents/model-runtime-aliases.ts, src/auto-reply/reply/agent-runner-execution.ts)
  • vincentkoc: Recently maintained the shared CLI backend and model-runtime alias surfaces, including canonical Codex runtime/auth routing. (role: recent adjacent contributor; confidence: medium; commits: 8c802aa68351, 859eb0666282; files: src/agents/cli-backends.ts, src/agents/model-runtime-aliases.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jun 12, 2026
@vincentkoc
vincentkoc force-pushed the codex/session-runtime-compat-provider branch from 593de2a to 303b2f7 Compare June 13, 2026 22:50
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 13, 2026

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 anthropic sessions pinned to claude-cli do 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=1 passed.
  • Autoreview rerun clean: no accepted/actionable findings.
  • Crabbox AWS cbx_44400b494e97 / coral-prawn, run run_69dd43475e39: OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 corepack pnpm check:changed passed.
  • Exact PR head 303b2f794f6c01fcf21b62b27c536b5f6eceb421: 135 success / 24 skipped / 1 neutral / 0 failures / 0 pending.

@vincentkoc
vincentkoc merged commit 9974641 into openclaw:main Jun 13, 2026
164 of 165 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants