fix: wait for agent idle before sending input to existing task#10
Merged
fix: wait for agent idle before sending input to existing task#10
Conversation
johnstcn
approved these changes
Mar 23, 2026
Member
johnstcn
left a comment
There was a problem hiding this comment.
Changes look fine to me, thanks for catching this!
When an existing task has status 'active', the action previously skipped waitForTaskActive and immediately called sendTaskInput. But the task can be active while the agent is still processing a previous prompt (current_state.state === 'working'). This causes 409/502 errors from the server because the agent isn't ready to accept input. Remove the status guard so waitForTaskActive always runs for existing tasks. The function already handles the active+idle case correctly by returning immediately.
f8f105a to
5d349c5
Compare
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.
When an existing task was already
active, the action skippedwaitForTaskActiveand calledsendTaskInputimmediately. Butactive does not mean idle. If the agent is still processing a
previous prompt (
current_state.state === "working"), the sendfails with a 409/502 from the server.
Now
waitForTaskActiveruns unconditionally for existing tasks.It already handles the active+idle case correctly (returns
immediately), so this adds no delay when the agent is ready.