Skip to content

Session Summaries store stray XML tags in their fields #472

Open

Description

@possiblyneal

Problem

60 of 1,801 Session Summaries on a read-only copy of the live store carry stray closing tags (e.g. </color>, </cpu>) inside parsed fields such as concepts. None is cut at the token cap, so this is the Summary parser keeping tag text the model emitted, not truncation.

Evidence

Found while verifying rohitg00#1587 under #468; counts and method in tmp/verify/468/ (local).

Acceptance criteria

  • A failing test reproduces a model reply whose field text carries a stray tag
  • The parser drops it; the 60 live Summaries are counted before and after a re-summarize (read-only)

Activity

  1. self-assigned this
    on Nov 18, 2026
  2. possiblyneal commented on Nov 18, 2026

    @possiblyneal
    OwnerAuthor

    Verdict #472: Session Summaries store stray XML tags

    Verdict: APPLY (parser correctness)

    Defect, confirmed here. getXmlChildren (src/prompts/xml.ts) matched each child lazily from its open tag to the next </child>. When the model closes an item with the wrong tag (<concept>VAAPI renderD128</color>), that item runs on to the next item's close, so two items fuse into one and the stray tag is stored as text. The same parser feeds Summaries (summarize.ts:444-446: decisions, files, concepts), Observations (compress.ts:69-72: facts, concepts, files) and the Memory consolidator (consolidate.ts:55-56).

    Repro. test/xml.test.ts, 3 new cases on branch verify/472-xml-children (worktree tmp/wt/verify-472, from fdc3d459). On base, 2 fail:

    • an item closed with the wrong tag fuses with the next one
    • a last item closed with the wrong tag keeps the stray tag
      The third case (inline markup inside an item is kept) passes on base and after.

    Fix. Split the parent on the child's open tag. Each item runs to its own close tag. If it has none, it runs to the next open tag, and a wrong close tag at its end is dropped. An item that has its own close tag is never trimmed, so text such as <button>Requests</button> inside a fact is kept. After the fix, test/xml.test.ts passes 29/29.

    Live store (read-only copy, tmp/verify/live-copy.sqlite). Raw model replies are not stored, so I could not re-run summarize on them. Instead, each stored leaked item was wrapped back into its XML fragment and parsed again with the new parser (tmp/verify/472/count.ts). A leaked item is one that contains the child's own open tag, or that ends with a close tag.

    Record kind Total Affected before Still affected after
    Session Summaries 1,801 59 (31 concepts, 30 decisions; 66 items) 0
    Observations 103,152 792 (711 facts, 81 concepts, 1 file) 8

    The 8 Observations left are not fused items: some are legitimate HTML quoted in a fact, and the rest are items the model closed twice (x</fit></fact>). The new parser leaves both as they are, on purpose.

    Bar. typecheck 0 errors; npm test 3,119 passed / 1 skipped; eval:gate and eval:gate:rules pass; eval:suite fast vs base-fdc3d459: every metric Δ 0.000 (15 of 15). This is class 2, since Summary and Observation text feeds Injection, but the bench corpora are not LLM-compressed, so no movement was expected. Branch verify/472-xml-children, uncommitted, worktree tmp/wt/verify-472.

    Not done. Stored records are not repaired: the fix applies to new replies only. Repairing the 59 Summaries would mean a re-summarize or a one-time migration, which is a separate decision.

  3. added
    ready-for-agentFully specified, ready for an AFK agent
    and removed
    needs-triageMaintainer needs to evaluate this issue
    on Nov 18, 2026
  4. possiblyneal commented on Nov 18, 2026

    @possiblyneal
    OwnerAuthor

    Reopened: the verdict above verifies the fix, but it is not landed yet. Ready for /ship from branch verify/472-xml-children.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ready-for-agentFully specified, ready for an AFK agent

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions