fix(improvement): enforce training provenance at held-out boundaries - #1302
Conversation
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 896a48cd
This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.
This approval is provisional. It rests on the audit running. If the audit cannot run — for example the CLI bridge rejects it — this approval is dismissed rather than left standing, so an unrun check never reads as a passing one.
tangletools · auto-approval · reason: drewstone_author · 2026-09-20T01:20:17Z
drewstone
left a comment
There was a problem hiding this comment.
Source self-review and scope check, not an independent approval:
The two fixed defects are reproduced against the exact merged implementation with the same dependency cohort (11 failures in the new/updated controls; repaired suite 95/95). The prepared candidate's source/test/script bytes were checked against the locally tested files; artifact SHA-256, candidate/base SHAs, clean worktree, and native verification logs match.
A further boundary audit checked the separate sealed candidate-bundle path. candidateProfileFromGenericProfile in src/candidate-execution/profile.ts explicitly rejects metadata, rather than silently stripping a trained profile's receipt. This is an unsupported integration path, not a reason to bypass the current closed candidate contract or claim universal trained-profile support. This PR intentionally covers the existing complete-profile optimization/proposal paths. Any broader execution integration must preserve the portable receipt and demonstrate the real consumer path.
Please critically review: (1) baseline checks happen before optimizer construction/analysis; (2) selected candidates are checked before final measurement; (3) both current and ancestor inventories include validation exposure; (4) canonical scenario/content digests are the same identity carried by the real exporter, without pretending exact hashes detect semantic duplicates; (5) training executionRef is not confused with evaluation executionRef; (6) existing independent development reuse remains valid. Tests include negative controls and positive controls for these distinctions.
The next value-producing integration remains the existing Blueprint P5 work (#2473): real export -> real trainer -> serving evidence -> actual worker -> fresh paired measurement, with complete adaptation costs. A fake serving port, an omitted timeout, and a green unit suite do not establish deployment, crash recovery, or improvement. The committed 12-part audit defines finite completion gates and identifies the outstanding adapter obligations.
tangletools
left a comment
There was a problem hiding this comment.
🟢 Value Audit — sound
| Verdict | sound |
| Coverage | 2 of 2 lenses (value, usefulness) |
| Concerns | 0 (none) |
| Heuristic | 0.0s |
| Duplication | 0.0s |
| Interrogation | 243.0s (2 bridge agents) |
| Total | 243.0s |
💰 Value — sound
Fixes two real provenance defects in the newly landed training path — receipts mislabeled with the evaluation executor's identity, and declared training datasets never checked against held-out eval content — by extending the codebase's existing admission-time assert pattern; coherent, in-grain, veri
- What it does: Two behavior deltas. (1) createProfileImprovementHarness().train() no longer silently overwrites the training receipt's executionRef with the harness's evaluation identity: ProfileImprovementHarnessTrainOptions now requires a caller-supplied executionRef (profile-improvement-harness.ts:20,106-110) because ImproveTrainingOptions.executionRef 'pins trainer, serving adapter and their private dependen
- Goals it achieves: Protects the integrity of the package's core promise (eval-gated self-improvement, per package.json description). Before this PR, a training receipt recorded the wrong execution identity — corrupting the provenance chain anything downstream (serving verification, audit) would trust — and a profile trained on held-out evaluation content sailed through every gate, inflating ship decisions (the audit
- Assessment: Good on its merits. The exposure check is not a new invention: it extends an existing family of held-out hygiene asserts (assertReleaseSplitIsFresh/assertReleaseScenariosAreFresh in improvement-cycle.ts:600-640, assertDirectCandidateReleaseWorkIsFresh in authored-profile-improvement.ts:234-253) from optimizer scenario/split reuse to the new training-receipt provenance source, in the same assert-fu
- Better / existing approach: none — this is the right approach. Searched rg for heldOut|held-out|decontam|contaminat|exposure across src/, docs/, candidate-execution/verify.ts, and runtime/promotion-gate.ts: the only existing held-out enforcement is the scenario/split freshness family cited above, which cannot see training receipts. Placing the check inside training.ts or schema validation would be wrong because training time
- Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 2
- Bridge warning: opencode/kimi-for-coding/k2p7: opencode: opencode error event without a message: {"type":"error","timestamp":1789867339889,"sessionID":"ses_f4397d0fdffeRJTDQCCIu6vAiH","error":{"name":"UnknownError","data":{"message":"Unexpected server error. Check server logs for details.","ref":"err_dd391783"}}}
🎯 Usefulness — sound
A coherent provenance fix that corrects a wrong identity contract on the young train API and extends the codebase's established fail-closed release-freshness guards to training receipts at all three live measurement boundaries, with refusal provably preceding any spend.
- Integration: Fully wired and reachable: assertProfileTrainingIsHeldOut runs inside method materialization (method-execution.ts:380, baseline at :394 before optimizer construction), and in both public intelligence proposal paths (improvement-cycle.ts:699,748; authored-profile-improvement.ts:174-175) exported via the ./intelligence subpath (package.json:37, api-surface.json:709-710). The harness.train executionR
- Fit with existing patterns: Follows the established pattern exactly: assertReleaseScenariosAreFresh/assertProfileReleaseWorkIsFresh (improvement-cycle.ts:617-678) already refuse optimizer-visible reuse of release scenarios; this adds the analogous check for declared training lineage at the same boundaries, placed with the existing candidate admission helpers. intelligence→improvement imports already exist (improvement-cycle.
- Real-world viability: Executed verification: 130 tests across the five touched suites pass, tsc --noEmit passes, build + verify-package-exports.mjs pass. Missing training identity returns a typed succeeded:false/stage:admission result rather than throwing (tests/profile-training.test.ts:356-371). Profiles without training metadata pass through unchanged (candidate-validation.ts:39), so existing profiles are unaffected.
- Model: opencode/zai-coding-plan/glm-5.2
- Bridge attempts: 1
No concerns — sound change, no better or existing approach found. ✅
What this audit checks
It judges the change on its merits — not whether it was tasked out in an issue. Unticketed, fast-moving work is fine; the question is whether the change is good and whether a better or existing approach should be used instead.
| Pass | What it asks |
|---|---|
| Heuristic | Vague title? Whitespace-only or cruft-bearing diff? (content signals only) |
| Duplication | Do added function/class names already exist elsewhere in the repo? |
| Value Audit | What does it do? What goal does it achieve? Is it good? Better architecture or already-exists? |
| Usefulness Audit | Does it integrate and fit? Will it hold up in real use and actually get used? |
Findings are concerns, not blocks — the human reviewer decides what to do with them.
✅ No Blockers —
|
tangletools
left a comment
There was a problem hiding this comment.
✅ Approved — 10 non-blocking findings — 896a48cd
Full multi-shot audit completed 8/8 planned shots over 24 changed files. Global verifier still owns final merge decision.
Full immutable report for this review: trace
Summary comment for this run: full summary
tangletools · 2026-09-20T02:08:07Z · immutable trace
Status
Open, non-draft; all four required final-head CI checks pass on
896a48cd9b7e1e0899f70c6210779f57b78642b1.https://github.com/tangle-network/agent-runtime/actions/runs/35481127476
Passed:
ci,agent-bench,official-optimizers, andpacked-cohort. This is one product commit on merged main3505d81e7f85683bc25bbd46a6bcbfdaf9503a71. No protection or test was weakened. Review has been requested fromtangletools; its current provisional auto-approval is not represented as a completed independent audit. A separate source self-review records the further sealed-bundle compatibility boundary.Purpose
Follow up on merged #1287/#1300 with two reproduced correctness fixes and a critical, outcome-driven review of the training work. One Runtime PR; no new dependency, exporter, optimizer, scheduler, or deployment client. The implementation changes add 32 net production TypeScript lines; the rest is regression coverage, the requested critique, and release metadata.
Correctness fixes
executionRefinharness.train(...). The bound harness reference identifies evaluation, not the trainer/serving implementation. Previously it silently replaced the caller's training identity, and an existing test asserted that wrong behavior. Training now requires its own reference; profile and validator binding remain intact.Critical review and finish criteria
docs/research/training-purpose-audit-2026-09-19.mdrecords 12 decisions: why each mechanism exists, its present contribution, concrete defects or evidence gaps, what to retain/delete/reuse, and how completion is judged. It separates engineering completion, measured user value, and continual-learning evidence. The architecture now explicitly identifies recursive execution as a substrate rather than the product's success criterion.The review does not confuse a receipt or mock-serving fixture with live GPU/model quality. It calls out actual consumer integration, serving attestation, native checkpoint formats, cost accounting, remote reconciliation, bounded ancestry, dataset scalability, command diagnostics, and API contract clarity. The existing Blueprint P5 work remains the consumer integration owner; no duplicate campaign is introduced here.
Verification
337fe6c548829b393bd8e0a4ef3f1277100ce10a703cf6908f7470ddf01faf4f, candidate/base SHAs, clean worktree, native logs, and exact source/test/script bytes against the local tested tree. They match. No temporary workflow or patch carrier enters this PR; the preparation workflow was retired after delivery.Compatibility and boundaries
Prepare Runtime 0.244.0 and Bench 0.13.6.
harness.train(...)callers must explicitly supply the training/serving execution reference; omission no longer silently borrows evaluation identity. Previously accepted profile comparisons with declared held-out contamination now fail. No dependency or benchmark grading change.This is a source audit with executable regression controls, not an independent third-party audit or a claim that every Tangle repository has been inspected. No merge, npm publication, deployment, or paid training/inference performed.