Skip to content

fix(reflect): cap structured output retry budget#2433

Open
koriyoshi2041 wants to merge 1 commit into
vectorize-io:mainfrom
koriyoshi2041:rios/cap-reflect-structured-retries
Open

fix(reflect): cap structured output retry budget#2433
koriyoshi2041 wants to merge 1 commit into
vectorize-io:mainfrom
koriyoshi2041:rios/cap-reflect-structured-retries

Conversation

@koriyoshi2041

Copy link
Copy Markdown
Contributor

Summary

  • cap the second-pass reflect_structured extraction retry budget so provider-specific empty structured-output responses do not consume the full reflect timeout
  • keep the existing graceful degradation behavior: the natural-language reflect answer still returns when structured extraction fails
  • add a focused regression test for the short retry budget

Context

This is motivated by #2431, where plain reflect can succeed while response_schema triggers repeated empty provider responses with finish_reason=length.

Tests

  • uv run pytest tests/test_reflect_agent.py::TestReflectStructuredOutput::test_structured_output_uses_short_retry_budget -q
  • uv run ruff check hindsight_api/engine/reflect/agent.py tests/test_reflect_agent.py
  • uv run ruff format --check hindsight_api/engine/reflect/agent.py tests/test_reflect_agent.py
  • git diff --check

Note: full uv run pytest tests/test_reflect_agent.py -q reached 50 passing tests, then hit local environment setup errors unrelated to this patch: missing HINDSIGHT_API_LLM_API_KEY for real-LLM tests and a local SOCKS proxy requiring socksio during Hugging Face model initialization.

@koriyoshi2041 koriyoshi2041 force-pushed the rios/cap-reflect-structured-retries branch from ccef070 to 689633f Compare June 27, 2026 07:23
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