Repository navigation
Catch failed cleanups in awaitRuntimeOperation and test it - #459
Open
leninworld wants to merge 1 commit into
Open
leninworld wants to merge 1 commit into
leninworld wants to merge 1 commit into
Conversation
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 #299
What changed
awaitRuntimeOperation(backend/src/engines/runtime-operation.ts) calledcleanup()four times without a rejection handler: right away when the signal was already aborted, in the abort listener, and when the operation resolved or rejected after an abort. A cleanup that failed there became an unhandled rejection. All four now end in.catch(() => {}), like the two calls that already had one.backend/src/engines/runtime-operation.test.tscovers the function itself, which no test imported before:signal.reasonand runs cleanup once, then runs it again when the operation settles and drops the late value or error;Testing
bun test ./backend/src/engines/runtime-operation.test.ts(from the repo root): 10 pass, 0 fail.error: cleanup failed(6 pass, 4 fail). Removing the.catchat any one site makes only that site's test fail.bunx -p typescript@5.9.3 tsc --noEmitinbackend(after installing each package's deps, as CI does): no errors, including the new test file.bun test ./backend/test/ratchet.test.tsandbun test scripts/agent-docs.test.ts: pass.Not checked: I did not run the full backend suite (it needs the Postgres test database) or stop a real sandbox turn. The six callers keep the same behaviour apart from the swallowed cleanup error.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.