fix(adapter): stop attributing the harness's own text to a person - #41
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
isMetaandisCompactSummarymark it, and neitherfield 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 noperson wrote it.
A compacted session no longer claims a complete order
OrderCompletedocuments itself as false when delegated work is unattributedor 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:
isCompactSummaryon the summary record,and the
compact_boundarysubtype on the system record. They arrive togetherordinarily, 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
Two assistant records carry
isMetaas well, which is the pair the agentcolumn 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