Skip to content

fix(reflect): unwrap JSON answer envelopes#2345

Open
xmh1011 wants to merge 1 commit into
vectorize-io:mainfrom
xmh1011:fix/issue-2298-reflect-json-envelope
Open

fix(reflect): unwrap JSON answer envelopes#2345
xmh1011 wants to merge 1 commit into
vectorize-io:mainfrom
xmh1011:fix/issue-2298-reflect-json-envelope

Conversation

@xmh1011

@xmh1011 xmh1011 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • unwrap reflect responses when a model returns the done-tool JSON envelope as visible answer text
  • keep normal JSON answers intact by requiring reflect envelope keys and tightening trailing id cleanup
  • strengthen the reflect tool prompt against JSON-envelope answers

Closes #2298

Tests

  • uv run --no-sync pytest -q tests/test_reflect_agent.py::TestCleanAnswerText tests/test_reflect_agent.py::TestCleanDoneAnswer tests/test_reflect_prompt_builder.py
  • uv run --no-sync ruff check hindsight_api/engine/reflect/agent.py hindsight_api/engine/reflect/prompts.py tests/test_reflect_agent.py tests/test_reflect_prompt_builder.py
  • uv run --no-sync ruff format --check hindsight_api/engine/reflect/agent.py hindsight_api/engine/reflect/prompts.py tests/test_reflect_agent.py tests/test_reflect_prompt_builder.py
  • pre-commit hooks completed during git commit

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.

reflect: model emits JSON envelope as answer text on 0.8.3

1 participant