Skip to content

fix(ai): brackets in a reply's prose cost it its structured output and every review finding #786

Closed

Description

@dan-petty

Context & Rationale

95ed4cc (#675), the #656 fix, made repair_json_string parse the whole reply before its fenced blocks. It accepts any non-empty list that whole-text parse returns (ai/response_repair.py:73-81).

json-repair turns bracketed prose into list items. Prose that cites [OWASP A03](https://…) or items[0] before the ```json block, or request.args["id"] after it, therefore comes back as a list such as `[["OWASP A03"], {"findings": [...]}]`. `parse_review_response` (`ai/review_schema.py:1339`) can't read that list and returns None. The persona reply then counts as unparsed, and all of its findings are dropped.

The agent loop takes the same path for every structured output (ai/agents/agent.py:899-905). Each reply below holds the same three findings:

Reply 1ad24ac 07a52ef
Prose, then a ```json block 3 findings 3 findings
[OWASP A03](https://…) in the prose, then the block 3 findings None
`items[0]` in the prose, then the block 3 findings None
The block, then `request.args["id"]` 3 findings None

The fallback fence pattern (ai/response_repair.py:48) still closes on any line that starts with ```, which #656 asked to anchor. Tool-call extraction uses a separate path and is unaffected. tests/test_batch_2_review_defects.py covers only bare or bracket-free replies, so nothing caught this.

Scope & Deliverables

Strategic Alignment

  • Milestone: v0.2.24
  • Design: none
  • Depends on: none

Generated by Claude Code

Activity

  1. added this to the v0.2.24 milestone on Oct 1, 2026
  2. added
    type/bug
    scope/ai
    priority/p0-critical
    on Oct 1, 2026
  3. added a commit that references this issue on Oct 1, 2026
    5768cd9
  4. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Closed by #802, merged into release/v0.2.24.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  5. added a commit that references this issue on Oct 1, 2026
    e6ce3db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p0-criticalscope/aitype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions