Skip to content

evals: split transcripts at header pairs, not bare $ lines - #5

Merged
angel291592 merged 2 commits into
angel291592:mainfrom
permadee:fix/transcript-session-boundaries
Nov 6, 2026
Merged

angel291592 merged 2 commits into
angel291592:mainfrom
permadee:fix/transcript-session-boundaries

Conversation

@permadee

@permadee permadee commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4. parse_transcript() treated any line starting with $ as a turn boundary. Command output can legitimately contain that shape (a test runner echoing the command it ran, a script printing a prompt, a git log message quoting a command), and when it does, the turn is cut in half: the prefix no longer matches TRANSCRIPT_BLOCK and is silently discarded, along with everything after the false boundary. --rescore then re-judges the run without the turn that may have carried the emitted spec or the reply under assertion.

The same in-band assumption appeared in delivery_spec() and in the aux.intent_check derivation, which both split on "\n\n$ ".

Change

  • Header-pair boundaries. A turn now starts only at a command line immediately followed by its [exit N] line (TRANSCRIPT_HEADER). A lone $ line is output, not a separator.
  • One shared splitter. split_transcript_blocks() is used by parse_transcript(), delivery_spec(), and score_user_api_caching()'s intent_check, so the three copies cannot drift. DELIVERY_SESSION_SEP is removed (it had no other references).
  • Loud failure for unparseable transcripts. A non-empty transcript with no parseable turn raises SystemExit naming the file, instead of returning [] and letting rescore() fail later with IndexError: list index out of range on turns[-1]["status"].
  • Selftests. Four new offline cases: a prompt echo inside stdout does not split a turn; a trailing non-block fragment is skipped; an unparseable transcript reports the path; and intent_check still finds the final session when its body contains a $ line before the marker.

The two behavioural regression cases fail under the previous logic — verified directly against the old splitter:

old parse turns: 1   new parse turns: 2
old intent_check sees marker: False   new intent_check sees marker: True

Verification

All offline gates pass on the Linux host:

python3 -m py_compile evals/run.py
uv run --with pyyaml --with jsonschema python evals/run.py --selftest
uv run --with pyyaml --with jsonschema python evals/run.py --check-frontmatter skills/intent-router/SKILL.md
uv run --with pyyaml --with jsonschema python evals/run.py --check-docs
  • selftest passed
  • frontmatter OK (493 lines, 491 chars)
  • docs OK (37 links; version, README evals, skill references and install command all 0 problems)

No live suite was run: this change touches offline parsing only (--rescore, delivery scoring, selftests), and the offline gates exercise every modified path.

Compatibility

Existing transcripts parse identically: every genuine boundary written by run_case_once() and persist_snapshot() already satisfies the header-pair rule. The change only stops treating output lines as boundaries. One residual ambiguity remains by construction — output that itself contains a full $ <cmd> + [exit N] pair is indistinguishable from a real header in the current human-readable format; a length-prefixed or JSON-lines record format would remove it entirely, but that is a persistence-format change and is out of scope here.

Risk

Low. Parsing-only change, no scoring semantics, case data, or reports touched. The failure mode it replaces is silent evidence loss.

Developer and others added 2 commits November 6, 2026 09:42
… one

Follow-up to the header-pair split: a zero-byte transcript (a run killed mid-write, a copy truncated in transit) still parsed to [], so --rescore reached turns[-1] and raised IndexError without naming the file. The guard only fired when the text was non-empty. Raise whenever no turn parses, and cover the empty case in --selftest.
@angel291592

Copy link
Copy Markdown
Owner

Added one commit to this branch while reviewing (fecdad9), to close the empty-file case as well.

parse_transcript() now raises for a zero-byte transcript too. A run killed mid-write — or a transcript truncated while being copied — parsed to [] under the "non-empty" guard, so --rescore still reached turns[-1] and raised IndexError without naming the file. The guard now fires whenever no turn parses, and --selftest covers an empty file next to the existing unparseable-text case.

Nothing else changed: the header-pair splitter and its shared use in delivery_spec() / intent_check are exactly as you wrote them.

@angel291592
angel291592 merged commit c487e9c into angel291592:main Nov 6, 2026
1 check passed
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.

--rescore drops turns when command output contains a $ line

2 participants