Skip to content

fix: stop compaction recovery when a run times out - #159105

Merged
steipete merged 4 commits into
mainfrom
codex/compaction-recovery-budget
Sep 26, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/compaction-recovery-budget

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes automatic compaction continuing after the session queue has timed out its run.

User Impact

Timed-out runs cancel active overflow and timeout recovery through the same signal as their model attempts. Existing timeout limits, compaction grace, and already-committed history are preserved.

Why This Change Was Made

Recovery inherited only the caller's cancellation signal, while queue expiry revoked a separate composed signal. Bind that composed signal once at run admission and remove the failover-only override. Direct attempt cancellation still notifies its specific reply operation after the lane owner verifies current authority; upstream cancellation retains its original reason.

CI also exposed fixture lifetime defects. The shared channel startup helper now observes its returned task, detects startup failure while awaiting readiness, and always aborts and joins failed checks. Google Chat uses a per-start readiness event and the same cleanup owner for restarts. The native Talk fixture now seals publication admission and joins every retained publication before disposing its projection, including when the model or a publication rejects. Exact-once, unregister, socket, and lifecycle assertions remain intact.

Evidence

  • The registered runner regression fails before the fix: the real queue reports timeout while the active recovery signal remains live. With the fix, 60 focused recovery, cancellation, native callback lifetime, projection, and queue-ownership tests pass. The new four-case file took 19.71 seconds including initialization, with 1.25 seconds in case bodies; both focused shards took 175.14 seconds.
  • Three channel-fixture regressions fail before their fixes: missing abort on readiness/assertion failure, plus an early startup rejection that hangs readiness and creates an unhandled derivative. Afterward, 55 tests across five files pass in 15.24 seconds; the early-rejection case takes 2 ms. A final Google Chat compatibility rerun passes all 30 cases in 12.95 seconds.
  • After adopting upstream registry-discovery repair 3d90381, 41 tests across five files pass, including all 23 native Talk cases. Real publication controls cover ordinary metadata refresh, exhaustion of the documented two-retry budget, retired state admission, and unchanged propagation of an unrelated error.
  • After resolving an overlap with that now-upstream WhatsApp fix, a focused composition rerun on base d9fd43d passes all 57 cases: four publication, 23 Talk, and 30 Google Chat tests (116.06 seconds total). The four remaining PR commits are patch-identical.
  • All 22 WhatsApp socket-lifecycle tests pass under CI's database-worker profile. Core, all 25 core-test type graphs, plugin type graphs, SDK exports/surface checks, and formatting pass. Independent review has no actionable P0–P2 findings.
  • Validation uses synthetic model/summarizer work through the real runner, queues, attempt deadline, compaction delegate, and watchdog. The production incident session was preserved; no production provider request was replayed.

The runtime diff is net −2 lines; additional changes are tests and existing test support. No schema, configuration, provider protocol, or timeout-policy change.

Main subsequently incorporated the same WhatsApp inbound-drain fix in 945ec9f, so its duplicate patch was dropped here. The existing Google Chat preload repair a3dcaa1 (credit Gabriel Bogdanovsky) is also retained; readiness and cleanup remain owned by the shared lifecycle helper.

An upstream Cron scheduler-fixture failure was resolved by refreshing onto existing main repair c0e6951. All three formerly failing Cron files pass (13 tests), along with both affected type graphs; this PR adds no Cron change.

The native Talk publication failure recurred in CI runs 36268149681 and 36273823971. A controlled real-worker reproduction then established that ordinary sibling registration could invalidate the first history-registry acquisition before a topology witness existed. Main already contained the owning repair in 3d90381, so this branch adopts it rather than adding a competing retry policy. The original failing CI operation's precise invalidator remains unobserved. This PR adds publication-boundary coverage and fixes rejected-publication fixture cleanup; the upstream repair retains the original state/source admission and permits only its documented metadata refresh budget.

@clawsweeper

clawsweeper Bot commented Sep 26, 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 docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Sep 26, 2026
@steipete
steipete marked this pull request as ready for review September 26, 2026 18:51
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 7:27 PM ET / 23:27 UTC (Revision 5).

ClawSweeper review

What this changes

The branch carries session-queue cancellation into agent compaction recovery, adds regression and fixture coverage, and clarifies timeout behavior in the compaction guide.

Merge readiness

✅ Ready for maintainer review

Keep open: current main and the latest release still have the queue-timeout recovery gap. This branch remains a viable repair, and GitHub now reports it as mergeable.

