Skip to content

fix(test): compaction lifecycle tests race awaited persistence - #163883

Merged
jalehman merged 1 commit into
mainfrom
openclaw/ci-compaction-timeout
Oct 3, 2026
Merged

jalehman merged 1 commit into
mainfrom
openclaw/ci-compaction-timeout

Conversation

@jalehman

@jalehman jalehman commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes release-validation failures when real compaction persistence takes longer than the test fixture’s universal one-second deadline.

User Impact

No user-visible runtime change. Compaction lifecycle tests exercise their intended cancellation, writer-authority, accounting, and recovery stages independently of disk or worker startup speed.

Why This Change Was Made

Ordinary lifecycle proofs use the production timeout window. Intentional timeout cases freeze only timeout scheduling, wait for an explicit backend checkpoint, then advance the real safety wrapper’s clock. A pre-commit control holds a real opened writer and proves that expiration rejects its eventual append; the existing post-commit case waits for durable persistence and accounting before expiration. No retries, sleeps, production timeout changes, or weakened writer guards.

Evidence

  • Unchanged current-main fixture: reproduced all four failures from Full Release Validation run 37067360490/job 111038843787 (4 failed, 21 passed).
  • Fixed real-persistence lifecycle suite: 26/26 passed; safety-timeout sibling: 7/7 passed.
  • One-worker command: node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.compaction-runtime.test.ts src/agents/embedded-agent-runner.compaction-safety-timeout.test.ts --maxWorkers=1 (unique filesystem cache). 123.38s combined wall time; lifecycle Vitest duration 107.45s; sibling 3.05s.
  • The release-only lifecycle composition deliberately retains real admission, SQLite worker/writer claims, durable appends, maintenance, and independent reopen reads. A mocked storage unit test cannot prove those boundaries. No full-suite or repeated flake runs were used.
  • Independent autoreview: scoped-clean through P2.
  • Changed-file checks passed 17 selected guards; scoped lint passed. Local type checking correctly refused external readonly dependencies, so its checkout boundary was preserved and hosted CI supplied the missing type proof.
  • Exact head 4be67652d1f65e1f57c02f1655a0b9f21b8314ab: CI run 37080756374 succeeded, including all core test-type lanes and lint. Hosted changed-tests job 111080754794 passed the lifecycle suite 26/26 (38.53s Vitest; 61.85s wrapper wall).
  • Completed exact-head ClawSweeper review: no findings; proof sufficient.

@clawsweeper

clawsweeper Bot commented Oct 3, 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.

@jalehman
jalehman marked this pull request as ready for review October 3, 2026 00:08
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Oct 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 8:12 PM ET / October 3, 2026, 00:12 UTC.

ClawSweeper review

What this changes

The PR lets ordinary compaction lifecycle tests use the production timeout and advances intentional deadlines only after explicit persistence checkpoints.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused test repair: current main retains the one-second fixture deadline, and the patch preserves cancellation and persistence assertions. No actionable introduced defect was found.

Priority: P2
Reviewed head: 4be67652d1f65e1f57c02f1655a0b9f21b8314ab

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture repair with meaningful persistence controls and reported before-and-after execution.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): For the changed test-fixture behavior, the captured execution results exercise real recovery, SQLite writers, append rejection before commit, and recovery after durable commit through the lifecycle suite. Source confirms those boundaries remain real despite the synthetic engine; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): For the changed test-fixture behavior, the captured execution results exercise real recovery, SQLite writers, append rejection before commit, and recovery after durable commit through the lifecycle suite. Source confirms those boundaries remain real despite the synthetic engine; no stored-data contract changes.
Evidence reviewed 7 items Pinned introduced change: The verified merge-base-to-head patch changes only the lifecycle test and its support fixture; production timeout, persistence, and authority implementations are untouched.
Current main still needs the repair: Comparison with fetched main shows that main retains timeoutSeconds: 1 and lacks both checkpoint-controlled deadline execution and the pending-writer negative control.
Meaningful persistence control: The added test opens a real SessionManager, holds its return until expiration, releases it, checks the actual append rejection, and independently reopens the transcript to verify no durable change. The post-commit case separately waits for append completion and accounting before expiration.
Findings None None.
Security None None.

How this fits together

Compaction recovery reduces an agent session’s context after overflow or timeout. These tests exercise recovery, admitted writer authority, durable transcript changes, and subsequent retry decisions.

flowchart TD
  A[Overflow or timeout] --> B[Compaction recovery]
  B --> C[Safety deadline]
  B --> D[Admitted transcript writer]
  C --> E[Cancellation]
  D --> F[Durable transcript]
  E --> D
  F --> G[Accounting and retry]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +76. Total +76 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 81 5 +76
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 81 5 +76

Review metrics

None.

Technical review

Best possible solution:

Keep lifecycle assertions tied to explicit backend checkpoints while retaining the production cancellation and durable-write guards.

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

Yes, source establishes that the current fixture races awaited persistence against a universal one-second compaction deadline; the author also reports four baseline failures. This review did not execute that reproduction.

Is this the best way to solve the issue?

Yes, checkpoint-controlled deadline tests isolate the intended ordering while ordinary cases retain real persistence and the production timeout window.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5d08c652bc5a.

Labels

Label changes:

  • add P2: This repairs release-validation fixture failures without changing user-facing runtime behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. For the changed test-fixture behavior, the captured execution results exercise real recovery, SQLite writers, append rejection before commit, and recovery after durable commit through the lifecycle suite. Source confirms those boundaries remain real despite the synthetic engine; no stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): For the changed test-fixture behavior, the captured execution results exercise real recovery, SQLite writers, append rejection before commit, and recovery after durable commit through the lifecycle suite. Source confirms those boundaries remain real despite the synthetic engine; no stored-data contract changes.

Label justifications:

  • P2: This repairs release-validation fixture failures without changing user-facing runtime 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. Sufficient (terminal): For the changed test-fixture behavior, the captured execution results exercise real recovery, SQLite writers, append rejection before commit, and recovery after durable commit through the lifecycle suite. Source confirms those boundaries remain real despite the synthetic engine; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. For the changed test-fixture behavior, the captured execution results exercise real recovery, SQLite writers, append rejection before commit, and recovery after durable commit through the lifecycle suite. Source confirms those boundaries remain real despite the synthetic engine; no stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The verified merge-base-to-head patch changes only the lifecycle test and its support fixture; production timeout, persistence, and authority implementations are untouched. (src/agents/embedded-agent-runner/run.compaction-runtime.test.ts:39, 4be67652d1f6)
  • Current main still needs the repair: Comparison with fetched main shows that main retains timeoutSeconds: 1 and lacks both checkpoint-controlled deadline execution and the pending-writer negative control. (src/agents/embedded-agent-runner/run.compaction-runtime.test-support.ts:193, 5d08c652bc5a)
  • Meaningful persistence control: The added test opens a real SessionManager, holds its return until expiration, releases it, checks the actual append rejection, and independently reopens the transcript to verify no durable change. The post-commit case separately waits for append completion and accounting before expiration. (src/agents/embedded-agent-runner/run.compaction-runtime.test.ts:416, 4be67652d1f6)
  • Production cancellation boundary: Recovery binds transcript writes to the safety wrapper’s child signal and original live owner; the write assertion checks that signal before allowing persistence. The patch exercises this existing guard without modifying authority or storage contracts. (src/agents/embedded-agent-runner/run/compaction-runtime.ts, 4be67652d1f6)
  • Reported boundary execution: The captured PR body reports four failures on the unchanged fixture, followed by 26/26 passing real-persistence lifecycle cases and 7/7 passing safety-timeout siblings. It records 123.38 seconds combined wall time and explains why real SQLite admission, writer claims, durable append, and reopen reads are necessary. These results were supplied by the author; this read-only review did not execute tests. (4be67652d1f6)
  • Area history and routing: Current-main history records Peter Steinberger’s awaited-persistence work and Vincent Koc’s worker-fixture lifecycle repair. GitHub commit metadata verifies handles steipete and vincentkoc; these are routing signals, not causal attribution. (src/agents/embedded-agent-runner/run.compaction-runtime.test-support.ts, 82a4cfbe57d7)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: 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.

@jalehman
jalehman merged commit 363b9d0 into main Oct 3, 2026
193 of 196 checks passed
@jalehman
jalehman deleted the openclaw/ci-compaction-timeout branch October 3, 2026 00:16
@jalehman

jalehman commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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