Skip to content

fix(research): retry bounded structured output - #168

Merged
iamjr15 merged 1 commit into
mainfrom
fix/research-structured-retry
Aug 5, 2026
Merged

fix(research): retry bounded structured output#168
iamjr15 merged 1 commit into
mainfrom
fix/research-structured-retry

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Why

Production QA after the timeout fix showed that per-query structured output could still exceed its 2,048-token budget. The provider returned truncated JSON with missing sources and summary fields, so one malformed branch aborted the research workflow.

What changed

  • Constrain each research pass to 3-4 short claims, two sources per claim, and a short summary.
  • Encode those bounds in the structured schemas as well as the model prompt.
  • Keep the final canonical Markdown report concise enough for its bounded synthesis response.
  • Move pass and final validation inside the in-memory retry boundary.
  • Treat Mastra structured-output validation and repository invalid-output errors as retryable once.

Architecture and data

No schema migration, environment, vendor, or deployment-topology changes. BYOK credentials remain request-scoped and no secret-bearing workflow state is persisted.

Verification

  • pnpm lint
  • pnpm typecheck
  • pnpm turbo build --force
  • pnpm deadcode
  • pnpm architecture:check
  • pnpm turbo skills:build
  • Production Worker trace captured the truncated structured payload and exact missing fields before this fix.

The repository pins Node 24.18.0; local verification ran on Node 26.4.0 and emitted only the existing engine warning.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cheatcode Skipped Skipped Aug 5, 2026 6:03am

@iamjr15
iamjr15 merged commit 08945fc into main Aug 5, 2026
6 checks passed
@iamjr15
iamjr15 deleted the fix/research-structured-retry branch August 5, 2026 06: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.

1 participant