Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 26, 2026, 7:07 PM ET / 23:07 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch recovers chat-history pages after transcript resets or projection rebuilds and carries replacement-page cursors through the Gateway, embedded history tool, and Control UI. Merge readiness⛔ Blocked before merge - 2 items remain Current main still refuses history reads when a transcript window changes. This PR provides a coherent recovery path, and no introduced code defect was established. The Control UI reset state still needs the repository-required before/after screenshots before merge. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway reads per-agent SQLite transcript projections and serves history to chat clients and the embedded history tool. The Control UI turns those pages into a visible conversation and uses returned cursors to continue reading. flowchart LR
A[Stored transcript] --> B[SQLite history projection]
B --> C{Window still current?}
C -->|Yes| D[History page]
C -->|No| E[Recovered page and cursor]
D --> F[Gateway and embedded tool]
E --> F
F --> G[Control UI conversation]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +182, Tests +349, Docs +1. Total +532 across 33 files. View PR surface stats
Review metrics
Mantis proof suggestionA before/after web UI chat capture could show whether a reset during backscroll replaces obsolete messages and preserves continued history loading. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the storage reader as the continuity owner and have the UI replace obsolete history from the Gateway's recovered page; complete the visible reset demonstration before landing. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source rejects changed read windows, and the PR reports baseline refusals in focused Testbox negative controls; this read-only review did not rerun them. Is this the best way to solve the issue? Yes. The patch resolves continuity at the SQLite reader, retries mixed-window Gateway assembly once, and lets clients adopt the replacement cursor. Visible UI evidence remains required. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fb720291b0a3. 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
HistoryReview history (5 earlier review cycles)
|
|
The HTTP ingress stack hit the same Coordination update: your canonical ordered cleanup repair is now on main in |
…#159163) * fix(chat): recover history reads across resets and rebuilds * fix(gateway): retry registry churn during history discovery * fix(agents): preserve recovered history pagination * test(gateway): await session group fixture cleanup
What Problem This Solves
Fixes repeated
chat.historyrefusals when a transcript reset or replacement invalidates an in-progress read window, and immediate refusals while a scheduled projection rebuild can still finish.User Impact
History returns a coherent page from the current window and a fresh continuation token. A lost anchor falls back to the tail with
windowReset; Control UI replaces obsolete rows and adopts the returneddeltaCursor. Missing active projections get one cancellable wait of up to three seconds before a refusal. Embeddedsessions_historyalso receives the recovered offset, continuation, and reset marker.Why This Change Was Made
SQLite
readWindowis internal continuity state across snapshots within one request. The browser's separate cursor/reset contract is inpackages/gateway-protocol/src/schema/logs-chat.ts;ui/src/pages/chat/chat-history-hydration.tsclears reset cursors and adopts returneddeltaCursorvalues.The accessor resolves stale windows against current history. Page assembly discards old chunks and restarts once; UI, SSE, and embedded-tool owners retire obsolete continuation state. Remaining window-change failures have a distinct message. Image pagination retains its invalid-cursor/restart contract because its cursors also address images within a message. The async history-worker owner waits after a failed snapshot unwinds, retaining its authority and cancellation checks; read-only catalogs do not initiate writes.
No configuration, cache, database-schema, retention, or permission changes. Net production growth is 182 lines: the 150-line guideline is exceeded to carry the result through all affected continuation owners without leaving competing behavior.
Evidence
All heavy validation used blacksmith-testbox, profile openclaw-check. No local test suites, builds, typechecks, browser automation, or live Gateway changes.
node scripts/run-vitest.mjspassed the focused history/window/projection, worker/error/readiness, readonly/SSE, public chat-cursor, and artifact-image suites. The refreshed broad focused run passed 258 tests, with one existing opt-in benchmark skipped, ontbx_01m3fq6kqzc8pdqeemj0cn3zfs.tbx_01m3ftjaw9mkygv2tvt46kq276.7a233c5dfaf960f11fd6ae1f3b04c0a1fe2160bfpassed another 79 lifecycle/source/worker tests and 64 adapter/tool tests, core typechecking, and targeted lint ontbx_01m3fw49wwgh4r82psbhd4vgr7(180.9 s including sync/setup).node scripts/check-changed.mjs --base 8d8bd43120f3acd7e9e596e4d12774c442000703passed production/UI types, all 25 test typecheck groups, dead-export scans, and preceding guards. Five lint findings were fixed; affected types were rechecked and the existing planner resumed from lint through all remaining gates successfully. Main refreshes received fresh affected proof and review.Per-file measured cost (
pnpm test <file> --maxWorkers=1, initial validation leasetbx_01m3fm4tcy8et8zbhd18g4vbe3):session-accessor.sqlite-history-window.test.tssession-history-reads.test.tssession-history-state.test.tssession-history-worker-runtime.test.tssession-history-worker.integration.test.tssession-history-worker-errors.test.tsThe integration file's real SQLite/worker lifecycle scenarios account for its cost; the new recovery case requires the real worker/reconcile boundary. UI pagination/cursor suites measured 4.53 s / 2.98 s Vitest wall. The three adapter/tool files measured 22.82 s Vitest / 24.56 s wrapper wall together; the new composition case took 173 ms.
CI and limits
CI exposed an initial registry-discovery race. The canonical repair subsequently landed in main commit 3d903819c564; this PR adopts it and has no separate registry production/test delta. The preceding CI run 36273244444 passed. The subsequent run 36275157554 then exposed a test teardown race:
session-group-mutation-targets.test.tsclosed shared state before asynchronous agent cleanup settled. The test-only ordered-await repair passed 3/3 original-shard runs and 20/20 standalone file runs ontbx_01m3fx56gqddzp8c2xx6r6g8rg, plus focused typechecking, lint, and independent review. Unchanged-code shard/file replays both passed, so those replays did not reproduce the intermittent failure; the source lifecycle shows the missing settlement ordering. Production identity guards and assertions remain unchanged. The lease is stopped. The fixture measured 18.31 s Vitest / 20.18 s wrapper wall, with 4.199 s test time.An existing branch-continuation test had masked an unfinished projection before reaching stale-window validation. On the initial base, diagnostics showed indexed sequence 7/raw sequence 8 with
needs_rebuild=1, with or without a session entry. The continuity fixture now explicitly completes that synthetic branch through the canonical reconcile function; this PR does not claim to fix that separate deferred-reconcile observation or demonstrate a live production CPU/latency improvement.Testbox setup required frozen dependency installation and replacement leases after native checksum-sync timeouts. The first unpinned changed-check used stale remote
origin/main; pinned-base proof owns validation. Final head20ead5da8c3c659c12f28e47f1d5f7e4bd27d20cpassed CI run 36277843970: all 164 jobs succeeded in 880 seconds (14m40s), including both requiredopenclaw/ci-gateresults. All owned Testbox leases are stopped. The requested auto-merge attempt was rejected by the installedghshim withstring rewrite protection blocked unsafe input; no second merge request was issued from this lane. GitHub subsequently recorded the PR merged bysteipeteat 2026-09-26 23:11:16 UTC asd9fd43d6cf4286e1734e4a6ff91b962cb3e35e82; ancestry against current main is verified.