Priority: P1
Reviewed head: dc76f2f8caa8d2731ce013fd48c4fe53696144de

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused runtime repair has relevant boundary coverage and no identified correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The Repository State classifies this as a member-authored PR, so the external-contributor proof gate does not apply. The reported before-and-after test reaches the production runner and queue timeout with synthetic model and compaction work, and observes recovery cancellation; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The Repository State classifies this as a member-authored PR, so the external-contributor proof gate does not apply. The reported before-and-after test reaches the production runner and queue timeout with synthetic model and compaction work, and observes recovery cancellation; no stored-data contract changes.
Evidence reviewed 8 items Current-main gap: Fetched main still assigns the caller signal to admitted run parameters, so recovery does not receive the queue-owned timeout signal.
Queue cancellation owner: The lane controller composes caller and queue cancellation; queue timeout aborts that signal with the timeout error.
Introduced repair: The introduced hunk binds the lane controller’s composed signal to admitted run parameters, which recovery and its compaction runtime consume.
Findings None None.
Security None None.

How this fits together

The embedded agent runner receives turns from the session queue and may compact session history after a model attempt overflows. Queue cancellation must reach recovery before it retries or updates that history.

flowchart LR
A[User turn] --> B[Session queue]
B --> C[Model attempt]
C --> D{Overflow?}
D -- Yes --> E[Compaction recovery]
E --> F[Session history and reply]
B -- Timeout --> G[Run cancellation]
G -- Stops --> E
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -2, Tests +493, Docs 0. Total +491 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 2 6 8 -2
Tests 7 574 81 +493
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 581 90 +491

Review metrics

Metric Value Why it matters
Code growth allocation runtime −2 net lines; tests and fixtures +493 net lines The net growth is regression and fixture coverage; the production repair does not expand the runtime.
Runner regression cost 4 cases; 19.71 s reported file wall time The new integration file exercises the queue and recovery boundary below the repository’s 30-second explanation threshold.

Technical review

Best possible solution:

Keep the queue’s cancellation authority effective throughout recovery, while preserving the existing compaction watchdog and transcript-write guard.

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

Yes, from source: current main leaves recovery on the caller signal while queue expiry aborts the lane signal. The PR reports a failing pre-fix registered-runner case; this read-only review did not run it.

Is this the best way to solve the issue?

Yes. Binding the existing lane signal at run admission repairs the gap without adding a competing timeout policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against aa8732e72f28.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: A timed-out agent run can continue compaction recovery after its session queue has expired.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 Repository State classifies this as a member-authored PR, so the external-contributor proof gate does not apply. The reported before-and-after test reaches the production runner and queue timeout with synthetic model and compaction work, and observes recovery cancellation; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: 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 (4 earlier review cycles)
  • reviewed 2026-09-26T19:18:48.294Z sha 07207c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-26T20:11:56.833Z sha d1d9fde :: needs maintainer review before merge. :: none
  • reviewed 2026-09-26T21:49:26.209Z sha b57e2b1 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-26T23:18:21.625Z sha e5afd756064bd6f781c0db81dbe5dcd813ccdc17 :: blocked before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the channel: whatsapp-web Channel integration: whatsapp-web label Sep 26, 2026
@steipete
steipete force-pushed the codex/compaction-recovery-budget branch from 83aa3f6 to d1d9fde Compare September 26, 2026 20:02
@steipete
steipete enabled auto-merge (squash) September 26, 2026 20:11
@steipete
steipete disabled auto-merge September 26, 2026 20:49
steipete added a commit that referenced this pull request Sep 26, 2026
Reuse the event-driven fixture repair from d1d9fde in #159105. The timeout case must finish durable inbound settlement before switching clocks, so unrelated worker bookkeeping cannot pollute its unchanged zero-timer assertion.
@openclaw-barnacle openclaw-barnacle Bot added the channel: googlechat Channel integration: googlechat label Sep 26, 2026
@steipete
steipete force-pushed the codex/compaction-recovery-budget branch from b57e2b1 to e5afd75 Compare September 26, 2026 23:11
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: L and removed size: M labels Sep 26, 2026
@steipete
steipete force-pushed the codex/compaction-recovery-budget branch from e5afd75 to dc76f2f Compare September 26, 2026 23:20
@openclaw-barnacle openclaw-barnacle Bot removed the channel: whatsapp-web Channel integration: whatsapp-web label Sep 26, 2026
@steipete
steipete merged commit 374f893 into main Sep 26, 2026
209 checks passed
@steipete
steipete deleted the codex/compaction-recovery-budget branch September 26, 2026 23:41
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
* fix: stop compaction recovery when a run times out

* test: preserve compaction fixture method ownership

* test: join failed channel startup before resetting fixtures

* test: preserve publication custody through registry churn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: googlechat Channel integration: googlechat docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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