Repository navigation
fix(telemetry): a record can predate its journal, and must say so - #759
Merged
Merged
Conversation
blafourcade
force-pushed
the
fix/a-record-can-predate-its-journal
branch
from
September 4, 2026 17:55
23aafe0 to
d8f9bf7
Compare
`by_task` told a person their flow declares its task late in 96.2% of a real period. Measured on this project's own sink: of the 28,101 requests reading "before the next task this session declares", 22 actually did. The rest are older than anything their session's journal witnessed. Reading a resumed transcript stores the turns it inherited under the session that read them, dated when each was billed - days before that session opened a journal. No journal existed to declare anything in. A fifth `TaskUnattributedReason`, `"precedes-journal"`, names that fact, keyed on the journal's own earliest witnessed moment - the field the `"inferred"` bound already reads, never a second notion of when a session began. Decided before `"no-declaration"`, so a journal that declared nothing and did not cover the record is named by the coverage fact, which is the one that explains why no declaration could have covered it. The same separation `"no-journal"` made from `"no-declaration"`, one level down. `cost_report_version` 12 -> 13: an existing field gains a value a consumer switching exhaustively on the four previous reasons does not know. Also guards what nothing guarded: the version the cost skill names is now checked against the one the CLI emits. The contract document has had that guard since version 10, and the skill refuses any object whose version it does not know - so a bump could ship leaving it set to refuse the object it was built to read. Proven on the built binary against the real sink, sandboxed: 28,079 named for their age, 22 for declaring late, both breakdowns still summing to the 29,207 requests of the period. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp
blafourcade
force-pushed
the
fix/a-record-can-predate-its-journal
branch
from
September 4, 2026 20:03
7037f8a to
7d07846
Compare
The comment pinned the constant to a plugin script's own copy, "held to it by the byte-compare e2e test". That script and that test went when the CLI took the read path, so the sentence pointed a reader at a file that is not in the tree - and at a guard that no longer exists. The dead name is dropped rather than allowlisted in `NAMED_AS_HISTORY`: `comments-name-files-that-exist.test.js` is the guard that caught the first attempt at this fix, which kept the name while saying it was gone. A reader can act on "the limit lives only here"; a deleted filename gives them nothing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp
blafourcade
force-pushed
the
fix/a-record-can-predate-its-journal
branch
from
September 4, 2026 20:11
7d07846 to
a58e6d9
Compare
Merged
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.
What it says today
by_tasktells a person their flow declares its task late in 96.2% of a real period.Measured on this project's own sink, 29,207 requests over 2026-08-01..09-30: of the 28,101
requests reading
"before the next task this session declares", 22 actually did.Why
The rest are older than anything their session's journal witnessed. Reading a resumed
transcript stores the turns it inherited under the session that read them, dated when each
was billed — days before that session ever opened a journal. There was no journal to
declare anything in, so nothing was declared late.
Verified on both of this repository's run journals that
min(at)over every line equals thesession_startline, so the journal's ownwitnessed.fromMs— which already exists, andwhich the
"inferred"bound already reads — is the key, not a second notion of when asession began.
The change
A fifth
TaskUnattributedReason,"precedes-journal". Decided before"no-declaration", soa journal that declared nothing and did not cover the record is named by the coverage
fact — the one that explains why no declaration could have covered it.
The same separation
"no-journal"made from"no-declaration"at version 11, one leveldown: a fact about what the journal could cover is not a fact about how the work behaved.
Proven end to end
Built binary, the real sink copied read-only into a sandbox
HOMEandAIDD_USER_CONFIG_DIR, same command on both builds:origin/nextby_taskandby_backlogboth sum to 29,207 — the period total — on both builds.Guards, each with the mutation that kills it
"precedes-journal""precedes-declaration"InfinityTASK_UNATTRIBUTED_LABELSRejected as an equivalent mutant: defaulting an absent span to
0. Every moment thisfunction is ever asked about is after 1970, so the mutant behaves identically.
Found while making the change
Nothing checked the
cost_report_versionthe skill names against the one the CLI emits.The contract document has had that guard since version 10; the skill, which refuses any
object whose version it does not know, had none — so a bump could ship leaving it set to
refuse the object it was built to read. Added, and it failed before
03-report.mdwasupdated.
Envelope
cost_report_version13→14. A consumer switching exhaustively on the four previousreasons must add this one; every row's
totalsstill reconciles.Rebased onto #757 once it merged, so this takes
14. Found in that rebase: #757 bumped the number and never wrote its entry in the contract's version history, which jumped fromcurrently 13straight to "Bumped from11". Both entries are written here.Whichever lands second renumbers to
14— the constant, the contract heading and itsversion history, the skill, and the fixture envelope.
Gates
pnpm build+vitest run3392/3392 ·tsc --noEmit·biome ci·knip --production·jscpd· bundle 588.6/590 KB · reponode --test scripts/__tests__366/366 · markdownlinks 0 broken · catalogs and README counts regenerate to no change.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp