Skip to content

fix(pi-coding-agent): validate subprovider model and detect SDK errors#879

Merged
christso merged 2 commits intomainfrom
fix/878-pi-subprovider-error
Mar 31, 2026
Merged

fix(pi-coding-agent): validate subprovider model and detect SDK errors#879
christso merged 2 commits intomainfrom
fix/878-pi-subprovider-error

Conversation

@christso
Copy link
Copy Markdown
Collaborator

@christso christso commented Mar 31, 2026

Summary

  • Validate getModel() result: When getModel(subprovider, model) returns undefined (model not in pi-ai registry for that provider), throw a clear error instead of passing undefined to createAgentSession which silently falls back to azure-openai-responses
  • Detect SDK stopReason: "error": After session.prompt(), check if the last assistant message has stopReason === "error" and propagate the errorMessage as an execution error instead of silently returning empty/echoed content

Closes #878

Test plan

  • Build passes
  • Typecheck passes
  • Lint passes (biome)
  • All 1731 unit tests pass
  • Run multi-provider-skill-trigger.EVAL.yaml --target pi with subprovider: openrouter to verify correct routing — all requests routed through openrouter with openai/gpt-5.4, score 1.000 PASS
  • Verify SDK errors now surface as execution errors in eval results — invalid model produces clear provider_error execution error instead of silent quality failure

🤖 Generated with Claude Code

christso and others added 2 commits March 31, 2026 08:45
getModel() returns undefined when a model isn't registered for a provider,
causing the SDK to silently fall back to azure-openai-responses. Now throws
a clear error when the model lookup fails.

Also detects stopReason "error" on the last assistant message after
session.prompt(), propagating SDK errors instead of silently returning
empty/echoed content as a quality failure.

Closes #878

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: d6e4a0f
Status: ✅  Deploy successful!
Preview URL: https://2edd261d.agentv.pages.dev
Branch Preview URL: https://fix-878-pi-subprovider-error.agentv.pages.dev

View logs

@christso christso merged commit 0ecd5bf into main Mar 31, 2026
4 checks passed
@christso christso deleted the fix/878-pi-subprovider-error branch March 31, 2026 11:05
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.

bug(pi-coding-agent): SDK ignores subprovider config and silently swallows errors

1 participant