Skip to content

fix(subagents): send the schema on @cf/ structured coercion, give it room, say 'timed out' - #159

Merged
jonnyparris merged 1 commit into
mainfrom
fix/coercion-timeout-glm
Nov 4, 2026
Merged

jonnyparris merged 1 commit into
mainfrom
fix/coercion-timeout-glm

Conversation

@jonnyparris

Copy link
Copy Markdown
Owner

Fixes Coercion error: Request aborted on the in-process task tool with resultSchemaName on @cf/zai-org/glm-5.3-flash (found in the #158 live check; pre-existing).

Root cause (measured on jp-gw /compat)

  • @ai-sdk/openai-compatible without supportsStructuredOutputs sends response_format: {type:"json_object"} and drops the schema. GLM never saw it, invented its own fields (files_modified, tests_passed…), failed validation, and the retry ran past the 30s coercion budget. Then runWithLocalSignal relabelled the TimeoutError as "Request aborted".
  • One GLM-5.3 Flash pass takes 10-25s (500-900 reasoning tokens), so two attempts never fit in 30s.

Change

  • /compat provider: supportsStructuredOutputs for @cf/ models → json_schema strict (what createAI's run path already sends). Only response_format reads the flag; tool turns unchanged.
  • Coercion budget: 120s for @cf/, 30s for hosted (coercionTimeoutMs).
  • generateStructured: on a fired signal, no retry; lastError is timed out after Ns / timed out / aborted. A caller signal no longer drops timeoutMs (AbortSignal.any).

Evidence (real AI SDK + generateStructured + TaskSummary, before → after)

model json_object (old) json_schema (new)
glm-5.3-flash, 30s 2/2 timeout after 2 attempts 2/2 ok, 1 attempt, 20-25s
deepseek-v4.1-flash ok, 2 attempts, 19.6s ok, 1 attempt, 11.9s
kimi-k2.6, 120s timeout ok, 1 attempt, 64s
gemma-4-26b, 120s timeout ok, 1 attempt, 81s
llama-4-scout fail (schema) ok, 2 attempts
qwen2.5-coder fail (parse) fail (parse)

Tests: new cases in structured-output-generate, compat-binding-unit, subagent-model-unit; typecheck clean; full suite passes (7 facet/DO tests hit the 60s timeout under load ~85 and pass on rerun alone).

beep-boop-🤖

…room, say 'timed out'

The in-process task tool with resultSchemaName on @cf/zai-org/glm-5.3-flash
failed with 'Coercion error: Request aborted'. Measured on jp-gw:

- @ai-sdk/openai-compatible without supportsStructuredOutputs sends a bare
  json_object and drops the schema. GLM never saw it, invented its own
  fields, failed validation, and the retry ran past the 30s budget.
  Now @cf/ models on /compat get json_schema (what createAI's run path
  already sends). GLM passes on the first attempt; deepseek, kimi, gemma
  and llama-4 also pass, two of which timed out before.
- One GLM pass takes 10-25s (reasoning), kimi 64s, gemma 81s. The
  coercion budget is 120s for @cf/, 30s for hosted models.
- runWithLocalSignal relabels a timeout as 'Request aborted'.
  generateStructured now reads the signal: 'timed out after Ns' or
  'aborted', and doesn't retry on a dead signal. A caller signal no
  longer drops timeoutMs (AbortSignal.any).
@jonnyparris jonnyparris added the preview-lock Holds dodo-preview: other PRs' pushes skip the preview deploy until removed label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Preview deployed: https://dodo-preview.jonnyparris.club

Serves eaf26c9 from this PR. Access-gated (same policies as prod). Load it in a Browser Run session with the Dodo service token to verify UI changes.

The preview is shared: the next PR push replaces this build, and this PR gets a new comment when that happens. Add the preview-lock label to hold it during a live check, and remove the label when you are done.

Replaced 89cee41 from #153.

@jonnyparris

Copy link
Copy Markdown
Owner Author

beep-boop-🤖 Live check on preview (eaf26c9): 4 sessions, task tool with resultSchemaName: task-summary on @cf/zai-org/glm-5.3-flash — every run returned ### Structured result with a valid TaskSummary, no Coercion error. Before (main 77de46e / #158 build): 2/2 and 2/3 failed with Coercion error: Request aborted. Test sessions deleted.

@jonnyparris jonnyparris removed the preview-lock Holds dodo-preview: other PRs' pushes skip the preview deploy until removed label Nov 4, 2026
@jonnyparris
jonnyparris marked this pull request as ready for review November 4, 2026 18:37
@jonnyparris
jonnyparris merged commit afa7b82 into main Nov 4, 2026
3 of 4 checks passed
@jonnyparris
jonnyparris deleted the fix/coercion-timeout-glm branch November 4, 2026 18:40

This branch was successfully deployed

1 active deployment
dodo-preview — eaf26c94 Deployed Nov 5, 2026 by github-actions[bot]
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