Repository navigation
fix(gateway): keep side chat available for tool-heavy sessions - #127294
Conversation
Co-authored-by: Tak Hoffman <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 1:03 PM ET / 17:03 UTC. ClawSweeper reviewWhat this changesThe PR lets the Gateway side-chat companion retain complete recent transcript pages when an older tool-heavy page reaches the bounded raw-read byte budget. Merge readinessKeep open for the maintainer merge decision: the patch correctly narrows the existing fail-closed rule so a later older-page byte cutoff no longer discards already-complete recent context, while retaining the snapshot fence and newest-page protection. GitHub reports the branch as mergeable but behind, with exact-head checks still running. Likely related people: @vincentkoc (current reader path) and @shakkernerd (earlier companion safety invariants). Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe Gateway session companion reads a bounded tail of persisted transcript events and converts it into read-only context for Control UI side-chat questions. It must pass useful complete context to the model while rejecting an incomplete newest page or a transcript snapshot that changes during the read. flowchart LR
A[Persisted session transcript] --> B[Bounded tail reader]
B --> C[Page completeness decision]
C --> D[Companion context builder]
D --> E[Snapshot fence]
E --> F[Control UI side-chat answer]
Decision needed
Why: The patch changes observable Control UI side-chat availability while deliberately refining an existing safety boundary; the protected maintainer item requires a human landing decision rather than automated cleanup. Before merge
Agent review detailsSecurityNone. PR surfaceSource +14, Tests +28. Total +42 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the explicit complete-newer-pages boundary and final snapshot fence, then land only after the branch is refreshed and exact-head checks confirm the reviewed behavior. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main returns unavailable at src/gateway/session-companion-context.ts:166 when the bounded reader reports an older partial page, and the new 384-row fixture directly creates that condition. Read-only review rules prevented running the regression locally. Is this the best way to solve the issue? Yes. Keeping only already-complete newer pages and fencing their snapshot is the narrow owner-level repair; it does not treat an incomplete newest page as safe or add a fallback path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 781ded80d624. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready evidence for source head ef3461a10a5ea9ea57b6e375f3c9f227f1c9373c:
Known proof gaps: none. Ready for guarded squash merge. |
|
Merged via squash.
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(gateway): keep side chat available for tool-heavy sessions This is item 3/3 in the current shard. Shard 2/60. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Co-authored-by: RoboClaw <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
What Problem This Solves
Fixes an issue where users asking the session companion about a tool-heavy session could receive “Couldn't load this session's history” even though the session transcript was healthy and readable.
Why This Change Was Made
The companion now retains complete recent transcript pages when an older page reaches the bounded raw-read budget. It still rejects an incomplete newest page, stale projections, and snapshots that change during the read, so the existing fail-closed safety boundaries remain intact.
AI-assisted implementation; the complete owner path, regression fixture, and proof results were reviewed before publication.
User Impact
Side chat remains available on long, tool-heavy sessions and answers from the newest complete context instead of failing the whole request because older raw tool output exhausted the scan budget.
Evidence
Isolated Control UI proof
Copied the affected session databases into an isolated state directory, disabled channel startup, ran the exact committed Gateway on loopback, and routed the companion's model call to the repository's deterministic mock OpenAI server. No live provider credential or operator Gateway was used.
Session loaded with side chat available
Same question that previously produced the history-unavailable error
Answer returned through the real Gateway companion path
sidechat-context-cap.webm
Regression and checks
expected 'unavailable' to be 'ready'.node scripts/run-vitest.mjs src/gateway/session-companion-context.test.ts— 22/22 passed across both Gateway projects.node scripts/check-changed.mjs -- src/gateway/session-companion-context.ts src/gateway/session-companion-context.test.ts— passed.pnpm build— passed, including runtime postbuild, plugin SDK export checks, and Control UI build..agents/skills/autoreview/scripts/autoreview --mode uncommitted— clean; no accepted/actionable findings.