fix(status): ignore stale context after model switch#93306
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Codex review: passed. Reviewed June 15, 2026, 3:32 PM ET / 19:32 UTC. Summary PR surface: Source +6, Tests +128. Total +134 across 2 files. Reproducibility: yes. source-reproducible: current main trusts explicit runtime context before checking fallback provenance when active and selected models differ. I did not run a local failing repro, but the PR fixture models the stale prior-runtime state directly. 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 focused status formatter guard with its regression coverage once the normal maintainer and automerge gates accept the exact head SHA. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main trusts explicit runtime context before checking fallback provenance when active and selected models differ. I did not run a local failing repro, but the PR fixture models the stale prior-runtime state directly. Is this the best way to solve the issue? Yes. Moving explicit runtime-token trust behind the fallback/equivalent-runtime provenance check is the narrow formatter-side fix, and passing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b3128ba93def. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +6, Tests +128. Total +134 across 2 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
|
|
@clawsweeper automerge |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper automerge |
|
🦞✅ Source: What merged:
Automerge notes:
The automerge loop is complete. Automerge progress:
|
|
🦞✅ Source: Why human review is needed: What the maintainer can do as a next step: I added |
Summary: - The PR changes `/status` context-window selection to ignore stale runtime snapshots after manual model switches while preserving fallback/runtime-alias context windows. - PR surface: Source +6, Tests +128. Total +134 across 2 files. - Reproducibility: yes. source-reproducible: current main trusts explicit runtime context before checking fall ... fer. I did not run a local failing repro, but the PR fixture models the stale prior-runtime state directly. Automerge notes: - PR branch already contained follow-up commit before automerge: test(status): make context fixtures type-correct Validation: - ClawSweeper review passed for head f14fda4. - Required merge gates passed before the squash merge. Prepared head SHA: f14fda4 Review: openclaw#93306 (comment) Co-authored-by: Mason Huang <[email protected]> Approved-by: hxy91819
Summary: - The PR changes `/status` context-window selection to ignore stale runtime snapshots after manual model switches while preserving fallback/runtime-alias context windows. - PR surface: Source +6, Tests +128. Total +134 across 2 files. - Reproducibility: yes. source-reproducible: current main trusts explicit runtime context before checking fall ... fer. I did not run a local failing repro, but the PR fixture models the stale prior-runtime state directly. Automerge notes: - PR branch already contained follow-up commit before automerge: test(status): make context fixtures type-correct Validation: - ClawSweeper review passed for head f14fda4. - Required merge gates passed before the squash merge. Prepared head SHA: f14fda4 Review: openclaw#93306 (comment) Co-authored-by: Mason Huang <[email protected]> Approved-by: hxy91819
Purpose
Manual session model switches should make
/statusreport the context window for the newly selected model. The current status formatter can still trust a transcript/runtime snapshot from the previous model, so a session pinned toollama-cloud/glm-5.1can continue to display the oldollama-cloud/deepseek-v4-pro1.0mcontext window.Summary
/statuscontext-window display aligned with the session-selected model after manual model switches.Root Cause
src/status/status-message.tstreatedruntimeContextTokensas authoritative whenever the runtime model differed from the selected model. That is correct for real fallback or equivalent runtime alias paths, but wrong after a manual session model switch because the runtime snapshot can describe the previous transcript model.Real Behavior Proof
Behavior addressed:
/statusnow uses the session-selected model's configured context window after a manual model switch instead of pinning the display to stale runtime context tokens from the previous model.Real environment tested: Crabbox Docker provider, lease
cbx_9a713b50341d, clean synced PR branch checkout innode:22-bookworm.Exact steps or command run after this patch:
node scripts/crabbox-wrapper.mjs run --provider docker --docker-image node:22-bookworm --idle-timeout 90m --ttl 240m --timing-json --shell -- "corepack enable && corepack pnpm install --frozen-lockfile && node scripts/run-vitest.mjs src/status/status-message.test.ts"Evidence after fix:
src/status/status-message.test.tsbuilds the stale manual-switch status input where the selected model isollama-cloud/glm-5.1, the previous runtime snapshot isollama-cloud/deepseek-v4-pro, and the stale runtime context is1_000_000.Observed result after fix: Crabbox passed
src/status/status-message.test.tswith 1 test file and 4 tests. The regression test assertsSession selected: ollama-cloud/glm-5.1,Context: 128k/200k, and notContext: 128k/1.0m.What was not tested: No live Telegram/openclaw2 package upgrade was rerun from this PR branch; the focused proof covers the status-message decision path that formats the incorrect context window.
Verification
pnpm check:test-typesnode scripts/run-vitest.mjs src/status/status-message.test.ts.agents/skills/autoreview/scripts/autoreview --mode localgit diff --checkdocker, leasecbx_9a713b50341d, exit 0.