Skip to content

fix(examples): report v2 turn failures on idle - #279

Merged
benbrandt merged 1 commit into
mainfrom
fix/v2-example-failure-completion
Oct 14, 2026
Merged

benbrandt merged 1 commit into
mainfrom
fix/v2-example-failure-completion

Conversation

@benbrandt

Copy link
Copy Markdown
Member

Summary

Once a v2 prompt has been inserted, its response acknowledges insertion and cannot report later processing failures. The dual-version example previously rethrew non-cancellation errors and only logged them, leaving clients without an idle update.

  • Report non-cancellation failures with an idle state_update carrying stopReason: "error".
  • Preserve RequestError code, message, and data; map ordinary exceptions to internal errors.
  • Keep cancellation reporting as idle/cancelled.
  • Construct the Agent message inside the protected processing path, after echoing the inserted user message.
  • Reserve the outer catch for failures to deliver completion, such as transport failures.

No schema changes or new test files.

Validation

  • npm run check passed (generation consistency, lint, formatting, spellcheck, build, 976 existing tests, and TypeDoc verification).
  • Exercised the compiled example over stdio for success, injected authentication failure, injected ordinary failure, and cancellation. Each produced a successful insertion receipt, matching user-message echo, the expected idle outcome, and accepted a subsequent prompt.
  • git diff --check passed.

@benbrandt
benbrandt enabled auto-merge (squash) October 14, 2026 11:14
@benbrandt
benbrandt merged commit 28b1291 into main Oct 14, 2026
6 checks passed
@benbrandt
benbrandt deleted the fix/v2-example-failure-completion branch October 14, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant