Skip to content

test(sessions): cover abrupt committed transcript recovery - #143984

Merged
vincentkoc merged 1 commit into
mainfrom
test/session-abrupt-restart-20260910
Sep 13, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
test/session-abrupt-restart-20260910

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

The session durability tests covered completed turns and graceful restarts, but did not verify that a committed conversation survives abrupt Gateway termination and accepts another turn after restart.

Why This Change Was Made

Extend the existing shared lifecycle with three checkpoints: confirmed termination of the fixture-owned process tree, restart against the same state, and a fresh user/assistant exchange. Assert exact transcript/history identity and ordering, preserved sibling state, and no active JSONL resurrection. All 21 existing checkpoints remain in order.

User Impact

No production behavior change. Developers gain regression coverage for recovering committed conversations after a Gateway process crash.

Evidence

  • Final head: bd364b1e1ed7907100b8d661d64691b35bced83e. Independent exact-head review and refreshed automated review found no actionable issues.
  • Linux x86_64, Node 24.19.0: both existing entry tests passed, one file/one test each, with all 24 checkpoints. Default entry: 50.10s; built-CLI entry: 51.95s.
  • Clean candidate build passed, including validation of 152 SDK subpaths. Both tests used the same verified built checkout and a real isolated Gateway with a deterministic loopback provider. Build metadata records base 89c43eac83914e7535346262ec5238e2ad9e08a0; production bytes are unchanged by this test-only commit. The tracked source used by the final tests was independently verified identical to final head bd364b1e1ed7907100b8d661d64691b35bced83e.
  • Selected typechecks, import/boundary guards, scripts lint and dead-export checks passed. The initial changed gate stopped on one assertion-style lint finding; after correction, the exact typed-lint surface and required shared-helper boundary check passed. The complete compound gate was not rerun. Both E2E tests and review were refreshed after that correction.
  • Production: +0/-0. Tests/support: +212/-1.

Focused commands:

OPENCLAW_E2E_USE_PREBUILT_DIST=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/scripts/sqlite-sessions-transcripts-flip-proof.e2e.test.ts
OPENCLAW_E2E_USE_PREBUILT_DIST=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/scripts/sqlite-sessions-transcripts-flip-proof.built-cli.e2e.test.ts

Coverage is limited to already-committed turns and Linux process termination. In-flight transactions, power loss, cross-agent isolation, duplicate ingress, installed tarballs and native Mac/Windows behavior remain separate proof obligations.

Punchcard-Session: ember-river-timber-wj

Punchcard-Session: ember-river-timber-wj
@vincentkoc vincentkoc self-assigned this Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Sep 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 1:17 PM ET / 17:17 UTC (Revision 2).

ClawSweeper review

What this changes

Extends the shared session lifecycle tests to verify that committed conversations survive forced Gateway termination and accept another turn after restart.

Merge readiness

✅ Ready for maintainer review

Keep open: this adds useful recovery coverage absent from the inspected main and release harnesses. No actionable patch defect was found, and the member-authored PR is protected from automatic closure.

Priority: P2
Reviewed head: bd364b1e1ed7907100b8d661d64691b35bced83e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused boundary coverage, reported runs of both entry tests, and no actionable correctness or security findings support normal good quality.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The ordinary contributor-proof gate is exempt for this member-authored PR. Its captured body reports both real isolated Gateway entry tests passing after forced termination, with transcript preservation and successful append; execution was not repeated during this review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this member-authored PR. Its captured body reports both real isolated Gateway entry tests passing after forced termination, with transcript preservation and successful append; execution was not repeated during this review.
Evidence reviewed 9 items Introduced recovery lifecycle: The pinned merge-base-to-head patch extends the existing fixture. It observes exit and close before signaling, verifies forced termination and process-group death, and only then releases the fixture owner and restarts.
Meaningful recovery assertions: Assertions compare complete stored events and message history across restart, preserve the sibling conversation, require precisely another user/assistant pair, and check unique message IDs against chat-history IDs. Existing checkpoint assertions also cover the three added checkpoints.
Existing process ownership: The fixture starts a detached process group on supported platforms and retains its child until exit, pipe closure, and process-group termination are established. The new fault injection reuses the shared termination and inspection helpers.
Findings None None.
Security None None.

How this fits together

The Gateway stores conversation transcripts in each agent’s SQLite database and exposes them through chat history. This test exercises that storage through a real isolated Gateway, then compares persisted events and returned messages across termination and restart.

flowchart TD
 A[Completed conversation] --> B[Capture database and chat history]
 B --> C[Force Gateway termination]
 C --> D[Verify process tree stopped]
 D --> E[Restart with same state]
 E --> F[Compare recovered conversation]
 F --> G[Send and verify another turn]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +211. Total +211 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 212 1 +211
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 212 1 +211

Review metrics

None.

Technical review

Best possible solution:

Retain this scenario in the existing shared lifecycle fixture, with its stated scope limited to recovery of already-committed turns.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this adds coverage for an existing durability contract rather than fixing a demonstrated current failure.

Is this the best way to solve the issue?

Yes: extending the shared lifecycle exercises real persistence and chat-history boundaries without adding production seams or duplicating fixture setup.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0fcaa5c27a73.

