Skip to content

fix(adapter): stop attributing the harness's own text to a person - #41

Merged
JumpTechCode merged 1 commit into
mainfrom
fix/injected-turns-and-compaction
Jul 27, 2026
Merged

fix(adapter): stop attributing the harness's own text to a person#41
JumpTechCode merged 1 commit into
mainfrom
fix/injected-turns-and-compaction

Conversation

@JumpTechCode

Copy link
Copy Markdown
Collaborator

Clears the two defects that corrupt what a distiller would read out of a
blessed session. Closes #25 and #27.

Both were specified and unimplemented rather than mis-designed — the
representation already said what should happen in each case.

Injected records are no longer human turns

The harness writes into the conversation under the user's role: hook output,
command results, caveat banners, and the summary that replaces a prefix
dropped to save context. isMeta and isCompactSummary mark it, and neither
field was declared on the record, so neither was read.

The text is kept — the agent read it, and a rubric grading what the agent was
working from needs it — and the role resolves to RoleUnknown, because no
person wrote it.

A compacted session no longer claims a complete order

OrderComplete documents itself as false when delegated work is unattributed
or when a prefix of the session was compacted away, and only the first
clause existed. Inline delegation does not occur in the measured store, so the
flag was true for every session this adapter could produce.

Both compaction markers are read: isCompactSummary on the summary record,
and the compact_boundary subtype on the system record. They arrive together
ordinarily, and a summary can be resumed into a session that never saw the
boundary that produced it. The boundary carries no message and becomes no
turn, so reading the flag off the reconstructed turns alone would miss it.

Measured, over 731 real transcripts

before after
human turns 33,765 22,579
turns kept but unattributed 0 11,185
agent turns 52,526 52,524
sessions declining to claim complete order 0 87 (11.9%)

Two assistant records carry isMeta as well, which is the pair the agent
column loses. Counts come from a live store and drift by a few turns between
runs; the smoke check that produced them was throwaway and is not committed.

Gate green: 88.0% coverage, 0 lint issues, 0 vulnerabilities. Both tests were
written first and watched fail — the injected-turn assertion named the exact
two fixture lines, and the order assertion failed on both compaction markers
while the uncompacted control passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ew64uotJqtvVDN3twMAVEQ

Two clauses that were specified and not implemented. Both corrupt what a
distiller would read out of a blessed session, so both are worth clearing
before anything is blessed from this adapter.

The harness writes into the conversation under the user's role: hook output,
command results, caveat banners, and the summary that replaces a prefix
dropped to save context. None of it was typed by anyone. Counting it as human
turns inflated them by half. Over 731 real transcripts, human turns fall from
33,765 to 22,579, with 11,185 turns keeping their text and losing an author
they never had. The text is kept because the agent read it and a rubric
grading what the agent worked from needs it; only the attribution goes.

The earlier survey's parser filtered both markers. The rewrite dropped the
filter, which is the more useful lesson: the conformance corpus checks that a
transcript parses, and had nothing to say about a field quietly stopping being
read.

OrderComplete documents itself as false when delegated work is unattributed
"or when a prefix of the session was compacted away", and implemented only the
first clause. Since inline delegation does not occur in the measured store,
the flag was true for every session this adapter could produce — dead, and
dead in the direction that matters: an ordering assertion against a compacted
session resolved to a failure rather than to the error that missing evidence
warrants. 87 of 731 sessions, 11.9%, now decline to claim it.

Both compaction markers are read. They arrive together in the ordinary case,
and the summary can be resumed into a session that never saw the boundary that
produced it. That boundary carries no message and becomes no turn, so reading
the flag off the reconstructed turns alone would miss it.

Counts come from a live store and drift by a few turns between runs.

Closes #25
Closes #27

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ew64uotJqtvVDN3twMAVEQ
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@JumpTechCode
JumpTechCode merged commit e2df371 into main Jul 27, 2026
6 checks passed
@JumpTechCode
JumpTechCode deleted the fix/injected-turns-and-compaction branch July 27, 2026 01:45
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.

capture(claudecode): harness-injected records are reconstructed as human turns

1 participant