Repository navigation
fix(daemon): keep an idle daemon alive only for retained leases - #3227
Conversation
Idle reap now waits only while an unexpired retainOnClose lease is active, through LeaseRegistry.hasRetainedLeases, which also expires leases past their window. Other leases, including human-control holds with no expiry, reap as before; ADR 0007 says so. A lifecycle-shutdown test restores the coverage that a session lease is released when its session teardown rejects.
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Size Report
Startup median (7 runs, lower is better):
|
|
The retained-lease idle check in 887243c needs one more change before merge: a human-control hold can still keep the daemon alive. The cubic-dev-ai P2 thread on the hold case (#3227 (comment)) and the P3 thread on the expiry-on-read test (#3227 (comment)) both still apply. If you filter by Not blocking, and fine to take or leave: the idle-reap tests stub I did not run any tests. CI was still running on 887243c with no failures, and I see no overlap between the smoke routes and this change. No conflicts. Once the P2 fix lands and checks pass, it can go to human review. |
hasRetainedLeases counts a retainOnClose lease only while its own expiresAt is in the future, so a human-control hold (or admitted work) that keeps a past-due lease registered cannot keep an idle daemon alive forever. Tests: a registry case with a hold on the retained lease's device, and a runtime case where a plain lease does not block self-reap but a retained one does.
|
Addressed at e0d5f4c.
|
|
This PR is ready. The two earlier threads are fixed at e0d5f4c: only a retained lease still inside its expiresAt now defers the idle reap, and the expiry-on-read claim and the masking assertion are gone. Both new tests cover the past-due case, though I did not run them or Not blocking: the doc on the The two cubic-dev-ai threads are fixed at this commit, so you can resolve them: the past-due retained lease now stops deferring the reap (#3227 (comment)), and the expiry-on-read claim is gone (#3227 (comment)). No conflicts. The two Smoke Tests jobs are still queued or running, and no failure has shown up. The diff does not overlap with what they exercise, since they use the default 5-minute idle window and create no retainOnClose leases. Once they finish green, this is ready for human review. |
|
* origin/main: (77 commits) fix(apple-runner): fence prep spawns behind a start-owned admission (callstack#3239) 0.21.22 test(apple): own the simctl settings plan tests in simctl-settings.test.ts (callstack#3244) fix(limrun): report the session device id in iOS settings refusals (callstack#3243) 0.21.21 feat(remote): add a host-allocated macos-app lease backend (callstack#3236) test(android): bound the screenshot write wait by wall time, not event-loop turns (callstack#3250) feat(recording): cap the touch overlay frame rate at the caller's --fps (callstack#3241) fix(ad-script): let .ad scripts carry scroll --until and wait capture flags (callstack#3197) (callstack#3234) feat(provider-webdriver): keyboard enter, dismiss, and status over WebDriver (callstack#3233) feat(selectors): match role= against snapshot kind with a node-scoped alias window (callstack#3232) fix(provider-webdriver): read field values, placeholders, secure fields, and checked state from page source (callstack#3231) feat(replay): accept --test-ime on test and replay so flow-owned Android opens opt into the test IME (callstack#3235) refactor(daemon): route daemon-level diagnostics through one scope helper (callstack#3242) docs(adr): correct ADR 0031 pointer event delivery evidence (callstack#3245) fix(ios): stop a tap's post-gesture lookup from recording an XCTest failure (callstack#3060) (callstack#3237) fix(recording): render the touch overlay at most 30 fps and inside the record request (callstack#3219) fix(daemon): keep an idle daemon alive only for retained leases (callstack#3227) fix(provider-webdriver): send an empty JSON object on bodyless POSTs (callstack#3230) Feat/maestro repeat while (callstack#3214) ...
Summary
Follow-up to #3208, which merged while this was in review. It answers the open question there: idle reap now waits only while an unexpired
retainOnCloselease is active. As merged, #3208 counted every lease, so a human-control hold with noexpiresAtkept an otherwise idle daemon alive, where before it was reaped. Other leases now reap as they did before #3208.LeaseRegistry.hasRetainedLeases()owns the rule. Reading it also expires leases past their window, so an abandoned retained lease still ends. The daemon wiring is a one-line call.retainOnCloseleases keep an idle daemon alive.beforeDeleteassertions gave: a session-bound lease whose session teardown rejects is still released by the shutdown sweep.7 files, 91 gross lines.
Validation
At
e0d5f4c2d3:pnpm check:affected --runpasses. A retained lease counts only while its ownexpiresAtis in the future, so a human-control hold cannot keep an idle daemon alive. Registry, runtime idle-reap and shutdown tests each fail under their mutation.