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. |
|
Pushed a second commit: |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 2:58 AM ET / 06:58 UTC. ClawSweeper reviewWhat this changesThe PR writes a session header before reset boundaries on empty SQLite transcript windows and forwards a workspace fallback from gateway, reply-runner, and cron reset paths. Merge readiness⛔ Blocked before merge - 1 item remains Keep open. Current main still permits a reset boundary to become the first event of an empty transcript, while this PR repairs both lifecycle writers and preserves the correct workspace metadata. Priority: P1 Review scores
Verification
How this fits togetherReset producers replace the live session row while appending a boundary to the prior transcript. Later agent runs load that durable transcript; its header supplies the version and working directory needed to resume safely. flowchart LR
A[Gateway, reply, runner, or cron reset] --> B[Session lifecycle write]
B --> C{Prior transcript empty?}
C -->|Yes| D[Write versioned session header]
C -->|No| E[Keep existing header]
D --> F[Append reset boundary]
E --> F
F --> G[Later agent run loads transcript]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +94, Tests +428. Total +522 across 15 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the lifecycle-owned header-before-boundary invariant, with the prior session row as workspace authority and producer workspace only as the fallback. Do we have a high-confidence way to reproduce the issue? Yes—source establishes the path: persist an existing session row with zero transcript events, append a reset boundary, then load the resulting non-header-first transcript. The supplied real CLI trace demonstrates the repaired sequence and successful subsequent reply. Is this the best way to solve the issue? Yes. Repairing both lifecycle owners before the boundary is appended is the narrow canonical fix; a later-load workaround could not restore the lost header ordering safely. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c5f52cc51e3a. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Both blockers from the last review are addressed on the branch (
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
8c70cd5 to
71566dc
Compare
|
@clawsweeper re-review Addressed the remaining P1 (head
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…mpty window (openclaw#118675) A session window can exist with a still-empty transcript when a reset arrives (created moments earlier, before its first message). Appending the reset boundary then makes seq 0 a `reset` event; ensureTranscriptHeader only fires on an *empty* transcript, so the first message append skips it and the window stays permanently headerless -- rejected on every later load as a legacy transcript before the model runs. Establish the header before the boundary at both reset-boundary append sites (single-target lifecycle reset and the batched lifecycle upsert), and record the session workspace in headers created this way: the value is threaded as `resetBoundaryCwd` alongside the `resetBoundary` request from the gateway session-reset and reply-session-initialization callers. Rebased onto current main's `SessionResetBoundaryRequest` reset plumbing. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01HspGQJnLGMcam6jCottM9v
…t headers The agent-runner reset path called persistSessionResetLifecycle without a workspace, so an empty-window reset from that producer stamped the new header with the service process cwd. Forward the runner's effective workspace (spawnedCwd, spawnedWorkspaceDir, or the follow-up run workspace -- the same value the diff baseline settles against) and assert the persisted header cwd in the runner-boundary test. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01HspGQJnLGMcam6jCottM9v
The stale-cron reset producer appended its pending boundary through the batched lifecycle upsert without a workspace, so a reset landing on an empty prior cron window created the header from process.cwd() and persisted the gateway process directory as the session workspace. Forward the run's already-resolved workspaceDir as resetBoundaryCwd alongside the pending cron-stale boundary. With this every resetBoundary producer (gateway reset, reply-session init, agent-runner reset, cron stale reset) supplies a workspace. Tests: forwarding with a pending boundary, none without one, and an end-to-end stale reset on an empty window against a real SQLite store asserting seq 0 = session v3 cwd=<run workspace>, seq 1 = reset. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01HspGQJnLGMcam6jCottM9v
The reset-boundary header is written for the prior row's session, so that row's own workspace (spawnedCwd, then spawnedWorkspaceDir) must win; the caller-supplied workspace is only a fallback for rows that never recorded one. Gateway and reply initialization pass the configured agent workspace, which mis-stamped custom-workspace sessions and was then preserved by transcript cut/fork paths. The agent runner no longer re-derives spawned precedence itself; it passes the run workspace as the fallback only. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01HspGQJnLGMcam6jCottM9v
71566dc to
9c00082
Compare
|
Rebased onto current main ( |
|
Production repro of the same defect, with an On 2026-08-08 a WhatsApp group session (SQLite store, stock schema) had its window created but no append landed yet — the session row existed with zero {"type":"reset","id":"a8ba160a","parentId":null,"timestamp":"2026-08-08T13:02:11.647Z","reason":"idle"}No Re-verified on Worth flagging for triage: #127547 was closed as already implemented on the premise that "a reset on a missing session row no longer appends a reset boundary, and the first persisted event for a fresh transcript writes the version-3 header first". Both hold, and neither covers a row that exists with a zero-row transcript — that boundary is appended by the store lifecycle ( Second, smaller point on the same failure: |
|
Thanks @abacha — that is the same defect from the other producer. Your Agree on #127547: the two premises there hold, but neither covers an existing row with an empty transcript, because that boundary is appended by the store lifecycle rather than the session manager. The |
|
@clawsweeper re-review The header-first repair is retained on |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks @kiranvk-2011! Landed as 62ff6248557c, preserving your primary credit and contributor history. Proof: Real Telegram reset → normal answer, Gateway restart → reset-with-tail answer, and installed CLI delivery all completed. The empty-window capture now starts with the existing v3 header, then the reset boundary. The fixture-only final correction passed five package tests; the retained 311 focused tests and product proof remain valid. The exact-head CI run and independent P0 review passed before the guarded merge.
No schema, migration, protocol, permission, or configuration change. The recorded slow-CPU CLI timeout and post-turn compaction timeout remain explicit limits of the proof; final answer delivery succeeded with the documented CLI timeout override. The separate status-marker repair continues in #124633. |
…penclaw#125336) Initialize an empty transcript with its existing versioned session header before either lifecycle writer appends a reset boundary. Keep the prior session row's workspace authoritative. Carry the caller's resolved workspace in the required reset-boundary write for rows without a recorded workspace. Preserve existing commit guards, reset reasons, session identities, and transaction order. Proved the reset-to-next-turn failure on main, then verified real Telegram follow-up, restart, reset-with-tail, and installed CLI delivery on the repaired head. Focused coverage passes 311 tests. No schema, migration, protocol, permission, or configuration change. Co-authored-by: Ayaan Zaidi <[email protected]>
What problem this solves
A session row can exist before its transcript has any events. If a reset arrives then, the reset boundary takes sequence zero. Later message appends cannot initialize a header over that nonempty history. The next user turn fails before inference with
Persisted legacy session transcripts require doctor/import migration before runtime use.This retains Kiran V K's (@kiranvk-2011) header-first repair and all four contributor commits. The preparation consolidates the workspace input and verifies the complete reset-to-reply flow.
Root cause and fix
Both reset append owners now call the existing
ensureTranscriptHeaderinside their existing guarded transaction, before building and appending the reset boundary:src/config/sessions/session-accessor.sqlite-lifecycle.ts: single-target reset.src/config/sessions/session-accessor.sqlite-projection.ts: batched lifecycle write.The prior row's
spawnedCwd, thenspawnedWorkspaceDir, owns the header workspace. The caller's resolved workspace covers rows that recorded neither. OneSessionResetBoundaryWritecarries that required input through Gateway reset, reply initialization, runner reset, and stale cron reset. It replaces parallel optional workspace state and the duplicate cron writer declaration.The reader remains strict. This does not reinterpret or repair existing malformed transcripts. There is no schema/version/table/index change, new persisted field, migration, backfill, protocol, permission, or configuration change.
Evidence
Baseline:
26f87a37009bb452afae8523cbaf4063fbca247e.Product-tested candidate:
3f479d92481e5a8355c5a22be6ca2fe980cbe6ef.Current head:
d424ad6f14c6b80550322bd7d5bb1a9789d14374.The complete difference is one package-test fixture line supplying its owned temporary workspace. All other tracked files are identical; product proof and build inputs are unchanged.
Real Telegram Test Server proof used an independently leased user and bot, a normally loaded Plugin SDK observer, and a real isolated inference provider. No channel, reset handler, delivery path, or model response was mocked.
/reset, then normal input in the same fresh session/reset What is 6 plus 7?completes with “6 plus 7 equals 13.” as ordinary answer contentagent --deliver:/reset, then/newon an empty windowstatus: ok,summary: completed, deliverysent; the user receives “9 plus 10 equals 19.”The CLI follow-up uses its documented per-command
--timeout 1800for slow CPU inference. The earlier invocation hit the unchanged 600-second default, returned timeout/aborted, and visibly delivered its error. That failed attempt remains in the evidence. Product defaults, full prompts, tools, and the tested source did not change for the corrected invocation.The final database backup and complete row capture retain schema 19, the existing v3 header, the reset, and the completed user/assistant exchange. Actual Gateway restart and the next completed turn exercise reopening. No separate old-reader or live ACP/Codex-backend claim is made.
Supporting verification:
dcdeede2fa47552f3c0dbd5208b5fbf52bb85323has no change to the touched production files.Limitations and review disposition
The successful CLI turn was followed by an auxiliary compaction attempt that hit its existing 180-second deadline. The owner logged
continuing final delivery; the correct answer was delivered and the original transcript remained. This is not a compaction-success claim. Complete error events remain in the independent-review evidence.Earlier setup, small-provider, observation-budget, and lease/control failures remain retained. Only the completed same-head sequences above are green. Owned temporary groups were reconciled and all leases released.
The separate reset-status marker repair remains in #124633. This header-only head still exposes the existing unmarked acknowledgements to the answer hook; it does not claim to fix that separate metadata defect.
ClawSweeper's prior workspace and lifecycle-owner findings are retained and addressed. The net-positive production risk is reduced from +94 to +49 by replacing parallel inputs with one required boundary shape. Production is +96/-47; tests are +478/-16. The remaining growth supplies the missing workspace through all four producers and initializes the existing header at both transaction owners. A reader fallback or skipped reset event would violate the existing contract.
Missing-header diagnostic wording remains the contributor's separate follow-up noted in this PR's discussion. Compaction policy is outside this ordering repair.
AI-assisted preparation. Independent exact-head review and current CI must pass before guarded landing.