refactor: route session status through accessors#96460
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 10:29 AM ET / 14:29 UTC. Summary PR surface: Source +138, Tests +168, Other +2. Total +308 across 8 files. Reproducibility: not applicable. this is a behavior-neutral refactor rather than a standalone bug report. The relevant behavior path is covered by source inspection, regression tests, current checks, and the PR body's live gateway proof. Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land or continue maintainer review of this accessor-adoption slice, while keeping the SQLite storage flip and adapter proof on the canonical tracker. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-neutral refactor rather than a standalone bug report. The relevant behavior path is covered by source inspection, regression tests, current checks, and the PR body's live gateway proof. Is this the best way to solve the issue? Yes: moving AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 374076b5a8c5. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +138, Tests +168, Other +2. Total +308 across 8 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
|
What Problem This Solves
Path 3 is moving session metadata and transcript access behind storage-neutral seams before the SQLite-backed session store lands.
session_statusstill had direct session-store reads/writes for visibility-aware session resolution and model-selection persistence, which kept one gateway-visible tool coupled to the JSON store shape.Fixes part of #88838.
Why This Change Was Made
session_statusis the user-facing “what session am I in and what model is it using?” surface. It has to preserve semanticcurrent, literalmain, session-id lookup, requester visibility, agent-to-agent policy, and model override behavior while moving storage access through the permanent session accessor boundary. A simpleloadSessionEntryswap is not enough because the tool resolves ordered candidate keys and can materialize implicit current-session fallbacks before a model mutation.User Impact
Users should see the same
/status-style output and model pin/reset behavior. The change is internal: session-status reads and model override writes now go through named session accessor/query operations, so the tool is ready for the SQLite session backend without adding runtime fallback readers or broad compatibility shims.Changes
session_statuslookup through accessor queries.Evidence
Final rebased head:
e61837e665befd7cf1e1cab998de9bdd6107138aBase:
acc2a0ee7297f178693ea18d06baf194aeab736dPost-rebase local proof on the final head:
Result: focused Vitest passed 28 + 56 + 64 tests; boundary guard, diff check, oxfmt, oxlint, both tsgo probes, and autoreview all passed.
Real behavior proof
Behavior addressed:
session_statusresolves semanticcurrentthrough the gateway-visible path and persists a per-session model override without changing the existing session row identity.Real environment tested: local live gateway from
~/Projects/clawdbot, OpenClaw 2026.6.9, temporary proof branch with this patch applied. Live proof was run before the final conflict-free rebase; the final head above has fresh focused proof and autoreview.Exact steps or command run after this patch:
Evidence after fix:
tools.invokereturnedok=true,toolName=session_status,details.sessionKey=agent:main:main,changedModel=true,modelProvider=anthropic, andmodelOverride=anthropic/claude-sonnet-4-6. The persisted row kept the samesessionId(538d6092-6323-4fcc-a7d0-d4f92a8b9bf1), setproviderOverride=anthropic,modelOverride=claude-sonnet-4-6,liveModelSwitchPending=true, and did not create a baremainrow. The session store was restored to the pre-proof SHA afterward, and the live gateway was rebuilt/restarted back on cleanmainwith RPC OK.Observed result after fix: the live gateway command path resolved
currentto the canonical main session and wrote model selection through the accessor-backed status path while preserving existing session identity and route metadata.What was not tested: the future SQLite adapter/runtime flip, doctor migration behavior, plugin SDK compatibility, and CI rollup on this PR head.