[JS/TS/Python] Fix Async.StartChild with timeout always timing out#4482
Merged
MangelMaxime merged 1 commit intomainfrom Apr 6, 2026
Merged
Conversation
93 tasks
e4ad51e to
125868d
Compare
…ixes #4481) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
125868d to
2768b69
Compare
Contributor
Author
Python Type Checking Results (Pyright)
Excluded files with errors (4 files)These files have known type errors and are excluded from CI. Remove from
|
Async.StartChild with timeout always timing out
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.
🤖 This pull request was created by Repo Assist, an automated AI assistant.
Closes #4481
Summary
Root cause:
startChildusedPromise.all(join) to race the computation against athrowAftertimer. SincethrowAfteronly ever rejects (after the timeout elapses) and never resolves,Promise.allcould never resolve — it always waited for both branches, then rejected withTimeoutExceptionregardless of how fast the computation finished.Fix: Use race semantics instead. The computation is started as a Promise immediately, then a new racing Promise wraps both the computation and a plain
setTimeoutreject. Whichever settles first wins — computation success/failure propagates through; timeout firesTimeoutExceptiononly if the computation hasn't settled yet.Cleanup: Remove the now-unused
throwAfterandparallel2helper functions.Test: Added a regression test
"Async.StartChild with timeout completes when computation finishes before timeout"that verifies a 10 ms computation succeeds under a 1000 ms timeout.Changes
src/fable-library-ts/Async.ts— fixstartChild, remove dead helperstests/Js/Main/AsyncTests.fs— add regression test (see [Investigate]Async.StartChildwith timeout always times out in JavaScript #4481)src/Fable.Cli/CHANGELOG.mdandsrc/Fable.Compiler/CHANGELOG.md— update## UnreleasedTrade-offs
The new implementation uses a plain
setTimeoutfor the timeout (no cancel-listener integration). The previousthrowAfterhad cancel-listener support, but sincestartChildalready starts the computation in a hot Promise (cancellation of the outer token does not cancel the child promise anyway), this is not a regression. The semantics match .NET'sAsync.StartChild: once started, the child runs to completion unless it times out.Note
🔒 Integrity filtering filtered 101 items
Integrity filtering activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.
search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)