Repository navigation
fix(agents): the parent's stop cancels a child at once, and JS hosts get AbortSignal-typed contexts - #39
Merged
Conversation
…get AbortSignal-typed contexts The Tish runtime checked the parent's signal only between a child's rounds, so a child in a long model call or tool kept going after the parent turn's Stop (SpawnRequest.signal says it stops the child). A platform signal now also stops the child's control at once — cancelling its request in flight — while a native host keeps the between-round check. createAgentRuntime here takes a JsAgentHost whose callbacks see ctx.signal as the AbortSignal it is.
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.
Found moving PopCraft onto 2.0.0.
SpawnRequest.signalis documented to stop the child. Now a platform signal (anAbortSignal) also stops the child's control at once, which cancels its in-flight request; native hosts keep the between-round check. New test: a child whose model call never returns stops when the parent signal aborts (it stayedrunningbefore).ctx.signalis anAbortSignal(the defaultcreateSignalusesAbortController), butAgentHosttyped it as{ aborted }, so hosts had to cast it to pass it tofetch.createAgentRuntimenow takes aJsAgentHostwhose callbacks receiveJsChildRunContextwithsignal: AbortSignal.101 tests pass; examples type-check; VM, JS and native smoke runs agree.