-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Drive resolver elicitation over the 2026-07-28 input_required flow #2986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
555c640
Drive resolver elicitation over the 2026-07-28 input_required flow
Kludex 4cebc58
Remove casts from the input_required resolver path
Kludex 31ccb80
Fix resolver MRTR edge cases from review
Kludex fad97fd
Fix two MRTR state bugs found by Codex review
Kludex b6d6e07
Worker-stable wire keys; restore typed model for unannotated elicitin…
Kludex 49e3b5f
Harden the resolver input_required path; adapt its tests to the clien…
maxisbey 1821703
Run refund_desk on the dual era
maxisbey 85756a7
Reconcile docs with the negotiated elicitation transport
maxisbey ef53c4d
Persist elicited answers as raw wire content; reject ambiguous Elicit…
maxisbey 1a15cb6
Scope the resolver run-once guarantee to questions, not resolver bodies
maxisbey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Earlier sections of this page still state the old per-call guarantee — line 61 ("the SDK runs the resolver at most once per call, no matter how many declare it") and line 73 ("it runs once per call. One inventory lookup, two consumers") — which now contradicts the per-round contract this PR introduces in the new
!!! infobox and the rewritten Recap bullet on the same page. Reword those earlier statements (and the "Don't take once-per-call on faith" / "Once per call means exactly that" tips) to the per-round / asked-once phrasing, or add a forward reference to the info box, so an author doesn't write a non-idempotent resolver relying on once-per-call.Extended reasoning...
What the issue is. docs/tutorial/dependencies.md is now internally inconsistent about the resolver run-once guarantee. This PR added the
!!! infobox (lines ~119-132: "a resolver that answered without asking, likecheck_stock, may run again whenever the call resumes after a question") and rewrote the Recap bullet (line ~138: "at most once per round ... a resolver that never asked may run again when a call resumes"). But the earlier sections of the same page were left with the old contract: line 61 says "every tool that needs stock declares the same parameter, and the SDK runs the resolver at most once per call, no matter how many declare it", line 73 says "it runs once per call. One inventory lookup, two consumers", and the nearby tips reinforce it ("Don't take once-per-call on faith ... one line per call"; "Once per call means exactly that").Why the old wording is no longer universally true. Under the >= 2026-07-28
input_requiredflow, only elicited outcomes are persisted inrequest_state; a resolver that resolves without eliciting is pure and re-runs on every retry round whenever the tool also has an eliciting resolver. The PR's own tests assert exactly this:test_auto_driver_answers_independent_questions_in_a_single_roundcountsrounds == 2via a pure resolver that re-runs each round, andtest_input_required_resolver_asks_and_consumes_then_never_rerunsshows an eliciting resolver running twice (ask + consume). The page's own tutorial003 example (the elicitingconfirm_backorder) is now exercised onmode="auto"by tests/docs_src/test_dependencies.py, so the multi-round behaviour applies to the very examples this page teaches.Step-by-step proof. Take the page's tutorial003 shape extended with the tutorial002 dependency: a tool with
stock: Annotated[Stock, Resolve(check_stock)]andbackorder: Annotated[Backorder, Resolve(confirm_backorder)]where the title is out of stock, on a 2026-07-28 connection. Round 1:check_stockruns (lookup #1),confirm_backorderreturnsElicit(...)with no answer yet, so the server returns anInputRequiredResultand only the (empty) elicited-outcome map goes intorequest_state—check_stock's value is not persisted. Round 2: the client retries with the answer;check_stockruns again (lookup #2),confirm_backorderconsumes its answer, the body runs. One logicaltools/call, two executions of the non-eliciting resolver — directly contradicting "at most once per call" / "one inventory lookup".Why this looks like an oversight rather than intent. The author reworded the analogous sentences elsewhere in this PR — examples/stories/refund_desk/README.md ("ask each question at most once per call"), refund_desk/client.py comments, the resolve.py module docstring, and this page's own Recap bullet — and the follow-up commit 1a15cb6 ("Scope the resolver run-once guarantee to questions, not resolver bodies") shows this exact wording class is considered worth correcting. Lines 61/73/77 and the "Once per call means exactly that" tip were simply missed. The earlier-flagged stale wording in docs/migration.md is a different file and was already addressed; this is a distinct remaining location.
Impact. Documentation-only, no runtime effect, and the statements remain literally true for the tutorial001/002 examples in their immediate context (no eliciting resolver, so the call completes in one round). But line 61 is phrased as a general design claim, and an author reading it could hang side effects or expensive non-idempotent work on a once-per-call assumption that the same page later retracts — exactly the confusion the new info box exists to prevent.
How to fix. Reword line 61 and line 73 (and the two reinforcing tips) to the per-round / asked-once phrasing the rest of the page now uses — e.g. "the SDK runs the resolver at most once per round, however many declare it" and "each question is asked once; a resolver that never asks may re-run when a call resumes" — or add a short forward reference to the
!!! infobox where the full contract is stated.