fix: centralize daemon startup ownership and retirement - #3127
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
df38a36 to
e72c8e1
Compare
bd5968d to
cc04d1c
Compare
|
I found one problem at 681b785 that should be fixed before merge. CI is green (14 checks, none failing), and I know of no conflicts. When no owned startup matches the observed pid and start time, stopAndRetireDaemon returns Not blocking, take or leave: the owned-startup match at line 580 restates Would making I did not run the mutations the PR describes; I only confirmed the last-startup one by reading the test. The finding above depends on |
e72c8e1 to
9b6b44a
Compare
681b785 to
3bc70bf
Compare
9b6b44a to
d495c5c
Compare
3bc70bf to
8acd13c
Compare
d495c5c to
b45777a
Compare
8acd13c to
0effe16
Compare
0effe16 to
2a359db
Compare
2a359db to
c188d9c
Compare
|
|
Reviewed ea4057a. One defect from the earlier review (#3127 (comment)) is still open, and nothing else is. CI is green: 21 checks, none failing. No conflicts. The start-time problem in https://github.com/callstack/agent-device/blob/ea4057a/src/daemon-registration-owner.ts#L239 is unchanged, and the diff from fa98d0c to ea4057a is empty for daemon-registration-owner.ts and daemon-client-lifecycle.ts. The two cubic-dev-ai P2 threads are fixed at this head, so you can resolve them. The release-error one (#3127 (comment)) is covered by process-lock.ts:183 and its test. The auth-token guidance one (#3127 (comment)) is covered by daemon-client-address-hints.ts:22-25 and its test. I did not run tests or mutations, so the 6,316-test count is unverified. I also did not check whether the process.kill spy in the managed-adb fixture hides a real macOS group-signal outcome on the production adb route. Before merge, the start-time fix and its two regressions need to land. |
20e3280 to
0d1c7b3
Compare
|
The new Repo Guards failure at Rebased onto that relevant main change and corrected the fixture at The latest transient launch-start-time review remains open. This update addresses the user's requested review work on #3135/#3140/#3144 and the related new-main CI conflict; it does not claim that missing-birth launch recovery is implemented. The reviewer asks for two sendToDaemon controls, default startup and private replay, with the first process-start-time probe returning null. Positive child-published identity must remain centrally owned; no weakened signaling/deletion proof is proposed. The user handles all merges; the monitor no longer merges anything. |
|
The earlier P1 on
The two open inline threads on process-lock release logging (#3127 (comment)) and remote hint guidance (#3127 (comment)) do not apply anymore. Both files are unchanged since ea4057a and already cover the points raised, so you can resolve them. I did not run tests or mutations at 0d1c7b3, so the ten timeout-route controls and |
|
The monitored-launch birth fix is now published at Both requested All 69 focused controls pass. The exact-head |
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
The earlier findings on 0d1c7b3 are fixed at 36d615a, and I found no new problems in the code. The startup adoption and private retirement route now has regressions for the old behavior, but I did not run them on 0d1c7b3 or on 36d615a. Their failure on the old code comes from reading the earlier CI is green: 21 checks, none failing at 36d615a, including Smoke, Integration and Coverage, which exercise the changed route. I did not run check:affected or the complexity gate, and I rely on the CI status for both. The PR has merge conflicts with main, so I could not check how the lifecycle hunks merge. Please rebase onto main and get CI green again on the rebased head before merge, since a rebase could change those hunks. Not blocking, and you can take or leave these: One open inline thread still applies, the Cubic one on the awaitFile deadline. It reads the stubbed |
36d615a to
353fd1b
Compare
|
Rebased #3127 onto The conflicting transport changes came from #3200. The composed implementation retains its per-call cancellation guard, fallback/retry abort checks, connection close, and typed cancellation outcome. Only a genuine transport timeout enters the central awaited retirement path. Health requester loading and response completion still share the probe budget; a caller abort is classified separately from probe expiry. I adopted your shared-predicate suggestion: All 121 focused ownership, startup, cancellation, transport and wire controls passed. The exact-head affected gate passed 6,377 related tests in 788 files, twelve documentation controls and selected runnable tooling checks. The complexity audit initially rejected the merged probe; endpoint resolution and timeout/cancellation classification are now separate small functions, with no threshold or baseline changes. Fresh GitHub CI and review are pending. Nothing was merged. |
|
The PR is ready for human review. At 353fd1b the rebase resolves the earlier conflict, and I found no code problems in the transport, timeout and retirement changes. A caller abort stays a typed cancellation, and only a real transport timeout enters the awaited retirement path. Not blocking, take or leave both: no test covers a caller abort that lands while the remote instance-mismatch health probe is still running (a 409 mismatch, a hanging health server, then an abort, asserting a canceled-request error and zero The earlier Cubic threads are fixed at this head: the startup-race test wait now caps at 200 attempts with a named assert, and CI is green at 353fd1b, with 21 checks and none failing, including the daemon-client unit and integration lanes that exercise this route. There are no conflicts. Nothing is left in code; the next step is your review of the rebased head. |
|
353fd1b now conflicts with main in |
353fd1b to
5b12609
Compare
|
Rebased onto the user-landed session stack at The repair-marker conflict is resolved without dropping either contract. The public reader still requires the scoped owner and expiry, and clearing still checks the owner while permitting removal of owned expired markers. The shared parser additionally validates finite I added the suggested restart-health abort control at its cancellation/timeout owner test: one 409 instance mismatch, one hanging health probe, caller abort, typed cancellation, one RPC, and zero timeout-retirement calls. Removing the post-probe abort check makes it fail with daemon-unavailable instead of cancellation; restoration passes. No private error class or discriminator was added; that suggestion remains non-blocking, and the public error shape is unchanged. All 96 focused controls passed. The exact-head |
|
The conflict from the earlier review (#3127 (comment)) is now fixed, and I found no problems in the rebased code at 5b12609. The rebase keeps both contracts: the tombstone check in src/session-repair-tombstone.ts still rejects a non-finite All 21 checks pass at 5b12609, and there are no conflicts. Nothing else stands in the way, so the PR is ready for a maintainer's review. On the open thread from another reviewer: the cubic-dev-ai P2 thread on the tombstone check is fixed at this head, so you can resolve it: #3127 (comment) |
Summary
Centralize daemon registration, startup ownership and retirement. Replace the bespoke lock with process-lock exclusion; signal only a proven process lifetime and remove metadata/private state after confirmed exit and protected registration checks.
A monitored child can recover a missed birth probe from matching held-lock/registration records. Recovery and client observation share the identity predicate. Includes retained-guard diagnostics and legacy-concurrency policy. Consolidates six original layers across 41 files. Related to #3116.
Rebased onto the landed session stack at
052cba83c1. Repair markers keep scoped owner checks and clearing of owned expired markers, together with strict parser validation and fail-closed cleanup scanning. Per-call cancellation remains separate from awaited timeout retirement.Validation
5b12609ef5:pnpm check:affected --runpassed 6,579 related tests in 803 files, twelve documentation controls and selected tooling. All 96 focused controls pass. The new hanging restart-health probe control rejects a planted missing-abort-check mutation and proves zero timeout-retirement calls. Earlier birth-recovery regression proof remains at its original head. No quality baseline changed.Fresh exact-head GitHub CI and review remain pending. User handles merges.