Skip to content

fix(daemon): a stop waits for the cleanup run in flight (#985) - #999

Merged
V3RON merged 5 commits into
mainfrom
bug/985
Oct 25, 2026
Merged

V3RON merged 5 commits into
mainfrom
bug/985

Conversation

@V3RON

@V3RON V3RON commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #985

Status

Implement: done (audited) Review: round 1, round 2, fix-check; 1 finding fixed Hardware: n/a Gate: running
Next: gate

  • A stop that lands while a cleanup run is in flight waits for that run before state.db and drivers close, and no warning/error is logged — CleanupReaper.settle (src/core/reaper.ts) waits for the daemon.started run and for dry-run and rule-scoped cleanup.run request runs; DaemonServer stop (src/daemon/server.ts) awaits it after reaper.dispose(). Proved by the three-case table in the #985 describe of src/daemon/main.test.ts; each case fails with the wait removed (code lens probes).
  • No cleanup action (driver or state.db call) runs after the stop closes them — "ends the device deletion a cleanup run has in flight before the driver is disposed" in src/daemon/main.test.ts asserts the order destroy started, destroy finished, dispose; it fails with the settle() await removed.

Other stop paths: the gateway role and nuke build no reaper; reaper.dispose() runs only in the server stop, so nothing else needed this fix.

Assumptions

none

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 1 blocking, 1 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 2. Tokens: 35.1M.
Runs: 12. Cost USD: 2.6678. Agent seconds: 1212.

Assessment: complete

Written by an agent.

@V3RON

V3RON commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: f4374e2
Round 2: 48919ca
Round fix-check: 48919ca

Runs: 12. Cost USD: 2.6678. Agent seconds: 1212.
Tokens input 282, output 59060, cache read 4632559, cache write 439282.
- build implementer: claude-sonnet-5-5 160 s $0.2082
- audit implementer: claude-sonnet-5-5 167 s $0.2329
- fix implementer: claude-sonnet-5-5 149 s $0.3169
- review 1 reviewer: claude-sonnet-5-5 161 s $0.2127
- review 1 reviewer code: claude-opus-5-5 91 s $0.4166
- review 1 reviewer claims: claude-sonnet-5-5 23 s $0.09
- review 1 reviewer spec: claude-sonnet-5-5 14 s $0.0838
- fix implementer: claude-sonnet-5-5 72 s $0.1527
- review 2 reviewer: claude-sonnet-5-5 55 s $0.1194
- review fix-check reviewer: claude-sonnet-5-5 57 s $0.1042
- review fix-check reviewer both: claude-sonnet-5-5 150 s $0.1164
- review fix-check code-reviewer both: claude-opus-5-5 113 s $0.614
Finding outcomes: {"fixed":1}. Classes: {"stop waits for in-flight work (architecture 12)":1}.

Round 2 and the first fix-check verified R1 at coordinator level only; a second, authorized fix-check ran the code lens (Opus) on f4374e2..48919ca: 0 findings.

{"findings":[{"id":"R1","role":"code","class":"stop waits for in-flight work (architecture 12)","outcome":"fixed","path":"src/daemon/server.ts","round":"1","fix":"48919cad88495d9efa3f95f9e1018f9255056e3a"}]}

Written by an agent.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warm pool logs "record could not be read: database is not open" when the daemon stops right after starting

1 participant