Repository navigation
fix: keep side chat available for large session tails - #130285
Conversation
Worked on by: - @hannesrudolph Co-authored-by: hannesrudolph <[email protected]> OpenClaw-Publication: bd0dd9d5-f93e-476f-8325-192392de4d8b
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 9:46 PM ET / August 27, 2026, 01:46 UTC. ClawSweeper reviewWhat this changesThe PR records the contiguous newest SQLite transcript suffix before a byte-budget omission so Side chat can use safe recent context instead of rejecting the whole session. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for explicit maintainer handling: current main still rejects a partial first bounded page, while this focused patch moves the byte-gap fact to the SQLite reader and preserves the snapshot and newest-message fail-closed boundaries. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherControl UI Side chat sends a companion request through the Gateway, which reads an active SQLite transcript projection before calling the utility model. This change determines which bounded transcript events become the companion’s prompt context. flowchart LR
A[Control UI Side chat] --> B[Gateway companion request]
B --> C[SQLite active transcript page]
C --> D{Byte-budget gap?}
D -->|No| E[Complete recent page]
D -->|Yes| F[Contiguous newest suffix]
E --> G[Companion prompt context]
F --> G
Decision needed
Why: The patch intentionally changes session-context selection semantics, and the protected maintainer label requires an explicit human disposition despite focused source and test evidence. Before merge
Agent review detailsSecurityNone. PR surfaceSource +15, Tests +57. Total +72 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the reader-owned contiguous-tail fact and land the patch after a maintainer accepts bounded recent context as the intended Side chat behavior. Do we have a high-confidence way to reproduce the issue? Yes—current main’s partial-page condition and the branch’s SQLite-backed regression define a high-confidence reproduction path; this read-only review did not execute it. Is this the best way to solve the issue? Yes—the bounded reader is the right owner for continuity information, and the companion remains responsible only for consuming that fact and enforcing its snapshot fence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2f1ea328b34e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]>
|
Current-head verification for I am explicitly accepting the focused production-path proof instead of attaching a Side chat screenshot/video:
Known proof gap: no screenshot or recording. For this backend-only boundary repair, the failing/passing real-SQLite regression plus exact-head CI is the more direct evidence, so I am not adding proof theater or broadening the change. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Current-head visible-proof attempt for
This is the concrete infeasibility for current-head media proof. I am explicitly selecting the review's Accept the owner-boundary evidence option: the real-SQLite failing/passing regression, ClawSweeper's own two exact-head executions, the direct producer/caller/sibling review, and exact-head green CI are sufficient for this deterministic backend repair. There are no code or security findings to address. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
* fix: keep side chat available for large session tails Worked on by: - @hannesrudolph Co-authored-by: hannesrudolph <[email protected]> OpenClaw-Publication: bd0dd9d5-f93e-476f-8325-192392de4d8b * perf: avoid copying complete companion pages Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: hannesrudolph <[email protected]> Co-authored-by: VACInc <[email protected]> Co-authored-by: Vito Cappello <[email protected]>
Closes #130188
AI-assisted: yes (Roboclaw)
What Problem This Solves
Fixes an issue where Control UI Side chat reported “Couldn't load this session's history” when an older large transcript message caused the first 1 MiB bounded page to omit rows, even though a valid recent user/assistant suffix was available.
Why This Change Was Made
The SQLite bounded reader now records how many returned events form a contiguous newest suffix before the first byte-budget omission, while preserving its intentionally sparse results for session-memory salvage callers. The companion consumes only that suffix, stops at the gap, and retains the existing newest-message fail-closed behavior, projection completeness validation, 4,096-message scan bound, and final snapshot fence.
The production delta is +26/-11 (net +15). The growth is the explicit producer-owned contiguous-tail fact plus a projection-integrity check; this avoids duplicating position inference in consumers or changing the sparse reader contract used by session memory. Complete pages reuse the existing event array, so the common path does not add an avoidable copy.
User Impact
Operators can use Side chat and
/btwon large, long-running sessions when recent context fits the hard read budget, even if an older message in the first candidate page is oversized. A newest message that cannot fit remains a retryable history failure rather than silently backfilling stale context.Evidence
node scripts/run-vitest.mjs src/gateway/session-companion-context.test.ts -t 'uses the contiguous newest suffix when an older message exceeds the read budget'{ kind: "unavailable" }instead of the expected recent suffix.node scripts/run-vitest.mjs src/gateway/session-companion-context.test.ts— 12 passed, repeated 3 times.node scripts/run-vitest.mjs src/gateway/session-companion.test.ts— 21 passed, repeated 3 times.node scripts/run-vitest.mjs src/config/sessions/session-accessor.sqlite-active-events.test.ts— 16 passed, repeated 3 times.node scripts/check-changed.mjs -- <changed files>— green after refreshing the current-main dependency install.srctest typechecks — green.git diff --check— green..agents/skills/autoreview/scripts/autoreview --mode localThe final performance-only follow-up adds no SQL query, retry, timer, subscriber, UI action, or repeated request; it only avoids copying the event array for complete pages.
Provenance: the unconditional partial-page rejection was introduced in #122380; #127294 narrowed it for later pages but retained the first-page failure covered here.
Worked on by
View the OpenClaw team session