Repository navigation
Ask agents' questions in the agent's client, also through app calls - #536
Merged
Merged
Conversation
A question reaches the person where they started the work. When an agent calls an app through Widefleet MCP and that app calls an API that asks, the question now appears in the agent's client, through its own dialog or the form, instead of on the app's pages; the app waits and continues with the answer without running again. Each MCP `call` and `execute` runs apart from its request: a runner object keeps the run going, and a questions object takes the run's questions and the answers from the client's retry or the form. The caller proof carries the run through app hops, so the binding gateway sends questions to it. A program is suspended while a question waits, so the person's time does not count toward its time limit. Question tokens answer only on their own channel; the sealed input state and its contracts are removed.
…ess on answers A program now pauses while any question of its run waits, also one from an app it called, so the person's time never counts toward its time limit. A run that ends cancels its waiting questions instead of showing them. An answered call checks the person's access to the app again before it runs. Runs reuse the claims their request verified, so a company token is exchanged once.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | e0263c8 | Dec 01 2026, 03:26 PM |
Workers RPC result types recurse without end for recursive types such as a JSON value (cloudflare/workerd#3063). A patch passes JSON-like results by value without recursing through the serializability check and pipelining types; other results keep their existing types. The run's question object and runner now exchange typed events instead of JSON text.
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.
A question now reaches the person where they started the work. Since #534, questions from app calls appear on the calling app's open pages. That is right when a person clicks in the app, but an agent that calls an app through Widefleet MCP had no page: the question was cancelled, and the agent received the API's declined result. Now, when an agent calls an app and that app calls an API that asks — for example a CRM that sends mail through the Gmail template — the question appears in the agent's client. The app waits, then continues with the answer without running again, and its code still never handles questions.
How it works
callandexecuteruns apart from the request that started it.McpRunner(a Durable Object per run) starts the run through aMcpRunentrypoint and keeps it going.McpQuestions(a Durable Object per run) takes the run's questions and the answers. The two are separate objects because a run that calls back into the object that started it waits for itself on celld.input_required, or theask/answerform for clients without their own dialog. The answer, from the client's retry or the form, settles the waiting question, and the response carries the run's next question or its result. Each question token is bound to the person and answers only on its own channel: the client's retry, the agent's request to show the form, or the form itself.executesuspends the program while any question of its run waits, also one from an app the program called, using CodeMode's snapshots and durable tool calls. The person's time does not count toward the 30-second limit, and the program resumes with the answer. A run that ends cancels its waiting questions.requestStatehandling (sealInput,openInput,rebindInput) and its contracts.askandanswertake only the question token.@cloudflare/workers-typespasses JSON-like RPC results by value without recursing through the serializability check and pipelining types, which never ends for recursive types such as a JSON value ("Type instantiation is excessively deep and possibly infinite", unidentified DO types, attempting to get a clean type from DO RPC Call cloudflare/workerd#3063). Other results keep their types. The run objects exchange typed events.WIDEFLEET_MCP_RUNNERSandWIDEFLEET_MCP_QUESTIONS(wrangler migrationv7, and the self-hosted runtime configuration).Tests
app-services-runtime.test.tson workerd and celld: native dialog questions and form questions, including management; an answer from another person, a second answer, a relayed token on the form and a program token on a call are refused; an agent calls an app that calls a provider that asks, throughcalland throughexecute, and the app's effect before the question runs once; an app's question answered after 31 seconds still completes the program; a program that ends while a question waits does not show it; an answer after the person lost access is refused.cargo test -p platform-agent runtime,pnpm check(except the HubSpot lint error onmain).Not covered by tests: a run interrupted by a Durable Object restart, and the real Cloudflare edge. A client that disconnects no longer stops a running program on self-hosted celld; on Cloudflare it never did, because the runtime's compatibility date predates
request.signal. A spike verified that a runner keeps an app waiting for 70 seconds after the first request ended, on workerd and celld.