Repository navigation
Engine client and runtime download: a stalled loop no longer launches over a running engine, and a failed download keeps its typed error (#441) - #450
Merged
Conversation
…look absent and launched over (refs #441) After a stall the loop runs its due timers before the I/O that completed meanwhile, so the first window's timer beat a connect the engine had already accepted, and the client launched a running engine (services-engine-service's afterActionRepairs and no-launch cases on a loaded hosted runner). The window's rejection now waits one turn, after that I/O. A test forces the stall. Sminos-Session: cursor235#b93055dd (cua on macbook)
…lds to done I/O, as the service's client (refs #444) The spike's ping was bounded by what was left of its 150 ms test window, so a slow round trip on a loaded runner launched over the running fake and pinged it again (spike-engine-client :68 and :80). Ports src/services/engine/client.mjs's full ping wait and the stall fix, with both forced in tests. Sminos-Session: cursor235#b93055dd (cua on macbook)
…exit (refs #444) 'exit' may come before the child's stderr pipe is read to its end, which left the engine.lock assertion reading ''. Sminos-Session: cursor235#b93055dd (cua on macbook)
…so staging removal never meets a late file (refs #441) A body overrunning the pin failed the pipeline before the write stream had opened its file; the file then appeared in the staging directory the caller was removing, and ENOTEMPTY replaced archive_length_mismatch. The failure now waits for the file's close. A test holds the thread pool busy to force the late open. Sminos-Session: cursor235#b93055dd (cua on macbook)
#441) Sminos-Session: cursor235#b93055dd (cua on macbook)
…close-wait test holds the open itself (refs #441) A body that cannot be read (a locked one from an injected fetch) threw before the pipeline listened to the already-opening file, so an unopenable destination raised an uncaught error where download_failed was returned before; the body is now wrapped first, both setup steps inside the typed boundary, and the close is waited for only when a file was made. The close-wait test now delays the file's open through the stream's fs option and asserts it was opened and closed before the typed failure returned: it fails with the close wait removed, as the locked- body test fails on the previous ordering. Sminos-Session: cursor235#b93055dd (cua on macbook)
Sminos-Session: cursor235#b93055dd (cua on macbook)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Owner
Author
|
This also covers the services-engine-service 'the engine is running; nothing launches it' failure that #444 recorded on #171's head 9371d23 (run 44784520843). The message and the path ( Sminos-Session: cursor235#b93055dd (cua on macbook) |
Sminos-Session: cursor235#b93055dd (cua on macbook)
SSFSKIM
enabled auto-merge (squash)
November 20, 2026 18:20
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.
Closes #441. Refs #444. Version 0.28.22: two of the races were in shipped code.
Product fixes
A running engine judged absent and launched over (
src/services/engine/client.mjs, #441'sservices-engine-service.test.mjs:454, and:828once)openApplicationover a running engine. The engine thatopenstarted lost the lock and exited, and the connect still succeeded.within()'s timeout waits one more turn (setImmediate) before rejecting, so I/O that has already finished wins.services-engine-client.test.mjsblocks the thread for 300 ms just after the window is armed. Without the fix it fails1 !== 0launches.Connection.call's per-request timer has the same ordering for stalls over 1 s. It wasn't seen in any log.Download reported ENOTEMPTY in place of its typed error (
src/runtime/install.mjs, #441'sruntime-install.test.mjs:263, 3 sightings)download(): the runtime install, the sandbox helper and the Linux engine.download()destroys the file stream and returns once it has closed. The body is wrapped before the file opens, and both steps sit inside the typed error boundary. That way, a body that can't be read, written to a destination that can't be opened, still answersdownload_failed(review finding).fsoverride and asserts the file was opened and closed before the rejection. It fails if the close wait is removed.Test and spike fixes
spike-engine-client.test.mjs:68and:80(an extra ping, 5 sightings): the spike client capped the ping's wait at what was left of the test's 150 ms window. The product client had already fixed this by giving the ping its full second. The spike client (scripts/spike, not shipped) now matches it, and also takes thewithin()change. Two new tests (an open that lands late, and a 300 ms stall) fail on the old spike client.native-engine.test.mjs:321(the losing engine's stderr came back empty, 2 sightings): the test now waits forclose, which follows the end of stdio, instead ofexit. There's no deterministic repro: it needs the real engine, so it runs only on hosted.Checks
spike-engine-client,services-engine-client,services-engine-serviceandruntime-install, 48/48 each;runtime-install30/30 after the fix wave.native-engine.test.mjsand the cases that start the real engine. This PR'stestgate covers them.Sminos-Session: cursor235#b93055dd (cua on macbook)