bench(cold-start): pre-run hardening - promoted-page summary delivery, run isolation, baseline preflight, cache settle (Closes #975)#976
Merged
Conversation
…, run isolation, baseline preflight, cache settle (Closes #975) Deliver promoted knowledge-page facts through search by sending the page summary on the apply_knowledge payload (required by curriculum and protocol validation, shared with the a2 seed text, and used as the page-sink surfaced-needle). Isolate every cold-start run in its own timestamped results dir with benchrun refusing to overwrite existing results or transcripts. Bound capture verification to the current run with a since filter on the insights read. Add a baseline-integrity preflight that refuses a contaminated platform (entity descriptions/tags/deprecation, any leftover insight, any knowledge page) before any episode is spent, with explicit remediation. Pace datahub-sink promotes with a -settle window (default 5m, recorded on the manifest, skipped for page sinks and unpromoted lessons) and flush each lesson record before the pause. Classify pre-audit platform refusals in the reviewer promote path as harness errors via a shared mcpc.PreAuditRefusal. Forbid evaluator memory writes in the eval scaffold and surface an audit-side MemoryWrites validity signal in the results and summary. Close the regression-blindness test gaps (identity math, flush ordering, teachAndPromote branches, credential rotation, refusal classification, benchrun wiring) and update the cold-start runbook with the fresh-quickstart requirement, pass criteria, adapter costs, and the new run-dir/report/settle workflow.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #976 +/- ##
==========================================
- Coverage 89.05% 89.05% -0.01%
==========================================
Files 424 424
Lines 48598 48598
==========================================
- Hits 43280 43278 -2
- Misses 3545 3546 +1
- Partials 1773 1774 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #975
Pre-run hardening for the cold-start knowledge-growth suite (#963, part of #958) so the first paid run measures knowledge delivery instead of harness gaps. All changes are bench-side; no
pkg/changes.1. Promoted knowledge-page facts are deliverable through search
Search renders a page hit as title plus summary, and the a3 tool surface has no page-body fetch tool, so a promoted page without a summary is a title-only hit whose fact never reaches an evaluator. This was the root cause of the weak page-sink channel in the #958 transfer data.
protocol.PagePayloadcarries aSummaryfield, andpromote.BuildApplyArgssends it on theapply_knowledgepage payload (the platform already stores and renders it).curriculum.validateSink,protocol.validateSink), so a run can never spend budget measuring a channel that structurally cannot deliver.bench/internal/gen: the curriculum's three page-sink lessons promote pages byte-identical to the a2 seed rows (slug, title, summary, body), pinned byTestCurriculumPageLessonsMatchSeedPages. S5 protocol page payloads use their one-sentence fact as the summary (TestProtocolPagePayloadsCarrySummaries).cs-traps.yamlandbench/protocols/*regenerated viamake bench-gen; drift tests green.2. Per-run output isolation
make bench-cold-startwrites each invocation into its ownbuild/bench-results/cold-start-a3-<timestamp>/results.json(transcripts land in the siblingresults.json.transcripts/).benchrun -cold-startrefuses to start when the-outfile or its transcript directory already exists, with no override flag: a re-run can never overwrite a prior run's paid-for results or transcripts.make bench-cold-start-reporttakes the run to summarize viaRESULTS=and lists the available run dirs when unset.3. Capture verification bounded to the current run
Teacher identities are deterministic per lesson index and URNs are fixed by the curriculum, so a pending insight left by an interrupted earlier run could fake a capture and then be promoted.
lifecycleapi.InsightFiltergainedSince(emitted as the admin API's RFC 3339sinceparam), andpromote.WaitForInsighttakes the teach episode's start time minus a 30-second clock-skew margin. Both call sites (cold-start and S5 lifecycle) pass it.4. Baseline-integrity preflight
An empty baseline cannot be restored by re-seeding: promotions write the
editableDatasetPropertiesaspect and an a2 seed leaves editable column docs, tags, and deprecation, whilebench_mces_empty.jsonupserts onlydatasetProperties.coldstart.Runnow hard-fails before any episode is spent when:datahub_get_entityon the admin session, concurrently per distinct URN);5. Cache-settle window between promote and eval
a3 caches DataHub table context with a 5m TTL, so a cache entry populated by checkpoint N-1's evaluators could serve the stale pre-promotion description to checkpoint N. A
-settleflag (default5m,SETTLE=on the make target) pauses between a successful datahub-sink promote and the next checkpoint, respecting ctx cancellation. Page-sink promotes skip it (page hits are served live from the portal store; nothing is cached), as do unpromoted lessons, and every skip is logged. The window is recorded on the results manifest so archived runs stay comparable, the lesson record is flushed to disk before the pause so an interruption never discards a completed teach and promote, and the scripted smoke runs withSETTLE=0s. The a3 arm config is untouched.6. Platform refusals in the reviewer promote path are harness errors
preAuditRefusalmoved to a single sharedmcpc.PreAuditRefusal(the coldstart, lifecycle, and pipeline copies are gone).promote.Reviewer.Applyreturns a harness error whenapply_knowledgefails with a pre-audit refusal code (session_expired,rate_limited, ...) instead of scoring it as a measured miss that would silently flatline the curve; a genuine tool-level refusal stays a measured miss.7. Evaluator no-self-teach rule plus a validity signal
The eval scaffold forbids saving, capturing, or updating memories or knowledge during an eval session. Because the rule is prompt-level, each
EvalAttemptrecordsMemoryWrites, derived from the transcript identically on the loop and claude-cli paths: only executed writes count (memory_capture, andmemory_managewith a mutating command: update, forget, consolidate), while budget-refused calls, error results, and read-onlymemory_managecommands do not.Metrics.EvalMemoryWritestotals them andHumanSummaryprints a validity warning when non-zero.8. Regression-blindness test gaps closed
teacherSeq,evaluatorSeq,maxIdentitySeq), plus global evaluator-email uniqueness across all checkpoints.OnCheckpointflush snapshots are pinned to the exact (lessons, checkpoints) sequence, guarding the flush-after-append ordering.teachAndPromotebranch (teach harness error, capture-verify error, capture miss, admin-session error, apply error, apply refusal) has a targeted test, andRunis proven to return non-nil on any harness failure.testkey-007.-armrequired,-baselinerefused, factory errors, plus the refuse-to-overwrite paths for both results and transcripts.9. Runbook
bench/README.mddocuments the fresh-quickstart requirement and why, the explicit pass criteria (lessons 6 (captured 6, promoted 6)withharness failures 0and climbing enrichment coverage; a zero exit code alone is not a pass because capture misses and promote refusals are measured outcomes), both adapter paths and their cost (claude-cli is subscription-funded, roughly 181 episodes at ~50s for k=1; the anthropic adapter is estimated around USD 20 at claude-sonnet-5 pricing for k=1), background launch for long runs, and the per-run dirs,RESULTS=, and-settleworkflow.Validation
make verifygreen (full CI-equivalent suite), bench module fully linted and tested with-race.make bench-up BENCH_ARM=a3 BENCH_SEED_PAGES=0,make bench-seed-datahub-empty, thenmake bench-cold-start-smokepassed with the preflight green andlessons 6 (captured 6, promoted 6),harness failures 0.Scope note
The never-overwrite guard applies to the cold-start mode, per the ticket. The
-lifecycleand-supersedemodes keep their fixed-outpaths: their documented smoke-then-real-run flows (and CI's repeated writes toresults-a0.json) write to the same path by design, so extending the guard there requires per-run directories for those targets as well; that is a candidate follow-up.