You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Client tool continuation stays pending for 60 seconds after completion #2055
Describe the bug
After submitting a client tool result with autoContinue: true, the continuation completes and the assistant response appears, but useAgentChat remains in the submitted state for about 60 seconds.
The server sends cf_agent_stream_pending but never sends cf_agent_stream_resuming. The client therefore ignores the matching done: true response until its pending timeout expires.
To Reproduce
Create a client tool without a server-side execute function.
Call the tool from a Think agent.
Submit its result using addToolOutput.
Wait for the continuation response.
Observe that the response appears, but useAgentChat remains submitted for about 60 seconds.
This reproduces for both completed and dismissed tool interactions.
Expected behavior
The server should send cf_agent_stream_resuming when the continuation starts. useAgentChat should return to ready when the continuation finishes.
Screenshots
A recording or WebSocket trace can be provided.
Version:
agents@0.19.0
@cloudflare/think@0.15.0
ai@7.0.48
@ai-sdk/react@4.0.51
Additional context
The same WebSocket stays open throughout the request.
Hey @urjitc! Thanks for the report. I've done a quick investigation and confirmed that this reported frame sequence would cause useAgentChat to remain submitted until the 60-second pending timeout:
cf_agent_stream_pending
done: true
# no cf_agent_stream_resuming
The client currently does not retain the request ID from cf_agent_stream_pending, so it cannot use a matching terminal response to settle the continuation unless cf_agent_stream_resuming arrives first.
However, I've not been able to reproduce the missing cf_agent_stream_resuming with stock @cloudflare/think. The relevant code in the reported versions is intended to emit:
and our integration tests produce that sequence with matching request IDs.
Could you share either a minimal reproduction or a complete WebSocket trace from immediately before addToolOutput through completion? The frame type, id, probeId, done, and timestamps are sufficient; message bodies can be redacted. It would also help to include:
Exact imports used for useAgentChat
Output from pnpm why agents @cloudflare/think (or equivalent)
Any custom lifecycle hooks or chat transport behavior
There is a defensive client fix we could look at doing, but I'd also like to identify why the server notification was missing in your case.
The reproduction uses the same Think implementation in two configurations:
Direct Think: pending → resuming → done
The same Think reached through a parent Agent as a sub-agent: pending → done
The direct path returns useAgentChat to ready. The sub-agent path displays the completed assistant response but remains submitted until the pending timeout.
The browser reproduction uses the real useAgentChat and addToolOutput flow. The only model customization is an overridden getModel() that returns a deterministic AI SDK model. It always requests the client tool and then returns Continuation completed.
Exact imports:
There are no custom lifecycle hooks, chat transports, or package patches. The parent agent is:
exportclassParentAgentextendsAgent<Env>{}
Dependency output:
@cloudflare/think@0.15.0
└── cloudflare-agents-2055-repro@0.0.0 (dependencies)
agents@0.19.0
├─┬ @cloudflare/think@0.15.0
│ └── cloudflare-agents-2055-repro@0.0.0 (dependencies)
└── cloudflare-agents-2055-repro@0.0.0 (dependencies)
Found 1 version of @cloudflare/think
Found 1 version of agents
To run the protocol reproduction:
pnpm install
pnpm reproduce
It prints the relevant type, id, probeId, done, and continuation fields for both paths. The pending and terminal response IDs match in the failing sub-agent case, but cf_agent_stream_resuming is missing.
For context I ran into this issue when trying to add a AskUserQuestion tool in https://github.com/ThinkEx-OSS/thinkex where an agent can ask questions and the user gets nice ui to do so and sends the results back
Hi, we upgraded to agents@0.22.0 and @cloudflare/think@0.17.0, but this issue still reproduces for client-side tool continuations through a sub-agent.
After the user completes or dismisses a client-side tool interaction, we observe:
The assistant’s response appears within a few seconds, but useAgentChat remains in the submitted state for approximately 60 seconds.
This reproduces with autoContinueAfterToolResult: true for both completed and dismissed interactions. Setting it to false avoids the problem.
It appears that PR #2090 does not cover every sub-agent continuation path maybe?
Update: we can no longer reproduce the 60-second pending state with autoContinueAfterToolResult: true. We retested both submitted and skipped client-side questionnaires through our sub-agent setup. Both now return to ready normally.
Current versions: agents@0.22.0, @cloudflare/think@0.17.0, ai@7.0.98, and @ai-sdk/react@4.0.101.
Our app has since migrated from AI SDK 6 to 7, while the Cloudflare package versions stayed unchanged. That may explain the improvement, but we haven’t isolated the SDK upgrade as the cause.
Activity
ben-reitz commentedon Aug 10, 2026
Hey @urjitc! Thanks for the report. I've done a quick investigation and confirmed that this reported frame sequence would cause
useAgentChatto remainsubmitteduntil the 60-second pending timeout:The client currently does not retain the request ID from
cf_agent_stream_pending, so it cannot use a matching terminal response to settle the continuation unlesscf_agent_stream_resumingarrives first.However, I've not been able to reproduce the missing
cf_agent_stream_resumingwith stock@cloudflare/think. The relevant code in the reported versions is intended to emit:and our integration tests produce that sequence with matching request IDs.
Could you share either a minimal reproduction or a complete WebSocket trace from immediately before
addToolOutputthrough completion? The frametype,id,probeId,done, and timestamps are sufficient; message bodies can be redacted. It would also help to include:useAgentChatpnpm why agents @cloudflare/think(or equivalent)There is a defensive client fix we could look at doing, but I'd also like to identify why the server notification was missing in your case.
urjitc commentedon Aug 10, 2026
@ben-reitz Thanks Ben, I isolated this to the sub agents and made a repro:
https://github.com/urjitc/cloudflare-agents-2055-repro
https://cloudflare-agents-2055-repro.chakrabortyurjit.workers.dev/?mode=sub-agent
The reproduction uses the same
Thinkimplementation in two configurations:Think:pending → resuming → doneThinkreached through a parentAgentas a sub-agent:pending → doneThe direct path returns
useAgentChattoready. The sub-agent path displays the completed assistant response but remainssubmitteduntil the pending timeout.The browser reproduction uses the real
useAgentChatandaddToolOutputflow. The only model customization is an overriddengetModel()that returns a deterministic AI SDK model. It always requests the client tool and then returnsContinuation completed.Exact imports:
There are no custom lifecycle hooks, chat transports, or package patches. The parent agent is:
Dependency output:
To run the protocol reproduction:
It prints the relevant
type,id,probeId,done, andcontinuationfields for both paths. The pending and terminal response IDs match in the failing sub-agent case, butcf_agent_stream_resumingis missing.urjitc commentedon Aug 10, 2026
For context I ran into this issue when trying to add a AskUserQuestion tool in https://github.com/ThinkEx-OSS/thinkex where an agent can ask questions and the user gets nice ui to do so and sends the results back
ben-reitz commentedon Aug 26, 2026
This fix will go out in the next release
O4epegb commentedon Sep 1, 2026
Hi, we upgraded to agents@0.22.0 and @cloudflare/think@0.17.0, but this issue still reproduces for client-side tool continuations through a sub-agent.
After the user completes or dismisses a client-side tool interaction, we observe:
The assistant’s response appears within a few seconds, but
useAgentChatremains in the submitted state for approximately 60 seconds.This reproduces with
autoContinueAfterToolResult: truefor both completed and dismissed interactions. Setting it to false avoids the problem.It appears that PR #2090 does not cover every sub-agent continuation path maybe?
O4epegb commentedon Sep 14, 2026
Update: we can no longer reproduce the 60-second pending state with
autoContinueAfterToolResult: true. We retested both submitted and skipped client-side questionnaires through our sub-agent setup. Both now return to ready normally.Current versions:
agents@0.22.0,@cloudflare/think@0.17.0,ai@7.0.98, and@ai-sdk/react@4.0.101.Our app has since migrated from AI SDK 6 to 7, while the Cloudflare package versions stayed unchanged. That may explain the improvement, but we haven’t isolated the SDK upgrade as the cause.