Labels

Label justifications:

  • P2: Adds focused protection for committed conversation recovery without changing production behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this member-authored PR. Its captured body reports both real isolated Gateway entry tests passing after forced termination, with transcript preservation and successful append; execution was not repeated during this review.

Evidence

What I checked:

  • Introduced recovery lifecycle: The pinned merge-base-to-head patch extends the existing fixture. It observes exit and close before signaling, verifies forced termination and process-group death, and only then releases the fixture owner and restarts. (test/helpers/sqlite-sessions-transcripts-flip-proof.ts:1347, bd364b1e1ed7)
  • Meaningful recovery assertions: Assertions compare complete stored events and message history across restart, preserve the sibling conversation, require precisely another user/assistant pair, and check unique message IDs against chat-history IDs. Existing checkpoint assertions also cover the three added checkpoints. (test/helpers/sqlite-sessions-transcripts-flip-proof-assertions.ts:97, bd364b1e1ed7)
  • Existing process ownership: The fixture starts a detached process group on supported platforms and retains its child until exit, pipe closure, and process-group termination are established. The new fault injection reuses the shared termination and inspection helpers. (test/helpers/openclaw-test-instance.ts:344, bd364b1e1ed7)
  • Current-main necessity check: The fetched main harness still disconnects and gracefully stops immediately after the completed agent turn; it does not contain the added abrupt-restart scenario. (test/helpers/sqlite-sessions-transcripts-flip-proof.ts:274, 0fcaa5c27a73)
  • Latest-release comparison: Reading the same harness at the supplied v2026.9.4 release commit showed the existing graceful-stop sequence without this recovery scenario. (test/helpers/sqlite-sessions-transcripts-flip-proof.ts:274, 3a9d69db306c)
  • Reported execution and review continuity: The captured PR body reports both existing entry tests passing on Linux with Node 24.19.0, all 24 checkpoints, and tracked source verified against the pinned head. It explicitly limits coverage to committed turns and Linux termination. The previous completed review used this same head and retained no findings; no tests were executed during this read-only review. (bd364b1e1ed7)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-10T11:24:30.960Z sha bd364b1 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc marked this pull request as ready for review September 13, 2026 17:11
@vincentkoc
vincentkoc merged commit edde2c2 into main Sep 13, 2026
366 of 372 checks passed
@vincentkoc
vincentkoc deleted the test/session-abrupt-restart-20260910 branch September 13, 2026 17:52
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '201f11afefdb19a9c75e9d3542bf7425c80df7a7': (141 commits)
  fix: keep catalog discovery scoped and execution lazy (#147159)
  fix: serialize reclamation worker shutdown with foreground writes (#147178)
  test(sessions): cover abrupt committed transcript recovery (#143984)
  fix: stop transcript storms during context overflow recovery (#147202)
  fix: reduce CPU overhead for small history and usage reads (#147205)
  fix: resume tasks after tools finish and the model times out (#147203)
  refactor(scripts): share SQLite reliability message waits (#146900)
  feat(exec): configure approval reviewer thinking and fastMode (#147192)
  test: remove redundant Bonjour module headers (#146981)
  refactor: share streaming media tail boundary update (#146989)
  refactor(tui): classify resume candidates once (#146983)
  improve: skip unused toast dismissal work (#147196)
  fix(linux): recover saved remote connections without replacing active sessions (#146047)
  fix: doctor stays silent when Windows state dir is under OneDrive (#123720)
  feat: announce successful Daybreak retries (#147146)
  feat(code-mode): reuse results across code cells (#147154)
  refactor(test): reuse CLI plugin fixture writer (#147186)
  test: skip unused compiler setup in routing fixtures (#147194)
  test: reuse LINE webhook runtime fixture (#146710)
  fix(code-mode): check automation and process result types (#147143)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '2d87daf04b78992382299d552f15ac84a86a23ed': (1815 commits)
  fix(ui): distinguish tool activity with semantic icons (#147207)
  fix(linux): recover completed Quick Chat replies without resending (#146048)
  feat(desktop): unify Tauri title bar and window controls (#147097)
  refactor(test): share plugin fixture server shims (#147225)
  perf(gateway): defer worker workspace execution imports (#143496)
  fix(gateway): post-ack webhook work fails with "Async work scope is closed" (#144801)
  refactor(scripts): centralize upgrade survivor version floors (#146975)
  fix(ci): check publication registries before FRV fanout (#147184)
  fix(qa): align system-agent delegation with channel contracts (#145905)
  improve: reduce repeated chat message identity work (#147210)
  fix(channels): remove stale pre-tool previews from Slack and Telegram (#147106)
  fix: keep catalog discovery scoped and execution lazy (#147159)
  fix: serialize reclamation worker shutdown with foreground writes (#147178)
  test(sessions): cover abrupt committed transcript recovery (#143984)
  fix: stop transcript storms during context overflow recovery (#147202)
  fix: reduce CPU overhead for small history and usage reads (#147205)
  fix: resume tasks after tools finish and the model times out (#147203)
  refactor(scripts): share SQLite reliability message waits (#146900)
  feat(exec): configure approval reviewer thinking and fastMode (#147192)
  test: remove redundant Bonjour module headers (#146981)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant