Skip to content

fix(learning): retain live work credit until acknowledged - #4096

Merged
joelteply merged 1 commit into
canaryfrom
astra/41f4e3ef-turn-credit
Sep 16, 2026
Merged

joelteply merged 1 commit into
canaryfrom
astra/41f4e3ef-turn-credit

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Long directed Persona turns could execute and remember many tool calls without retaining task credit until the entire turn settled. Held-work turns had a separate persona-global callback, with replacement IDs and no generation receipts.

Both live paths now lend a turn-owned capture to the existing shared driver. It awaits an atomic snapshot every four completed acts and at settlement, preserving submitted request IDs and actual served/fault receipts. Changed content gets a distinct revision ID; identical retries reuse their ID. Failed replacements preserve prior evidence and uncertain predecessors are retired in the next successful atomic write.

The live faculty now attaches ordered generation receipts at its actual adapter boundary, including failed/corrective attempts, independently of optional disk capture. Settlement reads the existing DataRecord envelope before decoding its credit entity; malformed or incomplete lists fail visibly with rows retained.

Settlement uses each revision’s own serving lane and passes its ID to the destination’s existing idempotency primitive. Only a matching durable acceptance receipt permits deletion; a stale drain cannot delete a newer revision. Failed outcomes, missing claims, mixed/unknown models, refusals and unacknowledged submissions remain staged. Durable acceptance is independent of later training dispatch success.

This does not add an ordinary-project verdict source or claim trained capability. It repairs capture and the existing verdict consumer without inferring success from card closure. A verdict can currently arrive during a continuing turn; a later verdict may accept a cumulative successor containing earlier acts. Immutable revision idempotency does not deduplicate that overlap across the existing activity lifecycle boundary. Ordered request receipts retain its provenance. Existing staging probes now include elapsed_ms for the awaited capture cost.

Validation: 132 native tests passed on the combined tree (25 act/observe, 15 training producer, 70 live faculty, 2 ledger, 20 source hygiene), with default features and four jobs. The two ledger files are a separately reviewed overlay now merged by #4091 and are excluded from this PR. The new driver/SQLite regressions initially failed on empty live receipts and the wrong ORM envelope; both passed after repairing those production boundaries. Only destination submission responses are scripted in the settlement fixture.

Normal Clippy passed. Strict Clippy reported 607 library / 743 library-test promoted diagnostics. Exact source mapping found one introduced nonminimal boolean expression; the remaining diagnostics map to unchanged source. Exact diff-line triage isolated that new finding; the equivalent predicate simplification is applied. Final normal Clippy passed with zero diagnostics on changed lines (846 unique diagnostics mapped to unchanged source). No lint allowances or baseline changes. The 132-test receipt predates only that equivalent predicate cleanup. Root source review and formatting checks passed; published-head CI remains authoritative for this branch.

Remaining lifecycle work is tracked on cards 6c36c24d (bind reviewed outcomes to exact revisions without cumulative overlap) and a346b3b0 (retry retained outcomes independently and page the current unbounded settlement read). An incomplete count/query snapshot or malformed list stays retained rather than silently transferring a subset.

@joelteply

Copy link
Copy Markdown
Contributor Author

Astra / Codex source review: approve exact edaf611, contingent on completed CI and the separate canary lifecycle/ratchet correction.

Reviewed the turn-owned callback across directed and held-work drivers, the actual adapter receipt attachment, immutable revision replacement, per-row served identity, DataRecord decoding and durable matching acceptance before deletion. The published diff contains exactly the six expected files; the separately merged ledger overlay and Windows CLI validation overlay are excluded.

Native receipt: 132 relevant tests passed on the combined validation tree; the only subsequent semantic edit was an equivalent predicate simplification. Final normal Clippy passed with zero diagnostics on changed lines; strict global Clippy is explicitly not clean. The real driver/SQLite failures were repaired in production seams, not by weakening fixtures.

This repairs staging and the existing verdict consumer. It does not prove ordinary-work review authority, cumulative-revision deduplication, training completion, adoption or learned gain; cards6c36c24d/a346b3b0 remain required. Deployment evidence must follow the eventual merged build.

@joelteply

Copy link
Copy Markdown
Contributor Author

CI at head edaf611579cd9bd148a74744fb84ae7e1e2212dd ran the generated merge b2a66fec747834ee0687e7e5231f5d2b01230966 into canary 522e926c2809cc52f83663c1a15ea3783d9f918f: 8,072 tests passed and two failed. Windows lib/tests check passed.

Both failures are in the newer base: the serving census fixture observed 2001/0 before/after handoff, and the unwrap ratchet counted 2,269 against 2,267. A source-only translation of the existing scanner finds 2,265 in this PR's parent and head, with no changed unwrap inventory. The exact CI merge adds four in unchanged files (framing_echo, resource_admission, llama_server), reproducing 2,269. This is attribution, not a waived gate: merge remains held for the serving correction and a green run on the corrected base.

The separately reported 132 native tests and normal Clippy receipt remain unchanged; no new Cargo run or production edit was made during this CI diagnosis.

— Astra / Codex S6

@joelteply
joelteply force-pushed the astra/41f4e3ef-turn-credit branch from edaf611 to d5c6386 Compare September 16, 2026 00:34
@joelteply
joelteply merged commit 22ea252 into canary Sep 16, 2026
5 checks passed
@joelteply
joelteply deleted the astra/41f4e3ef-turn-credit branch September 16, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant