Skip to content

fix: finish accepted ACP replay writes during shutdown - #176015

Merged
steipete merged 1 commit into
mainfrom
deslop/z20-99-acp-ledger-shutdown-20261015
Oct 18, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z20-99-acp-ledger-shutdown-20261015

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: ordinary ACP shutdown can silently discard already-admitted replay updates and leave truncated replay marked complete.

User Impact

Updates accepted before shutdown now finish recording in order before shutdown completes. If an admitted write fails during the drain, replay is marked incomplete so a later session load can use its existing transcript fallback. New work remains blocked after shutdown starts.

Why This Change Was Made

Check stopped state once when a ledger mutation is admitted, not again after it has waited behind earlier storage I/O. The existing stop owner already joins those accepted writes before database/transport teardown. Its private incomplete-marker is only called by an admitted mutation's failure handler, so it must also finish during that drain.

Two net production lines removed (+4/-6),54 test lines added. One existing owner-boundary table holds external ledger I/O to cover successful and failed first writes while a second accepted update waits. No new helper, exported seam, scheduler or custody state. No persisted schema, SQLite durability setting, retention, permission, protocol, config or dependency change.

Best-effort tradeoffs accepted

  • Remove inside-queue stop revalidation: ordinary storage I/O can delay an already-accepted update until shutdown, so the guard incorrectly dropped real work. One admission check remains; accepted work drains under the existing stop owner instead of being silently cancelled.
  • Remove stop refusal in the private incomplete marker: its only caller is the retained failure handler of accepted ledger work, and storage is still alive until that handler settles. Actual marker failures remain logged. No speculative after-close write or new cleanup protocol is introduced.
  • Introducing queue1eda44ee3627/fix(acp): show durable notice after gateway disconnect #108827 and shutdown-drain98813c23905e/fix: finish shutdown without disabling V8 compilers #168587 were inspected. Their per-session ordering and accepted-work settlement remain; neither provides a contract to discard accepted updates. This queue-loss bug is source-established, not claimed as an independently reported human incident. Actual disconnect/grace/accepted-turn recovery is unchanged.

Evidence

  • Complete update owner and existing focused suite inspected, plus actual agent/server shutdown ordering, session-load complete-replay selection, existing ledger facade/types and determining worker complete-flag operations. This is ACP transport replay, NOT the standalone Phase E session-memory backend.
  • Original production with the two new regressions:2 intended assertion failures,3 existing tests passed (11.49s Vitest/58.87s wrapper). Both failures show only the first update recorded instead of both; not fixture/startup failure.
  • Fixed focused owner proof5/5 passed (59.90s Vitest/87.60s wrapper); new regressions9ms/8ms, retained first case6.593s, transformation65% of file duration under load. No timeout/retry/skip change or performance claim. Final formatting25ms/whitespace passed. Full two-file/seven-dataset independent review scoped-clean P0-P2/0.98 with final source verification successful. Only a mechanical test callback binding rename followed, fixing the owned no-shadow lint finding without changing behavior/assertions; source is unchanged and root/mirror final blobs match. Targeted types retain36 known parse5/MCP dependency diagnostics, none in touched paths: NOT a local type pass. Corrected lint and mandatory suppression result will be recorded before publication. No SQLite persistence/reopen, live ACP client, native process, broad local build or E2E proof is claimed by this held-I/O owner regression; hosted exact-head CI is the broad gate.
  • Corrected canonical two-file type-aware lint passed. Mandatory suppression guard passed 14/14 (54.15s Vitest/63.81s wrapper); no suppression or budget change.
  • No imports/edges change, so no new cycle/component or plugin startup fanout. Existing read drain, post-stop refusal, delivery ordering and independent session queues remain tested and unchanged.
  • Phase E standalone session-memory backend/factory/registry/expiry/federation/tests untouched.

Release-note context: finish already-accepted ACP replay writes and their failure markers during normal shutdown instead of retaining incomplete history as complete.

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review October 18, 2026 02:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T02:44:54.298072Z 95a4cf9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Exact reviewed head: 95a4cf9.

Full two-file/seven-dataset independent review scoped-clean P0-P2/0.98, final source verification successful. Only a mechanical callback-binding rename followed review to fix no-shadow; final signed production10154fd513e35765a92eb6544ac28597cfb5aac3 and test0106b206fbe0918e6e427535a2c887c4b069944d blobs verified. Baseline two intended regression failures plus three retained passes became five focused passes. Current corrected lint, formatting/whitespace and14-test suppression guard passed. Local36 known dependency diagnostics are disclosed, not called a type pass.

Exact-head CI39091064058 completed SUCCESS. Every filter=all check run enumerated: selected runtime and changed-boundary suites, production/test types, lint, architecture/source contracts and browser suites succeeded. All three commit statuses succeeded. The cancelled auxiliary PR-context run117567637421 is superseded by successful same-head117567734198; it is not a missing runtime suite. No actual failed or unfinished check. Reviews and inline findings empty; exact head unchanged and MERGEABLE. No rerun, rebase, confirmation push or inherited-red exception.

Using coordinator-authorized Ending10 exact-SHA guarded squash fallback after the recorded twice-failed native startup infrastructure route. Shared dependencies/native locks untouched. This bypasses broken tooling, not CI/review gates.

Two net production lines removed,54 test lines added. Admission still closes at stop; accepted replay writes and failure markers finish before existing shutdown closes storage. No SQLite persistence/reopen or live-client claim; owner-level held-I/O proof and hosted CI cover the repair. Phase E standalone session-memory surfaces untouched.

@steipete
steipete merged commit 4fd4e4c into main Oct 18, 2026
190 of 191 checks passed
@steipete
steipete deleted the deslop/z20-99-acp-ledger-shutdown-20261015 branch October 18, 2026 02:58
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant