feat(improvement): train and serve a checkpoint through improve with a receipt - #1287
Merged
Merged
Conversation
…a receipt
improve(profile, { mode: 'training' }) runs a controlled trainer command
or a managed adapter over a byte-verified dataset and parent profile,
hashes the checkpoint, verifies serving, writes the receipt, then
exposes the trained profile whose lineage the profile schema admits.
Part of tangle-network/blueprint-agent#2473
drewstone
marked this pull request as ready for review
September 19, 2026 03:06
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
tangletools
previously approved these changes
Sep 19, 2026
tangletools
left a comment
Contributor
There was a problem hiding this comment.
✅ Auto-approved drewstone PR — 74b00acb
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-19T03:06:49Z
This was referenced Sep 19, 2026
drewstone
added a commit
that referenced
this pull request
Sep 20, 2026
…olidation waves (#1304) * refactor(improvement): one owner per rule after the training and consolidation waves #1287 and #1300 landed hours apart and each added its own spelling of rules the other already had. Collapse them without changing a public export or behavior: - executionRef was checked three ways: a hand-rolled regex in the harness, a safeParse in method execution, and a bare schema parse in training that threw a ZodError instead of a ConfigError. candidate-validation now owns the rule. - method-execution imported agent-interface's canonicalCandidateDigest under the alias interfaceCandidateDigest while also importing the runtime's own, which is the same sha256Bytes(canonicalCandidateBytes(value)). Use one name. - copyProvenance was an alias for immutableCandidateValue. - Both candidate admission points prepared the surface and shaped the validator input separately; one helper does it, and the redundant caller-side Object.freeze is gone because validateProfileCandidate already freezes. check() also deep-copied a profile the materializer had already detached. - profile-surface had a private validateProfileCandidate(candidate, surface) with the same name as candidate-validation's exported validateProfileCandidate(validator, input) and a different job. It parses a materialized candidate, so it is now parseMaterializedProfile. - improve.ts re-listed by hand every type improve-types and training export, so each new option type was a three-file edit. `export type *` from the owning modules keeps the identical surface. The meta-harness case added by #1300 repeated an assertion the preceding case already made; its new half is folded into that case. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * test(improvement): resolve the training output root the fixture hands training runProfileTraining realpaths its output directory before syncing it, so on macOS, where tmpdir() is a symlink to /private/var, the synced path never equals the path the fixture passed and "publishes the durable receipt before the profile through the shared writer" fails locally while CI stays green. Resolve the fixture root once so both paths are the same string. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(deps): take agent-profile-materialize 0.20.1 and agent-core 0.9.7 Both are the newest published versions and need no code change: Materialize 0.20.1 peers on agent-interface ^2.6.1, which the catalog already pins at ^2.10.0, and Core 0.9.7 is inside the range the catalog already declares. agent-eval 0.183.0 is left out. agent-knowledge@17.0.2, the newest published, peers on `@tangle-network/agent-eval` `>=0.182.0 <0.183.0`, so under this workspace's strictPeerDependencies the install fails: [ERR_PNPM_PEER_DEP_ISSUES] Unmet peer dependencies ">=0.182.0 <0.183.0": @tangle-network/agent-knowledge@17.0.2 Runtime uses none of the /rl exports 0.183.0 changes; only bench/src/corpus.ts imports a type from that entry point. The bump needs an agent-knowledge release that admits 0.183, not a change here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * test(candidate-execution): take Materialize 0.20's generated-file marker agent-profile-materialize 0.20 puts a provenance comment on line 1 of every context file it generates from prompt.instructions, so the next materialization can prove which bytes it is about to replace. Files whose bytes are the caller's own — an explicit profile resource, a system-prompt replacement — stay verbatim, which is why only the agent-root AGENTS.md in these cases moves and the workspace one does not. Three expectations pinned the unmarked bytes. They now build the expected file through tests/helpers/materialized-context.ts so the marker's shape is stated once rather than in each test, matching how the subagent marker is already spelled in candidate-execution-prepare.test.ts. The checked-in improvement-proposal fixtures are regenerated: they carry both runtimeVersion and the profile plan digest, and both moved. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(deps): keep the pre-1.0 window range for agent-core `pnpm update @tangle-network/agent-core --recursive` rewrote the catalog entry from `>=0.9.6 <0.10.0` to `^0.9.7`, and the packed-consumer gate refused it: Error: packed consumer must load exactly one @tangle-network/agent-core@^0.9.7; found 1 installed path(s) - 0.9.7 at agent-core That refusal is correct. `caretAdmits` in scripts/lib/packed-package-test.mjs returns false for any caret below 1.0, because a pre-1.0 package makes no promise that a minor is additive — the repo's shape for one is the `>=X.Y.Z <X.Y+1.0` window `currentMinorPeerRange` builds. Restore the window. The declared range already admitted 0.9.7, so only the lockfile moves and the consumer-visible specifier is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * docs(api): carry the 0.245.0 version into the generated catalog and prose The docs gate regenerates docs/api and then refuses any curated page whose stated version does not match package.json, so the version bump this PR pays for the manifest change with left both stale. `pnpm run docs:api` rewrites exactly one line of docs/api/primitive-catalog.md — the version in its GENERATED banner. Nothing else in the generated reference moves, which is the same result check:api-surface reports: replacing improve.ts's hand-written re-export list with `export type *` changed no exported symbol. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
22 tasks
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.
Status
Ready for review; all four required CI checks pass on final head
87694f15b5af2c669ffa844df63dc31485166127.https://github.com/tangle-network/agent-runtime/actions/runs/35417723461
Passed:
ci,agent-bench,official-optimizers, andpacked-cohort. This includes the full test suite, lint, source/example typechecks, release-version checks, packed exports, edge execution, and generated-document freshness. Main466a7a2237b0ed603159b4f02a96b90d628995beis integrated with no conflicts. The PR is non-draft.The repository still requires one approving review. Review has been requested from the existing
tangletoolsreviewer. The Codex review bot reports exhausted review quota; its unavailable review is not represented as a pass. No protections were bypassed.Purpose and existing work
Train weights through
improve(profile, { mode: 'training', ... })or a bound harness'strain(...), then return an exact checkpoint-backed candidate and portable training receipt. Training does not imply a held-out improvement or authorize promotion.The reusable pieces already existed, but not this checkpoint-to-profile composition:
runAbortableandpublishExclusiveDurableFile; this PR now reuses them instead of maintaining parallel cancellation and publication code.The original dependency blocker is resolved. Peer floor, catalog, frozen lockfile, and exact packed cohort agree on Interface 2.10.0. Public imports use the existing root entrypoint, not an unsupported
./improvementpackage subpath.Correctness repairs
Regression evidence
Re-ran the original PR implementation at
ace732e0d7d118db899b2a819a513ea43f0d3912with Interface 2.10.0 installed. Three new regressions fail there: training dispatch after cancellation, serving dispatch after cancellation, and accepting checkpoint mutation by the validator. Thus the dependency bump alone was insufficient.The repaired product tree passes 95 focused tests across five files, including 29 training tests (19 original plus 10 new boundary regressions). Source typecheck and full lint also passed locally. Normal final-head CI above independently passes the complete repository checks.
Earlier clean preparation ran 4,226 tests successfully with six existing skips. Its temporary logging pipeline hid a Bench version-check failure behind
tee; artifact inspection caught that. Bench's patch bump fixes it, and normal final-head CI now proves the release gate passes. The temporary preparation workflow was retired and is absent from this PR.Release and boundaries
Prepare Runtime 0.242.0 and Bench 0.13.4, with changelogs, generated fixtures/API metadata, and packed-consumer import/type probes. Update this same PR by fast-forward; no force-push or mainline code loss.
No new optimizer, GPU scheduler, managed-training implementation, or Router deployment client. Command execution is trusted host code, not an OS sandbox. Managed adapters own remote cleanup and reconciliation. These checks prove execution/receipt contracts, not production model quality or a live GPU/Router deployment. No merge, publication, deployment, or paid model run performed.
Part of tangle-network/blueprint-agent#2473.