fix: bind daemon registration writes to the acquired owner - #3125
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 14 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
0c944dd to
aea5196
Compare
|
The daemon side of this PR looks right, but two defects need fixing before merge (reviewed at aea5196). The failing smoke check looks unrelated: the daemon started in 230ms and the run then failed on an iOS runner connect error (wait_runner_restart_exhausted), and 14 of 15 smoke tests passed. No conflicts. First, Second, Would a smaller overall change be to move the lock layout and the client lock readers in one PR? I found nothing smaller on the daemon side, and the net -24 lines is good. But today the daemon and the client disagree on what I did not run tests. I could not read the smoke job's daemon.log or runner.log, so the runner connect classification rests on the log excerpt alone. Before merge, fix the log truncation and make the client lock readers use the directory protocol, or fold the client migration into this PR. |
aea5196 to
30a2f7c
Compare
|
Two problems from the earlier review (aea5196) are still open at 30a2f7c, because the new commit is only a rebase. Smoke Tests fails on the cold launch deep link, which looks unrelated, and I know of no conflicts. The daemon now takes daemon.lock as a process-lock directory (daemon-registration-owner.ts:50), but the client still reads it as a JSON file (daemon-client-metadata.ts:113). The read fails with EISDIR and returns null, so
I did not run tests or reproduce the concurrent-start race. The first finding is read from the code, and the winner takeover step depends on timing. I did not check Windows rename-over-open-file behavior, and I did not check whether the stacked client PR already migrates the lock readers. The Smoke Tests failure is likely unrelated. Daemon startup took 38ms, then the iOS |
134521a to
f55d235
Compare
|
The two cubic-dev-ai threads are fixed at f55d235, but one defect from the earlier review is still open: #3125 (comment) The daemon now takes The review at f55d235 did not run the tests, did not reproduce the race (it is read from the code), and did not check Windows behavior of Resolve these two threads, which are fixed at f55d235: the scope for |
The daemon's stdout and stderr hold append descriptors on daemon.log, so an atomic rename gave the log a new inode and later output went to the unlinked file. Publication now truncates the existing inode. The held-lock provider shutdown test now loses to a real registration instead of a removed helper.
f55d235 to
b5e49b3
Compare
|
The client side of this is in the stack above this PR, not here. #3129 and #3130 move every client reader and writer of The |
…token-attach-c41aff * commit 'd396f3b509d9ed7cddaf170351ea6cf34e02ac16': fix(provider-webdriver): harden BrowserStack app references and endpoints (#3169) fix(android): back off a timed-out snapshot helper session and bound content re-captures (#3160) fix: centralize confirmed daemon retirement (#3126) fix: bind daemon registration writes to the acquired owner (#3125) fix: return confirmed daemon termination outcomes (#3124) refactor(move): share daemon registration and shutdown report modules (#3123) fix: preserve process lock exclusion across publication and reclaim (#3122) fix(cli): refuse a non-URL install-from-source source up front (#3166) fix(daemon): start a lease's TTL when its allocation completes (#3165) fix(android): fail doctor when adb is the Windows binary on a POSIX host (#3157) 0.21.20 0.21.19 # Conflicts: # src/daemon/server/daemon-runtime-metadata-ownership.test.ts
Summary
Daemon startup and shutdown now use one acquisition-bound registration owner. It acquires the shared lock at
daemon.lock, clears the previous shutdown report, publishes metadata, and finishes by writing the report, retiring matching metadata, and releasing its acquisition.publishandfinishassert ownership immediately before mutations. Spent or displaced handles cannot overwrite a successor. Legacy lock files are retained and refused. Dedicated busy/unproven startup codes distinguish contention from startup failure.14 files changed; 995 gross lines. Builds on #3124; part of #3116. Client retirement and startup adaptation follow in this stack. Deploy these coupled changes together; mixed legacy clients remain unsupported.
Validation
Tested
30a2f7c468:AGENT_DEVICE_REQUIRE_LOOPBACK_TESTS=1 pnpm check:affected --base fix/daemon-termination-outcomes --runpassed: 48 related files, 400 tests; all runnable checks completed.