Skip to content

A balanced non-JSON span before a complete candidate array silently drops the array #638

Backlog

Description

@abogartz

What is broken

firstJsonArray selects the first balanced bracketed span, not the first span that
decodes. When a capture reply opens with balanced-but-not-JSON brackets — a label
(Draft [analysis]. Here are possible memories: …) or a Markdown link ([notes](https://x) …)
— the complete candidate array that follows is never parsed, and zero rows are stored.

This predates #626 (identical selection at 6e33179) and #626 did not change it. What #626
fixed is the label: at c4307fe the pass reported outcome=empty, which told the user
their model had returned nothing when in fact a valid candidate list was thrown away. At
dd967b0 it reports unparsed. The loss is now visible; it is still a loss.

Measured at c4307fe against stored receipt bytes, driving the real pipeline:

response at c4307fe at dd967b0 rows stored, either head
Draft [analysis]. Here are possible memories: [<one valid candidate>] empty unparsed 0

Why it matters past its own test file

The label fix was reviewed on the delta and approved precisely because the label now withholds
a verdict it cannot prove. This ticket is the other half of the same finding, recorded so it is
not lost inside a merged pull's review thread: a plausible reply shape — brackets in prose
before the payload, which models write — silently costs the user the memory, with nothing but a
lag outcome to notice it by.

Scope, and why it needs a pass of its own

Extraction would have to become "the first balanced span that JSON.parses as an array" rather
than "the first balanced span", with the outcome label falling out of whether any span decoded.
That changes what is stored, not merely what is reported, and it opens an
adversarial-prompt surface that the label change did not: a decoy [ in prose ahead of junk
payload becomes worth reasoning about, including how many spans a hostile reply can make the
finder walk. It needs a budget and an architecture decision before a fixer touches it.

Pins to carry over

  • preamble + complete array → the real rows are stored, and the outcome is not unparsed
  • Markdown-link prefix + complete array → the real rows are stored
  • preamble + truncated array → still unparsed
  • fix(capture): tell a truncated response from a genuine empty result #626's five e2e label pins and six unit pins stay green — this must not re-open the
    empty/unparsed decision, which is now pinned by decode verdict

Found while reviewing c4307fe..dd967b0 on #626; the reviewer's verdict is the source of the
shape table above.

Activity

  1. added
    bug
    capture
    severity:medium
    on Dec 1, 2026
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

    bugcaptureseverity:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions