Skip to content

Report Issue and PR usage from native execution purpose - #151

Draft
lukemaj wants to merge 45 commits into
mainfrom
feat/105-native-purpose-outcomes
Draft

lukemaj wants to merge 45 commits into
mainfrom
feat/105-native-purpose-outcomes

Conversation

@lukemaj

@lukemaj lukemaj commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What Observer joins native responses to their declared Issue or PR and reports an unknown total when ownership or final usage is missing.
Why Observer 1.5.3 reported a complete $0.00 for nine unbound sessions with 747 unplaced responses.
So what CI and independent review passed on 76e8720. PR #151 remains draft and #105 stays open for the missing producer and historical evidence.

Refs #105, parent #58. The PR targets main at c2a035e4f35bb22467936d14fbfab8bc8efed4f2 and prepares version 1.7.0. The user retains merge and release approval.

Product proof on isolated copies

Public entry point or scenario Observed result
task show on the Nov 25 historical ledger Nine unbound sessions and zero attributed responses. Native and list-price totals are null and the cost is unknown.
Separate frozen native and Chromeria inputs PR #972 has 140 Claude responses with eight reconciled main-agent turns. Issue #971 has 215 with four matches, two mismatches, one missing final and six turns with no joined responses. The sets are disjoint. Removing one nonzero response from a multi-response turn on a private copy changed eight reconciled checks to seven matches and one mismatch. Full prices are null. The observed priced subtotals are $7.84 and $17.88.
Two declared Issues in one app thread and one native session Six Claude responses per Issue, zero common response IDs.
Late delivery A retained Issue run predates its delivery declaration. Removing the declarations in a disposable copy leaves the one witnessed response and price unchanged.
Additional purpose-scoped replays 20 atomic Codex responses. One Grok response tied to its completed prompt through a literal projected tool-call ID.
trace and publish --dry-run On #972 the trace exposed 140 membership records, 311 matching events before the supplied limit, and no transcript detail. Publication labeled the estimated full cost unknown.

A separate reader compared 15,180 native counter and cost fields against 1,151 Claude, 999 Codex, 324 OpenCode and two Grok responses. All compared fields matched, including missing values. Historical adapter import gaps remain visible in sync output. Twelve of the 355 Claude responses ended the turn without an observed tool call. No purpose-scoped OpenCode execution or original October planner ledger was available here. #72 was closed separately through #110.

Source contract and review

Chromeria #388 and #581 supply enough native purpose, input and segment identity to consume individual witnesses. No driver in the checked v1 contract certifies complete child/background inventory and final usage. OpenCode v2 lacks supported native inputs, and Grok tool-free completions need a separate direct identity when the input frame has none. Keep #105 open pending producer evidence or the user's execution-class scope decision. Source-owner assessment · Grok witness · Consumer handoff

The first review reproduced six defects. This candidate rejects quarantined native records, preserves explicit capture in native sessions, retains independent source snapshots, qualifies checkout observations by forge, withholds internal delivery URLs, and uses billed ownership for published native cost. The second review found four interactions. The candidate now withholds explicitly captured responses when native copies dispute their run, preserves explicit ownership in sessions with navigation links, records a checkout when the native event first imports, and withholds private forge names from both publication headings. The third review reproduced a historical checkout mischarge, disputed Grok completions leaking into explicitly bound sessions, and misleading publication wording. At af784d6daefb7fabb0c0b19a5615ffc93cd6f36f all three have regression coverage. A first-import Git observation can outlive its checkout and appear in local task show --json with candidate PRs. It authorizes no billing. Exact placement in this legacy class needs checkout identity from the native call. The copied-ledger report, trace and dry-run publication preserved both the database hash and the report snapshot across queries and made zero Git calls. The full local suite passed 1,001 tests. Compilation, git diff --check, the 1.6.0 version check and GitHub CI passed. The fourth independent review requested changes for contradictory Claude ancestry, task trace mismatches in Claude and OpenCode, Router totals in mixed sessions and same-number references on separate-namespace forges. At cd7828af9a6b0309ff55e79cf1391dd6de0b84e9, disputed Claude ancestry stays unplaced, Router ownership survives unrelated native runs, and non-GitHub Issues and PRs use kind-qualified keys. Task traces matched all 218 and 134 native Claude tool-call IDs in the two outcomes, with zero foreign calls. A retained OpenCode v1 session exercised with a synthetic admitted input had 43 joined responses and 52 matching calls, both with and without the turn filter. At the integrated head, 1,009 local tests, compilation, version checks, diff checks and GitHub CI passed. Additional real replays joined 71 Codex responses and one Grok completion. The fifth independent review requested changes for incomplete coverage in mixed Claude sessions, legacy explicit capture without ancestry, and OpenCode import-order-dependent costs. At 6b9ee848116f79ba8988235524acb537f0e00dd2, all 1,017 fixture tests passed. The historical nine-session ledger still reports unknown. With a retained OpenCode transcript and synthetic admission, the original input yielded 43 responses and 52 tool calls. Changing one response's counters and removing its parent in a second source copy yielded 42 responses and 51 calls in both import orders, with the same native-cost subtotal. A partially captured Claude session names the missing prompt and publishes unknown cost. An explicitly captured legacy response and call survived source removal. The sixth review reproduced two further false bills. An OpenCode refresh with invalid counters erased a competing parent. Unusable Claude ancestry admitted a display-turn fallback under the wrong prompt. Both reproduced on 6b9ee84. At 7b736f29a755ee153952ed9f65aacb19fe64df7e, the malformed OpenCode copy still disputes the response and leaves the independent $0.10 subtotal intact. After the two sources agree again the subtotal returns to $0.30. A Claude response with a missing node UUID or malformed parent stays unplaced and its call stays outside both task traces. The copied November ledger still has 747 unplaced responses across nine sessions and reports an unknown total. CI passed. Website impact is none for this local CLI change.

The seventh review and eighth review identified further ways a damaged source could yield a complete bill or send a tool call to another prompt. At 758d06638a66cd1dc2a5c5018d10b0ee3083fa16, conflicting Claude finals stay unplaced in both import orders. Correcting the first copy to agree with the second restores the confirmed amount. Partial or unreadable source replays preserve gaps. Unfinished OpenCode usage withholds the affected task’s total until its native completion. Trace checks cover both modern transcripts and genuinely parentless historical capture.

The ninth review verified the eighth-round regressions and demonstrated false bills after a Claude measurement disappeared, an OpenCode response had all-zero counters, or a boolean was supplied as a completion time. The fixes are in 57328e00773ceddf3bde804313f29c8b6778bf91. The source-availability tests now supply measured, completed responses before removing their native source.

The tenth review verified the ninth-round fixes and reproduced two further false bills. A provisional block could withdraw a final, and a completed OpenCode record with no counters could close a bill. The candidate retains final expectations per source and response through provisional, unreadable and repeated replays. Empty counters and partial finalized counters leave the total open. Before integration with the newly released main branch, 1,043 tests passed. The integration preserves both Grok prompt-bridge recording and main’s metadata freshness checks. The PR diff against main has no changes to health.py or test_health.py.

Eleventh review and replay proof. The review found that an unfinished JSONL line could erase a disputed final and that supplying an omitted counter could remove the response and its call. Three regressions failed on 37611b8 and passed on b4851cfcdeced8a2e9f139e0348526e16d6b9c33. The public CLI withheld the response, call and full price on both replays of the torn line. Completing the line with matching counters restored 90,011 tokens, one call and a $0.450011 estimated cost. Appending or rewriting a compatible final also restored the complete amount. Refreshing a previously complete copy with a missing disputed counter kept the response unplaced until the copies agreed. The report, trace and publication dry-run preserved the fixture ledger bytes. The full suite passed 1,084 tests in 159.384 seconds in a disposable clone. Compilation, diff, version 1.7.0 and GitHub CI passed. Each historical outcome on the November ledger copy again had nine unbound sessions, 747 unplaced responses, zero attributed responses and unknown cost. Scratch copies were removed.

Twelfth review and source replay. The review reproduced both a withdrawn disputed counter and incompatible cache totals. The four corresponding regression tests failed on b4851cf. At 603df40754b66883e4c00b0ccd293f0bf36dd56f, the public CLI withheld the price, response and call through two ordinary syncs after a copy omitted its disputed output counter. A readable replacement that removed the response restored the independent 15-token measurement and its one call. On a ledger produced by the previous parser, the CLI had billed a response with zero aggregate cache writes and 100,000 five-minute cache writes. The new head withheld it even before migration, an ordinary sync preserved the gap, and a valid 100,000-token aggregate restored one response and call at $0.12504. Public task, trace and dry-run publication reads preserved the fixture bytes. Both November outcomes again returned nine unbound sessions, 747 unplaced responses and unknown cost. All 1,089 tests passed in a disposable clone in 110.554 seconds, as did compilation, the 1.7.0 version check, diff checks and GitHub CI. Scratch copies were removed.

Thirteenth review and source replacement. The review found that removing the only complete source could preserve its total, and removing a conflicting cache split could leave a valid surviving response unplaced. On 603df40, three of the four import-order scenarios failed, with six failing assertions across ordinary and full sync. On ce4217dd3b3ccb1b083d85f1e9c8adb7ba592478, all four passed. On ledgers created by the preceding version, ordinary sync left the surviving partial response and its call visible in both import orders with an unknown total. Removing the conflicting partial recovered the surviving 15-token response and call with the same $0.000035 price in both orders. The public queries preserved ledger bytes. The November replay again reported nine unbound sessions, 747 unplaced responses, zero attributed and an unknown total for each outcome. All 1,093 tests passed locally in 109.551 seconds. Compilation, diff, version 1.7.0 and hosted proof passed. Disposable clones and fixtures were removed.

Fourteenth review and upgrade proof. The review reproduced stale pricing when only the cache split vanished before migration, and an obsolete legacy tool call that remained on a captured display turn. Both failing-before tests passed on 1782f2a20dcad81a111a58bf34747bc16f115342. For the public migration replay, a version-15 ledger reported 100,015 tokens and $0.200035 after the only one-hour cache witness was withdrawn. Ordinary sync of the two surviving files kept the observed token count and returned unknown pricing. A version-16 ledger with three archived calls on a captured turn returned just the two calls still present after the upgrade. Task, trace and publication dry-run preserved the fixture ledger bytes. Each November outcome again had nine unbound sessions, 747 unplaced responses and unknown cost. The full suite passed 1,095 tests locally in 111.430 seconds. Compilation, diff, 1.7.0 version checks and GitHub CI passed. Scratch was removed.

Fifteenth review and Codex copy proof. The review verified the historical cache and trace fixes, then found a Codex response could change Issue when copies disputed its native turn or counters. Three fixture cases failed on 1782f2a. Ordinary public CLI sync of two ledgers created by that parser reproduced 1,100 tokens on the first Issue in one import order and 91,100 on the second Issue in the other. On 926e01bdef7f5c5a5dcb0388680dad29fd725d11, both orders withheld the response from both tasks, including two replays of a torn copy. Correcting the copy restored exactly one 1,100-token response to the first Issue. A readable removal restored the surviving source in a separate regression. A legacy Claude append also reproduced a wrong task because another copy contained a later prompt. The new checkpoint resumes the prompt from the appended source. Local and hosted proof caught two existing Codex ingestion regressions in the first revision. The full suite ran 1,100 tests with two failures. The follow-up preserves incremental import for a growing final line and keeps a single conflicting rewrite out of the immutable ledger. Those existing regressions and the 77 surrounding checks passed on the local repair. Both historical November outcomes still showed nine unbound sessions, 747 unplaced responses and unknown full cost.

Sixteenth review and duplicate Codex records. The review reproduced loss of a valid charge when an identical usage record appeared after a model switch or in another file with no model context. Both regression tests failed before the fix. Ordinary and full CLI sync at ac5c5c7f9e0fb5e091f1a5565dca7864ad4d5d13 retained the owning Issue's 1,100 tokens, one tool call and $0.00032 priced subtotal in both cases. Conflicting turn or counter records still withheld ownership in either import order through two torn replays. Matching copies restored 1,100 tokens to the owning Issue. Both original ingestion tests for incremental tail handling and immutable counters passed. The isolated full suite passed 1,102 tests in 122.049 seconds, and hosted CI passed all 1,102. Compilation, the 1.7.0 release check and diff checks passed. The copied November ledger had nine unbound sessions, 747 unplaced responses and unknown cost for each historical outcome. Hosted proof.

Seventeenth review and ordinary sync. The review found that finishing an unrelated append could leave a response unplaced after another source withdrew its conflicting copy. The new regression failed on ac5c5c7 and passed on d4ecc25575467b4fbf24b433fb3542220f62ff0f. Ordinary sync read one newly completed line and restored 91,100 tokens, one call and the $0.10832 observed estimate to the owning Issue. It also recovered an existing ledger created by the preceding parser. Full sync agreed. Duplicate records retained their original price. Read-only CLI queries preserved the fixture ledger bytes. Both historical November outcomes still had nine unbound sessions, 747 unplaced responses and unknown total cost. All 1,103 tests passed locally in 114.338 seconds and in CI. Compilation, version 1.7.0 and diff checks passed.

Eighteenth review and archived rollouts. The review found that moving an unfinished Codex rollout to the archive kept the old path's incomplete receipt active. Two regression cases failed on d4ecc25. At 73698b2d44cd20e3c025b6f8c23bf4a362e40bc7 ordinary CLI sync recovered 91,100 tokens, one call and the $0.10832 observed estimate after a verified move, including on a ledger made by the previous parser. Missing files and a replacement that differed in the recorded torn bytes retained the coverage gap. All 1,105 tests passed locally and in CI. A separate migration probe then found that an older receipt without a whole-prefix digest could accept an unrelated replacement with a different inode and matching complete records. The local follow-up restores the identity check for these legacy receipts. The source-owner issue closed after Chromeria #974 withdrew delivery declarations on unlink. Native segment finality remains unreconciled at that merge.

Historical archive identity. The independent review of 73698b2 found no blocking consumer defect and confirmed a mismatch for receipts written by unreleased versions of this branch. The regression failed on 73698b2. At 76e87208415b0b4f98d29a19d1ad4f140cb29ac3, a second file with the same name and completed records but different torn bytes keeps the response and call unplaced. Restoring the original file with its completed tail gives the owning Issue 91,100 tokens, one call and the $0.10832 observed subtotal on ordinary sync. A new receipt can verify a copied archive by the digest of its observed bytes. An unfinished archived file may require repeated reads until it is complete. The full local suite passed 1,106 tests in 111.613 seconds, and hosted CI also passed 1,106. Compilation, git diff --check and the 1.7.0 release check passed. Both outcomes in the copied November ledger retained nine unbound sessions, 747 unplaced responses, zero attributed responses and unknown total cost. The independent review of this head passed with no blocking consumer findings. Its scratch run with a forced database location failed the default-location assertion. All 58 privacy tests passed for the reviewer after those overrides were removed. Old draft-version receipts cannot establish identity after a copy to another inode without the original byte fingerprint. Gaps remain visible in that case. The feature worktree stays with the integration owner for the open PR.

Requirements and who asked User authorized #105 under the reviewed #58 contract.
Deleted Empty-set cost totals, current-checkout reads during reports and whole-tree links as native response ownership.
Bottleneck Producer evidence for complete participation and usage beyond observed causes.
Checked myself Exercised supported CLI commands on copied data, compared real response ID sets, verified raw counters separately and checked independent review reproductions.

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. I reviewed the full diff for PR #151 at 54924c12bdcd1fa589595a2fedd8039deb514501 against 75ed333b0c9928fc306bcfc188f84829594a0d83, including all three WIP commits. The 993-test suite passed in an isolated copy. Separate fixture probes reproduced the following defects.

  • P1 · A quarantined Codex record can supply ownership. Import an atomic response without turn_id, then append the same response ID with a turn ID and different input tokens. The importer quarantines the duplicate as usage_conflict but has already stored its turn witness. The native join then uses that rejected turn to attribute the original response and its counters. Persist the witness only after the record passes duplicate validation. codex.py
  • P1 · Native purpose hides an existing explicit assignment. In the shared Codex planner fixture, explicitly assign the genuine second prompt to the same task as the first native run. With no native join for the second prompt, task show puts resp-mini-003 in unplaced usage and trace --task … --turn codex:turn-mini-bbb returns zero events. The explicit assignment alone reports the response and two events. Preserve explicit ownership when native evidence is absent and keep contradictory claims unresolved. report.py · trace filtering
  • P1 · Syncing a separate snapshot erases previous native evidence. Sync a purpose-aware fixture, then sync a separate valid legacy V2 database into the same ledger. Both imports succeed, but the first task loses its entire native_purpose section. Replaying the first database restores it. Scope replacement to the source being refreshed so report evidence survives import-order reversal. t3_purpose.py
  • P1 · Legacy placement can credit the wrong forge. Change the fixture checkout’s origin from GitHub to another host while retaining owner/repo and the branch. The response still credits the GitHub PR. When the linked task correctly uses the other host, its head lookup fails and a response touching both checkouts is credited solely to the other PR. Include the host in the persisted checkout and PR match. placement.py · head lookup
  • P2 · GitHub publication exposes internal delivery links. A valid delivery declaration for a private forge appears verbatim in the rendered comment for an unrelated GitHub target. The renderer uses Markdown escaping where the existing publication reference filter would withhold the link. publish.py
  • P2 · The published native-cost subtotal includes excluded shared usage. With two shared responses carrying $42 each, the canonical summary reports zero shared responses in the headline, while the comment shows $84.000000 as harness-reported cost. Both views should use the same ownership scope or label the shared amount separately. publish.py

Full #105 acceptance remains independently blocked by observed-only or unsupported background inventories, unreconciled segment finality, the unavailable original planner ledger, and incomplete historical execution-class proof. Native contract review · #105 proof record

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on PR #151 at 90098ec16bc887e5dcd617277eb299907a3debc7, reviewed against 75ed333b0c9928fc306bcfc188f84829594a0d83. Four fixture probes reproduced consumer defects.

  • P1 · Disputed native ownership still gets credited through explicit capture. Two retained snapshots assign the same run to Issues #7 and #8. The report flags run a as disputed, but Issue #7 still gets both Codex responses and two trace events through its explicit assignment. Retain the disputed input identities through ownership resolution so report and trace both withhold the affected records. Input filtering · Ownership fallback
  • P1 · A legacy thread link overrides a valid explicit assignment. Adding a single T3 link for the same task moved both explicitly assigned responses into unplaced. Trace still showed the two events. Preserve explicit attribution when the link supplies only session context. Report partition
  • P1 · A late PR link can credit an old response to a reused checkout. With only Alpha linked, sync records no checkout evidence. After the same path switches to Beta’s origin and branch and Beta is linked, the next sync bills Alpha’s old response to Beta. Capture checkout evidence while a session has a single link and leave historical responses unplaced when the original observation is missing. Checkout recorder
  • P2 · GitHub publication exposes private forge coordinates through the task ID. The fixture withheld the private delivery URL but printed internal.example.test/team/private-repo#11 twice in the comment body. Apply reference filtering to both task labels. Outcome label · Details label

All 1,013 tests passed in a disposable clone of the exact head. Compile, version, and diff checks passed. The verdict applies to that SHA. Full #105 acceptance separately remains open for native inventory and finality, unsupported execution classes, and the missing historical planner ledger. Consumer proof record · Native contract handoff

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on PR #151 at f212fa7384bebb3744908654087960625d2cc6dd, reviewed against 75ed333b0c9928fc306bcfc188f84829594a0d83. Three isolated fixture probes reproduced consumer defects.

  • P1 · A first import can bill historical work to a reused checkout. I wrote a Claude tool call while its path belonged to Alpha, switched that path to Beta’s origin and branch, then imported the transcript for the first time. task show credited claude:old-on-alpha to Beta. A new source row proves when Observer first saw the call. Leave the response unplaced unless the checkout identity can be tied to the call itself. First-import eligibility · Checkout observation
  • P1 · Explicit capture still credits a disputed Grok completion. Two retained snapshots assigned the same run to different Issues. The report flagged the run as disputed and removed its native membership, but the existing session capture still credited grok:historic-grok:done and returned its tool call in trace. The rejected prompt index disappears before the tool-call bridge can identify the affected completion. Carry that conflict through to the response and trace filters. Grok witness lookup · Explicit ownership fallback
  • P2 · Publication gives the wrong reason for native ownership exclusions. An Issue report described an unresolved response as work outside any single PR checkout. After assigning that response to Issue #12 through native purpose, the same report claimed it was counted on another PR. Use wording that reflects native ownership for those responses. Publication renderer

The exact-head suite ran 1,019 tests with one failure, test_tree_tasks_and_shared_ownership (0 != 4). That test passes on the newer test-only head 78f8700, whose GitHub proof is green. The three findings concern production code unchanged by that commit. Compile, version and diff checks passed, and the disposable copies were removed.

Full #105 acceptance remains open for independent native participation and final usage, unsupported execution classes, and the missing historical planner evidence. Issue #105 · Native contract assessment

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on draft PR #151. I reviewed head af784d6daefb7fabb0c0b19a5615ffc93cd6f36f against base 75ed333b0c9928fc306bcfc188f84829594a0d83 and reproduced five consumer defects.

  • P1 · A contradictory Claude copy can transfer credit to a Router task. Import a response whose UUID points to native Issue A’s prompt, with a competing Router session binding for B. B initially gets no credit. Import a copy with the same response ID, UUID, and counters but a different, missing parent. Ancestry now returns no input, and B receives the response through whole-session fallback. Preserve the disputed ancestry through ownership resolution so neither task gets credit until it resolves. Claude ancestry · Capture fallback
  • P1 · Claude trace includes a tool call from an unplaced response. Import prompts B then A, followed by one response to each, so both calls carry display turn A. Declare and explicitly capture A. The report attributes A’s response and leaves B’s unplaced, but trace --task A --turn claude:a returns both a-call and b-call. Apply literal response ownership to tool events before using display turns. Trace filtering
  • P1 · A separate native run removes three explicitly Router-owned responses from the outcome total. Give task A a Router binding for a Codex session and task B a navigation-only link to that session. A’s total includes three responses. Import a native Claude run for A in a separate session and the total falls to one response, the new Claude response. The navigation link makes the Codex rows appear shared, and canonical mode drops them from the total. B’s report already recognizes all three as belonging elsewhere. Router partition · Total selection
  • P2 · OpenCode v1 trace omits events for a proved response. Add parentID=msg_u1 to msg_a1 in the OpenCode SQLite fixture and project msg_u1 as the admitted input. The task report and trace both identify one joined response, but task trace returns zero events. Session trace contains 18 events, including call_read1 from that response. Carry the native part-to-message edge into task trace. Ownership · Trace
  • P2 · Issue and PR references with the same number collide. Project Issue #7 and PR #7 on the same non-GitHub forge, each with a distinct literal Codex turn. Observer creates one task key, reports conflicting reference kinds, and leaves all three responses unplaced. Preserve the reference kind in task identity where Issue and PR numbers can overlap. Task identity · Conflict handling

All 1,001 tests passed on the exact candidate in a disposable copy with Git history. Compile, version, and diff checks passed, and scratch copies were removed.

Full #105 acceptance also remains open for independent child and background inventories and final usage, tool-free Grok completions without a native bridge, unsupported OpenCode v2 evidence, missing historical proof, and call-time identity for exact legacy checkout billing. Those limits are separate from the five reproduced consumer defects. Producer assessment · Consumer handoff

Requirements and who asked: #105 R4 calls for distinct outcome accounting and historical task links.
Deleted: no new task tables, CLI option, or inferred manual-capture migration.
Bottleneck: the adapter discarded kind before ledger key lookup.
Checked myself: Chromeria TrackingReference and purposeScopesEqual at 502c86c92c, both import orders with Codex and T3 fixtures, task show and publish dry-run, retained-snapshot replay and historical checkout diagnostics.
Issue #105, R4 consumer component. Keep disputed Claude ancestry unplaced under explicit capture. Connect Claude events and OpenCode parts to their literal responses and use those edges for task trace and phase activity. Keep navigation-only links out of Router and joint capture totals.

Requirements and who asked: the Issue #105 integration owner requested the four response ownership fixes from R4.
Deleted: display-turn attribution for message-owned events and shared billing inferred from navigation.
Bottleneck: reports and trace lost native ancestry or discarded the link from an event to its measured response.
Checked myself: five R4 assertions failed on af784d6. On this component, 229 isolated tests passed. CLI task show and trace selected one Claude call on A, zero on B, and five OpenCode calls on the admitted input.

Proof command (bash):
python -m unittest tests.test_{outcome,native_response,opencode,claude,claude_queue,claude_queue_binding,t3_purpose,capture,router,t3,close_loop,phase_pricing,pr_checks_pending,schema3}

TMPDIR, T3CODE_HOME and GIT_CEILING_DIRECTORIES pointed at disposable fixture storage. Full integration proof, private replay and independent exact-head review belong to the parent.
Integrate additional source-replay coverage from local WIP 62fb0cc and retain the seventh-review fixes for rejected measurements and unknown totals.

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. I reviewed draft PR #151 at eaa8cfbd5ccdeb09fb7a69846d819884afb3e08b against 75ed333b0c9928fc306bcfc188f84829594a0d83. Three blocking consumer defects reproduced through the public CLI.

  • P1 · Claude publishes different complete totals depending on import order. Two final records shared the same response ID, node UUID, and parent, but reported 5,000 versus 90,000 output tokens. Sync flagged a usage conflict in both orders. task show still reported complete: true, and the publication estimate flipped between $0.04 and $0.46. The matching ancestry edge suppresses the counter conflict. Preserve the distinction between a stale streaming block and two disagreeing final measurements. Claude usage validation · Conflict handling
  • P1 · OpenCode reports complete evidence while a known response is unfinished. In a fresh ledger, one prompt owned a completed response and an unfinished response with nonzero counters. task show returned complete: true and a $0.075 total. Adding only the completion timestamp and syncing raised the total to $0.15. The unfinished observation is skipped when it has no projected usage row. That observation should withhold completeness and leave the priced subtotal visible. OpenCode witness lookup
  • P1 · Claude trace assigns a rejected response’s tool call to the wrong task. With prompts B then A, a valid response to A and a response to B with malformed counters both landed on display turn A. task show correctly withheld B’s response, but trace --task A returned both a-call and b-call. Repairing only B’s counters moved b-call to B. Rejected blocks lose their event association, making the call eligible for display-turn fallback. Claude event association · Trace fallback

I reproduced the original $0.00 publication on the base and verified that the candidate publishes an unknown total for the same unplaced response. The R6 and R7 cases passed, including disagreement, repair, and ordinary replay of an older Claude ledger. The CLI reads preserved fixture ledger bytes, 89 focused tests passed locally, and exact-head CI passed all 1,023 tests. Scratch clones and fixtures were removed. R6 review · R7 review · CI proof

Full #105 acceptance still depends on independent participation inventories and final usage, a tool-free Grok bridge, OpenCode v2 evidence, the October planner ledger, and call-time checkout identity for legacy billing. Issue #105 · Producer assessment

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on draft PR #151 at 758d06638a66cd1dc2a5c5018d10b0ee3083fa16, reviewed against 75ed333b0c9928fc306bcfc188f84829594a0d83. PR #151

  • P1 · Claude restores disputed usage when a copied record loses its measurement. Two copies disagreed on a response’s final counters. Removing only message.usage from the conflicting final record made task show charge the surviving copy and publish --dry-run report Evidence complete: yes. Replacing the conflicting copy’s nested message with a JSON array also erased a competing parent, restored the charge, and returned the call in task trace. Preserve prior disputes until the refreshed copy supplies usable evidence that resolves them. Claude replay and quarantine
  • P1 · OpenCode reports a complete total with known unmeasured usage. A prompt owned two completed responses. Setting one response’s counters to all zero made task show report a complete $0.10 native total and publication claim Evidence complete: yes. The adapter classifies that response as unmeasured, but the coverage check skips it. Keep $0.10 as the observed subtotal and leave the total unknown. OpenCode coverage check
  • P2 · OpenCode accepts time.completed: false as final. Changing only that field to JSON false left the response billable and the published $0.30 native total complete. Validate the completion timestamp before accepting final usage. OpenCode finality check

Proof. All four R8 regression cases failed on eaa8cfbd5ccdeb09fb7a69846d819884afb3e08b and passed on the reviewed head. The 82 focused tests, compilation, version check, and git diff --check passed. The full suite ran 1,037 tests with two failures locally and in CI. Both failing source-availability fixtures expect complete coverage before deletion while containing msg_a_unf; removing that unfinished message and its part in disposable fixtures made both tests pass. The public CLI read probes preserved ledger bytes, and scratch was removed. CI proof

Full #105 acceptance remains open for independent participation inventories and final usage, OpenCode v2, the tool-free Grok bridge, October historical evidence, and call-time checkout identity. Issue #105

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on draft PR #151 at 57328e00773ceddf3bde804313f29c8b6778bf91 against 75ed333b0c9928fc306bcfc188f84829594a0d83. Two blocking consumer defects reproduced through the public CLI.

  • P1 · A Claude replay can clear a dispute without a usable final. Import two copies of the same response and parent with 5 and 90,000 final output tokens, in that order. Set only the second copy’s message.stop_reason to null and run ordinary sync. task show credits the 5 tokens, trace returns the disputed call, and publish --dry-run reports Evidence complete: yes. The provisional block is quarantined, so the replay’s query over accepted ancestry misses it and drops the prior final dispute. I also reproduced premature credit after replaying missing usage, then an unreadable message, then a provisional block. Claude replay logic
  • P1 · OpenCode reports complete evidence when a response has no counters. One prompt owns two completed responses costing $0.10 and $0.20. Replace the second response’s tokens with {} and sync. Its usage disappears from the output-token sum, but task show still reports a complete $0.30 native total and publication says Evidence complete: yes. The all-zero check lets an entirely absent measurement pass. Keep the total unknown as in the all-zero case. OpenCode measurement check

Proof. All 1,039 tests passed locally on Python 3.13.16, compilation and git diff --check passed, the CLI reported 1.6.0, and hosted proof passed. Isolated CLI replays confirmed the R9 fixes for missing usage, malformed nested messages, all-zero counters, and invalid completion timestamps, including recovery when valid evidence returned. Both source-availability fixtures failed at their starting completeness assertion on 758d06638a66cd1dc2a5c5018d10b0ee3083fa16 and passed on the candidate. Report, trace, and publication reads preserved ledger bytes, and scratch was removed. Hosted proof

Full #105 acceptance also remains open for independent participation and final-usage evidence, OpenCode v2, tool-free Grok, and historical evidence.

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on draft PR #151 at 37611b8ac6e80d4f14c9799a10c3e6dc548eb0d5 against main c2a035e4f35bb22467936d14fbfab8bc8efed4f2. Two Claude replay defects remain.

  • P1 · A torn final line clears a live dispute. Import two copies of the same Claude response with 5 and 90,000 final output tokens. Rewrite the second copy so its final JSONL line is cut off, then run ordinary sync twice. Both times task show credits 5 tokens, trace returns the disputed call, and publication for the explicitly captured task says Evidence complete: yes. Completing the torn line restores the dispute. A synthetic Chromeria purpose fixture also gained the disputed response and call during the torn replay. The JSONL reader skips the unfinished line, and Claude treats the readable prefix as proof that the second source removed its final. JSONL reader · Claude replay
  • P1 · A partial final prevents recovery when the missing counter arrives. Import a single Claude final with 90,000 output tokens and input_tokens absent. The report correctly starts incomplete. Supply the missing input counter with all known counters unchanged. Both replacing the original line and appending the complete final make ordinary sync drop the previously credited response and its call. The partial row has already been sealed as final, so the complete measurement is treated as a conflict. Claude final ingestion

The original R10 cases passed. Provisional Claude replays preserved the dispute until matching final evidence returned. OpenCode with absent counters retained the independent $0.10 subtotal and withheld the total. All 1,080 tests passed locally on Python 3.13.16 and in hosted proof for this head and base. Compilation, git diff --check, and the CLI version check passed. The Grok bridge and upstream freshness paths were retained in the merge, and the report, trace, and publication reads preserved the fixture ledger bytes. Scratch was removed and the worktree is clean. Hosted proof

Full #105 acceptance still requires cause-independent producer inventories and final usage, OpenCode v2 coverage, a tool-free Grok bridge, and the unavailable October and call-time checkout evidence. #105 evidence handoff

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on PR #151 at b4851cfcdeced8a2e9f139e0348526e16d6b9c33 against main c2a035e4f35bb22467936d14fbfab8bc8efed4f2. Two blocking Claude consumer defects reproduced through the public CLI.

  • P1 · Dropping a disputed counter restores billing and trace. Import two copies of the same response and parent. The first has 5 output tokens and complete counters. The second has 90,000 output tokens and omits input_tokens. Observer initially withholds the response. Rewrite the second copy with matching input tokens but omit output_tokens. Ordinary sync restores the 5-token charge and the disputed tool call, and publish --dry-run reports Evidence complete: yes. The same failure occurs when two complete finals disagree on the cache TTL split and the rewritten copy omits that split. Preserve the dispute until the rewritten copy supplies the disputed measurement or a readable snapshot removes the response. Final measurement comparison
  • P1 · Enrichment accepts contradictory cache totals. Import a partial final with 100,000 five-minute cache-write tokens, zero one-hour tokens and no aggregate cache-write counter. Append or rewrite it with a final that reports zero aggregate cache writes and omits the split. Both paths store aggregate, five-minute and one-hour counts of (0, 100000, 0). The CLI credits the response and tool call, and publication reports complete evidence. Validate the combined counters before accepting enrichment. Claude final enrichment

Proof. All three original R11 cases failed on the preceding head and passed on the candidate. Two torn replays withheld usage and trace under explicit capture and synthetic native purpose until a readable matching final arrived. Compatible append and rewrite each recovered 90,011 total tokens and one call. The R6 malformed OpenCode counter kept the disputed response and call withheld while preserving the independent $0.10 subtotal. Both invalid Claude ancestry variants stayed unplaced, and an unbound native-purpose fixture published an unknown total.

All 1,084 tests passed on Python 3.14.7 and all 101 focused tests passed on Python 3.13.16. Compilation, git diff --check, and the CLI 1.7.0 version check passed. Public reads preserved fixture ledger bytes, and scratch was removed. Full #105 acceptance still depends on producer participation and final-usage evidence, OpenCode v2, a tool-free Grok bridge, the October ledger and call-time checkout identity. #105 handoff

PR #151, head b4851cfcdeced8a2e9f139e0348526e16d6b9c33, hosted proof passed and independent status pending coordinator relay.

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on draft PR #151 at 603df40754b66883e4c00b0ccd293f0bf36dd56f against main c2a035e4f35bb22467936d14fbfab8bc8efed4f2. Two blocking source-replacement defects reproduced through the public CLI.

  • P1. Removing the only complete final leaves a complete bill. Import a partial Claude final missing input_tokens and a second copy supplying that counter. Rewrite the second source as readable JSONL without the response, then sync. In both import orders, task show still reports 15 tokens and a $0.000035 total, and publish --dry-run says Evidence complete: yes. A fresh ledger with the same surviving sources reports an unknown total. Replacement retires the complete observation, but the coverage check still trusts the stored total. This also reproduces on the preceding head. Source replacement · Finality check
  • P2. Removing a conflicting cache measurement can leave the surviving final permanently unbillable. Import a partial final with 100,000 five-minute cache writes and no aggregate, then a complete copy with zero aggregate writes. Replace the first source with readable JSONL that omits the response. Even sync --full of the surviving copy reports one malformed record, and task, trace, and dry-run publication still withhold the response, call, and total. Reversing the original import order or importing only the surviving final yields one response, 15 tokens, and its tool call. Enrichment still combines the surviving final with cache fields from the retired source. Cache reconciliation

Verified. All five R12 regression tests failed on the preceding head and passed on the candidate. Public CLI probes confirmed disputed output and TTL withdrawals, torn replays, and incompatible cache totals on append and rewrite stay out of task, trace, and publication until matching evidence arrives. Compatible enrichment recovered on append and rewrite. All 86 focused tests passed, including the R6 regressions. Compilation, git diff --check, and the CLI 1.7.0 version check passed. Read commands preserved fixture ledger bytes, and scratch was removed.

Full #105 acceptance separately remains open for producer participation and final usage, OpenCode v2, tool-free Grok, the October planner ledger, and call-time checkout identity. Consumer handoff · Producer assessment

PR #151, head 603df40754b66883e4c00b0ccd293f0bf36dd56f, hosted proof passed and independent review requests changes pending coordinator relay.

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested on PR #151 at ce4217dd3b3ccb1b083d85f1e9c8adb7ba592478 against main c2a035e4f35bb22467936d14fbfab8bc8efed4f2. Two consumer defects reproduced through the public CLI.

  • P1. A ledger upgrade can keep billing a withdrawn Claude cache split. On parser v15, import a complete final with 100,000 aggregate cache writes and no TTL split first, then a partial copy that supplies 100,000 one-hour writes. Remove the response from the partial copy while still on v15. Ordinary sync of both sources on v16 leaves task show reporting $0.200035. A fresh ledger from the same surviving files reports an unknown price. The migration checks for a missing source or a missing witness for the total, so it misses a withdrawn field when the original source and total both survive. Claude migration
  • P2. Task trace can retain a call removed from a readable legacy Claude source. Import two parentless copies of the same final under explicit capture, with calls retired-call and surviving-call. Rewrite the first source so it drops that response and contains an independent response under the same prompt. After ordinary sync, task trace returns all three calls. A fresh ledger from the same files returns only surviving-call and independent-call. The rewrite removes the old response association but leaves the event eligible for display-turn fallback. Event lookup · Trace fallback

Both original removal cases passed in both import orders, including ordinary v15-to-v16 upgrades. Removing the only complete final preserved five output tokens and one call with an unknown total. Removing the incompatible cache copy restored one response, one call, 15 total tokens and the $0.000035 estimate. Public CLI probes also passed the R12 withdrawn-field and incompatible-cache guards, the R11 torn replay guard, and the R6 malformed OpenCode and Claude ancestry guards.

All 90 focused tests passed on Python 3.14.7. Compilation, git diff --check, and CLI version 1.7.0 passed. Public reads preserved fixture ledger bytes, and I removed the disposable clones and fixtures. Producer participation and finality, unsupported execution classes, and historical evidence remain open under #105.

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. Independent review of PR #151 at 1782f2a20dcad81a111a58bf34747bc16f115342 against c2a035e4f35bb22467936d14fbfab8bc8efed4f2 found one blocking Codex consumer defect.

  • P1. Incomplete or conflicting Codex copies can assign a disputed response to one Issue. Two readable copies of the same atomic response named different turns, and task show correctly withheld the response from both Issues. Truncating the second copy’s last line and running ordinary sync twice restored 1,100 tokens and a $0.00032 priced subtotal to Issue #7. Restoring the readable conflicting line withheld the response again. With two readable copies that also disagreed on counters, reversing import order moved the response from Issue #7 at 1,100 tokens to Issue #8 at 91,100 tokens. Replay deletes the prior turn witness before reading the replacement, and counter quarantine discards the competing witness. Preserve the dispute until readable evidence resolves it. Replay · Quarantine

Verified. Ordinary sync of a ledger created by v15 removed both withdrawn TTL fields while preserving the original source, 100,000 aggregate cache writes and 100,015 total tokens. The $0.200035 estimate became unknown. Legacy task trace returned only the surviving and independent calls, with and without --turn. All 136 focused tests passed, including the R13, R12, R11 and R6 regressions. Compilation, git diff --check and CLI version 1.7.0 passed. A separate legacy Claude append charged a later prompt from another copy on both main and the candidate, so that behavior predates this PR. R14

Full #105 acceptance remains open for producer participation and finality, unsupported OpenCode v2 and tool-free Grok cases, and missing historical and call-time checkout evidence. Scratch was removed, the shared checkout is clean, and the coordinator owns posting review/independent=failure. Consumer handoff · Producer assessment

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. Independent review of PR #151 at 926e01bdef7f5c5a5dcb0388680dad29fd725d11 against main c2a035e4f35bb22467936d14fbfab8bc8efed4f2 found one blocking regression.

P1. An identical Codex usage record can erase valid Issue attribution. Import a 1,100-token response under gpt-5.6-luna, then append a gpt-6-astra turn context followed by the exact same usage record. On 926e01b, ordinary sync and sync --full both remove the response and its call from Issue #7 and drop the $0.00032 priced subtotal from the publication preview. A second copy containing the identical usage record without a model context produces the same failure. On 1782f2a, both cases preserve the response, call, and subtotal. The new observation signature includes the reader’s current model, so an exact repeat becomes a measurement conflict even though the stored response retains its original model. Deduplicate exact native repeats while retaining genuine turn and counter disagreements. Observation signature · Existing duplicate contract

Verified. The original R15 dispute stayed withheld in both import orders through torn replays and invalid counters. Agreement, completion of the torn line by append, and readable removal restored the supported response and trace call. A predecessor ledger stayed withheld before and through ordinary migration until the copies agreed. Legacy Claude appends returned the response and call only under the source’s own captured prompt. All 161 focused tests passed, and task show, trace, and publish --dry-run preserved the fixture ledger bytes.

Scratch was removed. The verdict applies to 926e01b only. Hosted CI and live historical replays were outside this review, and the documented producer and historical evidence gaps for full #105 acceptance remain open. Consumer handoff

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. Independent review of PR #151 at ac5c5c7f9e0fb5e091f1a5565dca7864ad4d5d13 against main c2a035e4f35bb22467936d14fbfab8bc8efed4f2 found one blocking regression.

P1. Ordinary sync can leave a resolved Codex response unplaced. Import two copies of the same response that disagree on turn and counters. Sync the second copy with an unrelated, unfinished turn_context line at its end, then sync a readable rewrite of the first copy that removes the disputed response. Finish the trailing line and sync again. On the candidate, repeated ordinary syncs leave both Issues with zero attributed responses, no trace call, and no priced subtotal. sync --full restores one response, 91,100 tokens, one call, and a $0.10832 priced subtotal to Issue #8. The same fixture recovered on ordinary sync at 926e01bdef7f5c5a5dcb0388680dad29fd725d11. Clearing the incomplete-source marker on an incremental import only revisits response IDs found in the appended bytes. Reconcile the previously observed IDs when that marker clears while preserving the incremental read. Reconciliation code

Verified. Exact duplicates after a model switch or in a copy without model context kept the original 1,100 tokens, call, and $0.00032 subtotal through ordinary and full sync. Genuine disputes stayed withheld in both import orders through torn and invalid copies, and matching evidence restored attribution. Both prior CI regressions and the original OpenCode and Claude R6 guards passed in the 1,102-test local suite. Compilation, diff checks, and CLI version 1.7.0 passed. task show, trace, and publish --dry-run preserved the fixture ledger bytes. Scratch was removed. Prior CI failures

Full #105 acceptance remains open for independent child and background participation and final usage, OpenCode v2 and tool-free Grok evidence, the original October replay, and call-time checkout identity for exact legacy billing. Hosted CI and the private historical replay remain with the coordinator. Consumer handoff

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: changes requested. The R17 fix at d4ecc25575467b4fbf24b433fb3542220f62ff0f works, but I found one blocking Codex consumer defect elsewhere in the PR. It is reachable through ordinary use and cannot be recovered, and it has been present since ac5c5c7 (it is not new in this commit). PR: #151, base c2a035e4f35bb22467936d14fbfab8bc8efed4f2.

P1. A torn Codex source that is then archived or deleted blocks its session and responses for good.

  • What happens: If a sync reads a rollout while its last line is half-written, that source is flagged incomplete in codex_incomplete_sources. If Codex then moves the file to archived_sessions before another sync sees the finished line (issue #77 confirms Codex moves archived rollouts), the flag stays on the vanished path forever. The flag is only cleared in finish() when that same path is imported again (codex_atomic.py:82).
  • How I reproduced it: I ran the R17 fixture through the default-home sync. Two copies disagree on the turn, the first copy's readable rewrite withdraws its response, and the torn second copy is completed and moved to archived_sessions.
  • What I saw: The archived copy imports as source 3 with the same agreeing atom. The marker stays on missing source 2. The responses row still points to withdrawn source 1 (codex:A, 1,100). Issues A and B both show 0 responses and a partial cost of 0.0, and the session stays in unlocated_usage_sessions. Ordinary sync and sync --full give the same result on both the candidate and ac5c5c7.
  • Without a dispute it still hurts: The response stays attributed, but the task keeps the false gap native_response_usage_unavailable and an unknown total. Deleting only the stale marker row in a copied ledger removes exactly that gap and the unlocated session.
  • Why it is in scope: The marker table is new in this PR; codex_atomic.py does not exist on main.
  • Required fix: A marker whose source file is gone or relocated must stop blocking _reconcile and disputes. The readable archived copy should then be able to resolve the response, as completing the file in place now does.
  • Code: codex_atomic.py:69-102 and :175.

Verified at d4ecc25:

  • R17 through the public CLI: On ac5c5c7, B stays at 0 responses after the tail finishes, across repeated ordinary syncs. On the candidate, B gets 1 response, 91,100 tokens and a $0.10832 partial cost after one ordinary sync, and A stays at 0.
  • Ordinary upgrade of a ledger with the bug: A ledger built by ac5c5c7 and stuck in the R17 state recovered B (91,100, $0.10832) on the first ordinary sync --root under the candidate, because the context version bump to 10 replays every source. It stayed correct on a second sync.
  • Incremental ingest: The new test asserts the clearing import reads incrementally, one line. Timing on a 5,000-atom source: the clearing sync took 284 ms against 88 ms on ac5c5c7, and plain appends were unchanged at 98 ms against 89 ms. The new pass reconciles the same atoms a full import would, so it adds no new state path.
  • Earlier protections: The duplicate, model-switch, counter-immutability, torn/invalid dispute, both-order and R6 guards pass in the full suite: 1,103 tests OK. Compilation passed, bin/agent-observer --version printed 1.7.0, and git diff --check against the base was clean.

Not covered: Hosted CI, private historical replays, and the open #105 producer gaps (child and background finality, OpenCode v2, tool-free Grok, call-time checkout identity) are outside this review. One isolation note: task show priced from the live ~/.t3/userdata/usage-model-rates.json despite the scratch HOME. That was a read only.

Scratch is removed and the shared checkout is clean at d4ecc25. Posting review/independent=failure is yours.

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: no blocking consumer defect at 73698b2d44cd20e3c025b6f8c23bf4a362e40bc7. There is one non-blocking finding (P2). The R18 fix works through the ordinary public CLI, and missing or mismatched archives still report an unknown total.

PR #151, base c2a035e4f35bb22467936d14fbfab8bc8efed4f2. While I reviewed, the shared checkout moved to 76e8720, which is a different candidate. I reviewed only 73698b2, in a disposable clone.

P2 (non-blocking). An older receipt plus a mismatched archive can clear honest uncertainty after an upgrade.

  • Setup: A ledger built by d4ecc25 holds the R17/R18 dispute, with an incomplete-source marker that has no prefix digest.
  • Trigger: The archived same-name copy replaces the torn tail with a different well-formed record.
  • Result: One ordinary sync on the candidate credits Issue B with 1 response, 91,100 tokens and $0.10832, and clears unlocated_usage_sessions.
  • Inconsistency: The same mismatch under a new marker correctly stays unknown, which is what the PR's own test expects. The legacy branch (_historical_atoms_survive, codex_atomic.py:122-123,148-155) checks that the older atoms survive and checks the tail hash at the read offset. It never checks the torn bytes.
  • Why it doesn't block: codex_incomplete_sources is absent on main and was first added in 926e01b. So only ledgers built by unreleased heads of this PR can carry such a marker.
  • Fix options: Drop the legacy branch so old markers stay unknown (the smallest fix), or require file identity, which is what 76e8720 appears to do.

Low (performance only). An archive whose last line stays torn gets replayed from offset 0 and re-hashed on every sync (unchanged=0 on repeated syncs). The total stays honestly unknown.

Proof. All of these ran through the public CLI (sync --harness codex, task show, trace, publish --dry-run). Each scenario had its own scratch HOME, T3CODE_HOME, CODEX_HOME, XDG roots and AGENT_OBSERVER_DB. The default Codex roots resolved to scratch.

  • R18 scenario, file moved to archived_sessions:
    • On d4ecc25, A and B both stay at 0 responses with an unlocated gap, through ordinary and --full sync.
    • On the candidate, the first ordinary sync gives B 1 response, 91,100 tokens, $0.10832 and 1 trace response, with no gaps. A stays at 0, and the result holds through repeated and --full syncs.
    • The copy-then-delete variant gives the same result.
  • Upgrading an earlier stuck ledger:
    • A ledger built by d4ecc25 with the archive already indexed recovered on the first ordinary candidate sync (B: 91,100 / $0.10832).
    • The read-only task show run before that sync left the ledger bytes unchanged.
    • A single torn source with no dispute, archived under d4ecc25, had its false gap cleared on the first ordinary sync and kept its charge.
  • Honest uncertainty:
    • Torn source deleted with no archive: A and B stay unknown, with unavailable_sources and unlocated gaps, and the marker is kept.
    • With no dispute, the measured response stays credited but the gaps remain.
    • With new markers, an archive whose tail was replaced or whose earlier bytes changed under the same name stays unknown, and the marker is kept.
  • Realistic rollout: The full codex-mini.jsonl (3 responses, 15 events, 2 calls, 4 results) was torn, completed and archived. It ended identical to a clean import, with no duplicate events and no gaps.
  • Earlier behavior: The full suite passed 1,105 tests in 124.790 s in a scratch environment. That includes the R17 partial-append, dispute, both-order, duplicate, model-switch and immutable-counter guards, plus the 2 new archive tests.
  • Other checks:
    • trace, task show and publish --dry-run left the ledger bytes unchanged.
    • Compilation passed, git diff --check against the base was clean, and --version printed 1.7.0.

Not covered: hosted CI, the private historical replay, and the documented upstream producer limits. I made no GitHub writes, so posting review/independent is yours. Scratch is removed and the shared checkout was not modified.

@lukemaj lukemaj left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: pass. I found no blocking consumer defect at 76e87208415b0b4f98d29a19d1ad4f140cb29ac3 (PR #151, base c2a035e4). The commit closes the earlier P2. Ordinary archive recovery still works, and a missing or mismatched archive still reports an unknown total.

The P2 fix, checked through the public CLI. Each scenario used its own scratch HOME, T3CODE_HOME, CODEX_HOME, XDG roots and AGENT_OBSERVER_DB. Each ledger was built by d4ecc25 with the A/B dispute and a torn B tail, then upgraded.

  • Mismatched archive, original deleted. This is a copy whose torn line was replaced by a different well-formed record.
    • On 73698b2, the first ordinary sync gives B 1 response and 91,100 tokens. Gaps clear, and trace shows 1 native response. That reproduces the P2.
    • On 76e8720, A and B stay at 0 responses with usd null. The unlocated gap and the marker stay. trace shows 0 responses, and publish --dry-run says "conflicting response ownership".
    • This held across ordinary, repeated and --full syncs.
  • The new regression test fails without the fix. I ran test_historical_archive_must_identify_the_missing_file against 73698b2 code and it failed with AssertionError: 1 != 0 : B. It passes at the candidate.

Recovery is kept where file identity holds.

  • Old ledger, file renamed into archived_sessions: B gets 91,100 on the first ordinary candidate sync. Gaps and markers clear and stay cleared through --full.
  • Same, with the archive already indexed by d4ecc25: B also gets 91,100.
  • Ledger built at the candidate (new markers):
    • A rename or a genuine copy-then-delete recovers B to 91,100.
    • A mismatched copy stays unknown with its marker kept.
    • A deleted file with no archive stays unknown with its gap visible.
  • Read-only commands: task show, trace and publish --dry-run left the ledger bytes unchanged in every step.

Behaviour that changes (non-blocking). An old marker plus a genuine copy-then-delete archive used to recover on 73698b2. It now stays honestly unknown, because the inode differs. Only ledgers built by unreleased heads of this PR can hold such markers. Ordinary Codex archiving keeps the inode if it moves files by rename, but I did not check Codex's code for that.

Residual risk (no action needed). The legacy check compares ino without st_dev. It would only be fooled by inode reuse under the same file name, which is not realistic, and the existing atom-subset and tail-hash checks still apply. The low performance note from the earlier review stands, and nothing in this commit touches it.

Other checks.

  • The full suite ran 1,106 tests with 1 failure, test_privacy.LedgerLocationTest. That failure came from my XDG_STATE_HOME and AGENT_OBSERVER_DB overrides: rerun without them, tests.test_privacy passes all 58 tests.
  • git diff --check from base to head is clean.

Not covered: hosted CI, the private historical replay, and the documented upstream producer limits. I made no GitHub writes, so posting review/independent is yours. My scratch is removed, and the shared checkout is clean at 76e8720.

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.

1 participant