fix(status): avoid stale session context windows#93220
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, 7:07 AM ET / 11:07 UTC. Summary PR surface: Source +107, Tests +155. Total +262 across 7 files. Reproducibility: yes. Source inspection shows current main forwards stale live and persisted context-token values into 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 this focused status-rendering fix after exact-head checks pass, while preserving existing runtime session model ownership semantics. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main forwards stale live and persisted context-token values into Is this the best way to solve the issue? Yes. Filtering stale context values at the status rendering and summary boundaries is the narrow maintainable fix; rewriting session state or changing whether sessions follow new defaults would be broader product behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e7ee1c55b433. Label changesLabel justifications:
Evidence reviewedPR surface: Source +107, Tests +155. Total +262 across 7 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
|
86d4f58 to
2ca1ffa
Compare
Real environment validationValidated the fix against the live OpenClaw install in Environment:
Validation matrix using real persisted stale session entries from This specifically covers both stale directions that reproduced the bug:
Unit test command was rerun after the final patch: env -u OPENCLAW_STATE_DIR OPENCLAW_HOME=/tmp/openclaw-test-home XDG_CONFIG_HOME=/tmp/openclaw-test-home HOME=/tmp/openclaw-test-home OPENCLAW_VITEST_INCLUDE_FILE=/tmp/openclaw-vitest-include.json node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.tsResult: 3 files, 119 tests passed. |
2ca1ffa to
86a1051
Compare
Autoreview follow-upRan an additional review pass after reproducing the live direct-session failure reported from WeCom. The earlier fix only filtered stale persisted/session context and stale active model snapshots inside
Fix added in this revision:
New regression test covers the exact live failure shape: Validation after the follow-up: env -u OPENCLAW_STATE_DIR -u OPENCLAW_VITEST_INCLUDE_FILE OPENCLAW_HOME=/tmp/openclaw-test-home XDG_CONFIG_HOME=/tmp/openclaw-test-home HOME=/tmp/openclaw-test-home node scripts/test-projects.mjs src/auto-reply/reply/commands-status.test.ts src/auto-reply/status.test.tsResult: 2 files, 112 tests passed. env -u OPENCLAW_STATE_DIR OPENCLAW_HOME=/tmp/openclaw-test-home XDG_CONFIG_HOME=/tmp/openclaw-test-home HOME=/tmp/openclaw-test-home OPENCLAW_VITEST_INCLUDE_FILE=/tmp/openclaw-vitest-include.json node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.tsResult: 3 files, 119 tests passed. Live hot-patch validation after gateway restart also now renders the affected direct session as: Branch updated to commit |
86a1051 to
a540667
Compare
|
Updated the branch to address the CI failures seen on the older head. Changes in the refreshed head
Validation run locally:
|
|
Additional live environment validation after hotpatching the installed OpenClaw runtime on the workspace gateway. Runtime patch applied:
Real gateway evidence:
Synthetic stale-session proof against the installed runtime:
This reproduces the original stale-window shape and confirms the installed runtime now ignores the stale |
|
@clawsweeper automerge |
|
🦞🧹
Draft PRs stay fix-only until GitHub marks them ready for review. Pause with Automerge progress:
Re-review progress:
|
a540667 to
b6a6923
Compare
|
🦞✅ Source: Why human review is needed: What the maintainer can do as a next step: I added |
b6a6923 to
4a8e929
Compare
Summary: - The PR filters stale session/live context-token values when rendering `/status`, threads existing per-agent/default context caps into status rendering, and adds regression tests for status message and summary output. - PR surface: Source +107, Tests +155. Total +262 across 7 files. - Reproducibility: yes. Source inspection shows current main forwards stale live and persisted context-token v ... atus`, and the PR comments include live gateway output validating the Kimi/DeepSeek mismatch after the fix. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(status): avoid stale session context windows Validation: - ClawSweeper review passed for head 4a8e929. - Required merge gates passed before the squash merge. Prepared head SHA: 4a8e929 Review: openclaw#93220 (comment) Co-authored-by: masonxhuang <[email protected]> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: hxy91819 Co-authored-by: hxy91819 <[email protected]>
Summary: - The PR filters stale session/live context-token values when rendering `/status`, threads existing per-agent/default context caps into status rendering, and adds regression tests for status message and summary output. - PR surface: Source +107, Tests +155. Total +262 across 7 files. - Reproducibility: yes. Source inspection shows current main forwards stale live and persisted context-token v ... atus`, and the PR comments include live gateway output validating the Kimi/DeepSeek mismatch after the fix. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(status): avoid stale session context windows Validation: - ClawSweeper review passed for head 4a8e929. - Required merge gates passed before the squash merge. Prepared head SHA: 4a8e929 Review: openclaw#93220 (comment) Co-authored-by: masonxhuang <[email protected]> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: hxy91819 Co-authored-by: hxy91819 <[email protected]>
Summary: - The PR filters stale session/live context-token values when rendering `/status`, threads existing per-agent/default context caps into status rendering, and adds regression tests for status message and summary output. - PR surface: Source +107, Tests +155. Total +262 across 7 files. - Reproducibility: yes. Source inspection shows current main forwards stale live and persisted context-token v ... atus`, and the PR comments include live gateway output validating the Kimi/DeepSeek mismatch after the fix. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(status): avoid stale session context windows Validation: - ClawSweeper review passed for head 4a8e929. - Required merge gates passed before the squash merge. Prepared head SHA: 4a8e929 Review: openclaw#93220 (comment) Co-authored-by: masonxhuang <[email protected]> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: hxy91819 Co-authored-by: hxy91819 <[email protected]>
Summary
Fix
/statuscontext-window reporting when persisted session runtime metadata is stale.The status message can display the currently selected/configured model while still using an old
session.contextTokensor old runtime-model snapshot to compute the context window. This can produce inconsistent output such as:when the selected model's configured context window is 262k.
This PR keeps the scope narrow: it does not redefine whether an existing session should follow a new default model or keep its previous runtime model. It only prevents status rendering from mixing the selected model display with a stale session context window.
Changes
session.contextTokenswhen it matches the resolved status model or confirmed fallback provenance./statusmessage rendering, when the selected model differs from an unproven runtime snapshot, use the selected/configured model context window instead of the stale runtime window.contextTokensafter default model changes.Tests
Result: 3 files, 119 tests passed.