Repository navigation
fix(setup): use a heartbeat lease for the config lock - #863
Merged
Merged
Conversation
Replace PID and process-start-time liveness with a worker-thread mtime refresh. A lock is stale five seconds after its last refresh, including locks written by the previous version, and a live holder is not stolen while that lease is renewed. Refs #862 Co-authored-by: tt-a1i <tt-a1i@users.noreply.github.com>
Windows CI can stall long enough that Testing Library's wait timer and the deferred file or review read expire in the same timer batch. The timeout then rejects before React commits, so the README button is reported missing and the review restore case burns the 5s test budget. Poll on a check-phase flush inside the existing 1s budget. Co-authored-by: tt-a1i <tt-a1i@users.noreply.github.com>
route.fetch() bodies live on the per-test request context. Closing that context drops them, so a refresh still between fetch() and json() fails a finished test with "Response has been disposed". Co-authored-by: tt-a1i <tt-a1i@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Setup config lock recovery decides liveness from a PID plus that process's start time. The start-time query is per platform: POSIX
ps, and on Windows the WMI/cscriptpath from #857. A UTF-16 misparse or a slow query either blocks recovery until the deadline or refuses to recover a dead holder. Refs #862, #829, #857.CI on
3915277also failed the required Windows UI job intests/web/workbar-session-position.spec.ts. The README button was missing, and the review-restore case hit Vitest's 5s test budget.Node 22.19.0andBackground terminals (Windows)failed only because that UI result failed;Node 24andNode 26were then cancelled. The same README miss is the Windows UI flake noted on #861 (run 38764433340, attempt 3).CI on
2f6bd28then failed Web E2E shard 1/2 intests/web/openpi-web.e2e.ts("trajectory inspects bounded prompt and tool evidence on desktop and mobile") withapiResponse.json: Response has been disposed. The page snapshot and screenshots show the trajectory fixture had already rendered and the test had switched back to 对话.Web E2E (Node 22.19.0)and the Node 22/24/26 gates failed because that shard failed. This is the same disposed-response flake #861 recorded on run 38774705615.Value
A heartbeat lease is the same on every platform and can be tested by moving the lock file's timestamp. A live holder is not stolen, a stale lock is recovered, and a crashed holder becomes recoverable once it stops refreshing. The process-start query, including
extensions/shared/win32-process-started-at.js, is gone.The workbar tests still fail when the file list or review snapshot never arrives, and they no longer treat a stalled timer batch as a missing README.
A snapshot route that throws while reading a disposed upstream body no longer fails a test whose assertions already passed. A handler that fails for any other reason still fails the test.
Approach
futimeson the descriptor it opened. A blocked main thread still renews the lease, and a file created later at the same path is not refreshed.pid,createdAt,token). PID is diagnostic identity only. Version 1 files, including an in-progress recovery name, stay protected until their existing timestamp is stale, then use the same companion-link recovery. Unreadable bytes and unknown versions are never taken.findByRole/waitForarm their deadline on that same timer phase, so after a Windows stall the timeout callback rejects before the commit. Those waits now take one check-phase turn and flushactbefore judging. The budget stays 1s. A listing that never resolves still fails withUnable to find ... README.md(probe: 1923ms).route.fetch()stores the upstream body on the per-test request context. Playwright's page fixture closes that context with reason "Test ended" and clears the body. A refresh still betweenfetch()andjson()then throwsResponse has been disposed, which is what failed the trajectory test after the UI was already correct.test.afterEachnow waits for in-flight route handlers before that close, the same drain several tests in the file already did by hand. Timeouts are unchanged. Tests that already closed the fixture page skip the drain.Validation
bun run checknode --test --experimental-strip-types --test-concurrency=1 tests/extensions/shared/setup-config.test.ts(46 passed)vitest run tests/web/workbar-session-position.spec.ts(12 passed)workspaceFilesmock still fails the Files tooltip test at the README button inside the 1s budget.bun run typecheckafter the route drain. Playwright browsers are not installed in this environment, so the e2e file was not re-executed locally. The failure artifact for run 38872519896 shows the trajectory UI and both viewport screenshots already written, and Playwright'scontext.closeclearsfetchResponsesbeforeresponse.json().Impact