Skip to content

fix(agent): bound generate_scene retries per page - #1319

Open
hichipli wants to merge 1 commit into
THU-MAIC:mainfrom
hichipli:fix/generate-scene-retry-budget
Open

fix(agent): bound generate_scene retries per page#1319
hichipli wants to merge 1 commit into
THU-MAIC:mainfrom
hichipli:fix/generate-scene-retry-budget

Conversation

@hichipli

@hichipli hichipli commented Aug 31, 2026

Copy link
Copy Markdown

Summary

Bound repeated generate_scene failures for the same page within one server-workbench run. The initial generation and one retry may execute; further consecutive calls for the same stageId + order are rejected before reaching the generation provider.

Related Issues

Fixes #1308.

Changes

  • add a request-scoped retry budget keyed by the semantic page target (stageId + order)
  • preserve the original failure content/details while adding structured retry state and clear recovery guidance
  • block calls after the second consecutive failure, before another generation request can run
  • reset the budget after a successful generation or when generation moves to another page
  • keep unrelated tool calls outside the budget and keep the shared tool allowlist authoritative
  • add focused policy, Agent-hook, and runner-wiring regression coverage

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Verification

Steps to reproduce / test

  1. Run the focused retry-policy, Agent-hook, and runner-wiring tests.
  2. Run the complete agent-runtime test directories under Node 22.
  3. Run the complete repository test suite under Node 22.
  4. Run formatting, lint, and TypeScript checks.

What you personally verified

  • the first failed page generation leaves exactly one real retry available
  • a second consecutive failure returns exhausted-state guidance and a third call is blocked before tool execution
  • a successful generation resets the budget
  • moving to a different page target resets the budget
  • unrelated tools neither consume nor reset the active page budget
  • existing error details are preserved when retry metadata is added
  • the shared allowlist still runs before the new request-scoped pre-call hook
  • Node 22 full suite: 652 test files passed, 9 skipped; 7,170 tests passed, 81 skipped
  • Node 22 agent-runtime suites: 85 test files passed, 4 skipped; 1,044 tests passed, 11 skipped
  • local lint completed with 0 errors; 18 unrelated baseline warnings remain

Evidence

  • Before: every new tool-call ID for the same failing page could reach generation again.
  • After: only the initial attempt and one retry can execute consecutively for a page; later same-target calls return a deterministic blocked result while later page targets remain available.
  • CI passes (pnpm check && pnpm lint && npx tsc --noEmit)
  • Manually verified locally with focused and complete automated suites
  • Screenshots / recordings attached (no UI changes)

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have added/updated documentation as needed
  • My changes do not introduce new warnings
Track consecutive failures for the active stageId and order within one runner run. Allow the initial attempt plus one retry, then block further calls for that target before they reach the generation provider.

Reset the budget after a successful generation or a move to another page, preserve existing failure details, and leave unrelated tools unaffected. Add policy, Agent-hook, and runner-wiring regression coverage.
@hichipli
hichipli marked this pull request as ready for review August 31, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant