kb: address e2e records by release version, apply what is recalled, and report both - #438
Open
yueliu14 wants to merge 3 commits into
Open
kb: address e2e records by release version, apply what is recalled, and report both#438yueliu14 wants to merge 3 commits into
yueliu14 wants to merge 3 commits into
Conversation
Two halves of one problem: a warm start that silently finds nothing, and a report that cannot tell you it found nothing. ADDRESSING. `e2e_identity` keyed `framework_version` verbatim. Serving stacks are installed from git in these images, so `sglang.__version__` carries a PEP 440 dev/local suffix (`0.5.15.post1.dev20260723+g6c9fd0adc5`) that changes on every rebuild of the same release, and a long opaque string is also one that gets transcribed with a segment missing. Either way the run opens a fresh set of pages and every earlier result becomes unreachable — not degraded, invisible, because the e2e store is an exact lookup and a miss is a plain 404. `framework_version` sits in the ladder's `base`, so no rung drops it: one changed character misses all three at once. `_release_version` cuts the address to `<major>.<minor>.<patch>`. Three components, not two — `0.5.15` and `0.5.17` are different releases with different kernels and must not merge. The exact build string still travels in the record's value, so only the address is coarse; same bargain as `kernel_identity`'s ROCm cut, one component wider. Reader and writer share the single choke point, so they cannot drift apart. REPORTING. `KB_RECALL` collects, on both planes, what was asked and how it fared: the exact canonical ids tried, the read reason and match tier, each recalled config re-measured against this box's baseline, and each kernel lane's `warm_start` block (adopted vs incremental speedup, rounds committed) — which previously died inside the lane, so an e2e report could describe a kernel as authored from scratch when the lane had in fact adopted a stored patch. It is threaded into the Report role's inputs and emitted as `kb_recall` in the workflow return, independently of `kb_warm_start` so a run with no established KB dims still reports its kernel-plane recall. `system_architect.md` gains a mandatory `2c` section, written even when nothing came back. On an exact-lookup store a miss and a never-recorded page are the same 404, so the addresses tried ARE the finding: without them a reader cannot tell "no prior art" from "prior art one segment away". The section also refuses to collapse `rejected` (ran and lost) into `not_reproduced` (never took effect) — they say opposite things about the record. Verified: identity normalization over dev/local/`v`-prefixed spellings of one release; `kb/tests` 70 passed 1 skipped; `test_e2e_lane_defaults.py` green; `node --check` on the workflow. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…stop blaming the record for the box A stored e2e record holds a WHOLE launch configuration, not a delta — the only form that can be replayed on a box whose baseline nobody wrote down. Replaying it means combining it with the baseline THIS run was handed, which under Hyperloom is a full flag string the run does not own (interface/run_e2e.py seeds initial_extra_server_args from the EXPLORE result and then sets config_tune=false, so no later sweep can correct anything either). That combination was a string concatenation performed by an agent. adapters/sglang.sh expands $EXTRA_SERVER_ARGS straight into argparse and $EXTRA_ENV straight into env, and both resolve a repeated key as last-wins — so when the baseline and the record each pin --context-length, which one applied was decided by the order the agent happened to write them in. Lose that coin flip and the server runs the baseline configuration twice: ~0% delta, no complaint in any log because the flag WAS honoured, and the record filed as `rejected`. A record that wins recorded as a loss is the one outcome the warm start exists to prevent. Three changes: - mergeFlags/mergeEnv merge key by key in the orchestrator. The recorded value wins every collision, in place, so the output names each key exactly once and last-wins never gets a vote. What was overridden travels with the direction (MERGE_OVERRIDES), into the log, into measured_on_this_box, and into the attestation note — it is the first thing to check when a replay comes back neutral. Generalizes the guard adapters/sglang.sh already applies by hand to --watchdog-timeout. A record the baseline already carries in full is skipped rather than benched against itself. - One repair pass, only when the server produced no number at all. The launch failure goes back to config_tuner, which classifies each recorded knob as upstream_gone / conflicts_with_baseline / env_unsupported, drops the minimum needed, and benches once more — through the same accept gate, with no allowance for having been repaired. Exactly once; a repair loop against a config that cannot run here spends server launches to learn nothing. - kb/attest.py gains `inapplicable`. `not_reproduced` meant both "the flag is gone upstream" (the record is stale) and "it collides with a baseline this run did not choose" (the record is fine), and retire_hint retires on two of them. Conflicts now count in `recalls` — the invariant that recalls is the sum of its buckets is what makes a ledger checkable — but are subtracted from the denominator retire_hint judges on, so a record can no longer be retired for being read on the wrong machines. Records written before the key existed read 0 and behave exactly as before. Also fixes the sweep result being read as trial.notes when the role file's schema spells it `note`, which kept the per-trial text out of the "never took effect" check entirely. Tests: new e2e_workflow/scripts/test_warm_start_merge.js extracts the merge functions from the shipped source (26 assertions); kb/tests/test_attest.py covers the new outcome, the retire arithmetic, carry-forward, and pre-existing documents. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…-config rows The recall report states, per recalled configuration, what was asked and what came back. With the warm start now merging a stored configuration key by key and repairing it once before giving up, a row's number can be produced by something other than the record as stored: a knob may have taken the recorded value over the baseline's, or may have been dropped to get a server up at all. Both facts ride in the same row (`overrides`, `applied_partial`, `dropped_flags`), and the Architect's outcome list learns `inapplicable` — a verdict on the pairing of record and box, not on the record. Without them a partly-applied delta reads as a measurement of the record, which is the misreading the report exists to prevent. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
yueliu14
added a commit
that referenced
this pull request
Aug 28, 2026
…d prose apart from the KB contract Two assertions in test_tuning_skillset_phase.js were red before this merge, not because of it: - It looked for TUNED_KB_ROOT in the input block. a03997c removed that key three commits back when the read moved to plane addressing, so the count has been 0 ever since and the assertion was checking for a symbol that cannot be there. Replaced with a loop that requires each TUNED_KB_* key to appear on BOTH sides -- handed to the role and read by it -- since a key only one side knows is dead plumbing, which is the failure mode that actually bit here. - The <1600-word cap was written for the role's method prose, then grew to cover the KB contract section that was appended later. Split it: method alone is 1499, and the whole role gets its own bound of 2100. The section header is asserted so the split cannot silently start measuring everything. Also compressed the --precision paragraph in tuning_specialist.md to state the cost (a table for another dtype installs under a name the runtime never reads, and burns a verify slot) instead of re-deriving it. The merge itself was clean. #438's _release_version coarsens only the derived e2e address; dims["framework-version"] stays the raw build string that value.upstream records, so the two changes are complementary.
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.
Three halves of one problem: a warm start that silently finds nothing, one that finds
something and silently fails to apply it, and a report that cannot tell you either happened.
1. Addressing —
kb/identity.pye2e_identitykeyedframework_versionverbatim. Serving stacks are installed from git in these images, sosglang.__version__carries a PEP 440 dev/local suffix —0.5.15.post1.dev20260723+g6c9fd0adc5— that changes on every rebuild of the same release. A long opaque string is also one that gets hand-transcribed with a segment missing.Either way the run opens a fresh set of pages and every earlier result becomes unreachable. Not degraded — invisible: the e2e store is an exact lookup with no search, so a miss and a never-recorded page are the same plain 404. And
framework_versionsits in the ladder'sbase, so no rung drops it:One changed character misses all three at once.
_release_versioncuts the address to<major>.<minor>.<patch>:Three components, not two.
0.5.15and0.5.17are different releases with different kernels; cutting to0.5would merge results that genuinely do not transfer. The exact build string still travels in the record's value, so only the address is coarse — the same bargain askernel_identity's ROCm cut, one component wider.Reader and writer share this single choke point, so they cannot drift apart.
2. Applying —
e2e_workflow.js,roles/config_tuner.md,kb/attest.pyFinding the record is half of it. A stored e2e record holds a whole launch configuration, not a delta — the only form that can be replayed on a box whose baseline nobody wrote down. Replaying it therefore means combining it with the baseline this run was handed, and that combination was a string concatenation performed by an agent (
roles/config_tuner.md:EXTRA_SERVER_ARGS="<current flags + this flag>").adapters/sglang.shexpands$EXTRA_SERVER_ARGSstraight into argparse and$EXTRA_ENVstraight intoenv, and both resolve a repeated key as last-wins. So when the baseline and the record each pin--context-length, which value applies is decided by the order the agent happened to write them in. Lose that coin flip and the server runs the baseline configuration twice: ~0% delta, nothing wrong in any log — the flag was honoured, just not with the recorded value — and the record is filed asrejected. A record that wins gets recorded as a loss, which is the one outcome the warm start exists to prevent.Two more failures sit behind the same seam:
measured=0,not_reproducedfiled, no repair.not_reproducedmeant both "the flag is gone upstream" (the record is stale) and "it collides with a baseline this run did not choose" (the record is fine).kb/attest.py:retire_hintretires on two of them, so a good record could be retired for being read on the wrong machines.This is the default path, not an edge case, wherever a caller seeds the run with a full flag string it produced elsewhere and disables the exploratory sweep. The warm-start replay itself is not gated by
CONFIG_TUNE_ENABLED; that flag gates only the exploratory ConfigSweep, so there is then no later phase that could correct any of it.Merge key by key, in the orchestrator, and report what it did.
mergeFlags/mergeEnvcombine the recovered configuration with the run's baseline by flag name / env key. The recorded value wins every collision in place, so the baseline's ordering survives and the output names each key exactly once — last-wins never gets a vote. This generalizes the guard the launcher already applies by hand to one flag (adapters/sglang.sh: don't add--watchdog-timeoutif the caller set one) and moves it to where the string is built instead of where it is used. Handles--flag value,--flag=value, bare flags, and multi-valued flags (kept whole, so a flag is overridden as a unit or not at all); a small explicit allow-list keeps genuinely repeatable flags (--lora-path) appended rather than deduped. What was overridden is reported, not just resolved —MERGE_OVERRIDESreaches the tuner, the run log,measured_on_this_box.md, the attestation note, and §2c below. A record the baseline already carries in full is nowskippedinstead of benched against itself.One repair attempt, and only when nothing came back. When the merged configuration produces no measurement at all, the launch failure goes back to
config_tuner, which classifies each recorded knob asupstream_gone/conflicts_with_baseline/env_unsupported, drops or adapts the minimum needed, and benches once more. Exactly once — a repair loop against a configuration that cannot run here spends server launches to learn nothing — and through the same accept gate, with no allowance made for having been repaired. If knobs had to be dropped, the verdict recordsapplied_partialand which ones.SWEEP_SCHEMAgains an optionalrepairobject, out ofrequired, so every ordinary sweep keeps validating unchanged.kb/attest.pylearnsinapplicable. A fourth outcome for "could not be applied to THIS box's baseline". It counts towardrecalls— the invariant thatrecallsis the sum of its buckets is what makes a ledger checkable, and hiding an attempt would make a record that keeps failing to fit look untouched — but it is subtracted from the denominatorretire_hintjudges on, because it is a verdict on the pairing and not on the record. The bucket list is now a singleBUCKETSconstant, since four call sites have to agree on it and three fail silently when they don't (a key missing fromattestations_ofreads as 0 forever; one missing fromcarry_attestations's emptiness test drops a whole ledger on the next rewrite). Surfaced throughe2e_store.py's_view()and track-record line so a reader sees "N did not fit that box's baseline (no verdict on the record)" rather than N failures.Also fixed here: the sweep result was read as
trial.noteswhile the role's return schema spells itnote, so the per-trial text never reached the "never took effect" check at all.3. Reporting —
e2e_workflow.js,roles/system_architect.mdKB_RECALLcollects, on both planes, what was asked and how it fared:overrides,applied_partial,dropped_flags) — a Δ measured from a partly-applied configuration is not a measurement of the record, and the row now says so;warm_startblock — adopted vs incremental speedup, rounds committed,no_rounds_after_adopt. This previously died inside the lane, so an e2e report could describe a kernel as authored from scratch when the lane had in fact adopted a stored patch.It is threaded into the Report role's inputs and emitted as
kb_recallin the workflow return, independently ofkb_warm_start— that object is null whenever KB dims were never established, but the kernel lanes can still have recalled by then, and those are exactly the runs where knowing what was recalled matters most.system_architect.mdgains a mandatory2c. Knowledge-base recallsection, written even when nothing came back. On an exact-lookup store the addresses tried are the finding: without them a reader cannot tell "no prior art" from "prior art one segment away". The section refuses to collapse the outcomes into each other —rejected(ran and lost),not_reproduced(never took effect),inapplicable(never fit this box) say different things about the record, and only the middle one is evidence it is stale.Compatibility
inapplicableexisted read it as0and produce exactly the same retire hint as before. No migration.repairis optional in the sweep schema; existing sweeps are unaffected.interface/run_e2e.py,adapters/sglang.shandbench_e2e.share unchanged.Verification
v-prefixed spellings of one release, and across sglang + vllme2e_workflow/scripts/test_warm_start_merge.js— 26 assertions, with the merge functions extracted from the shipped source rather than reimplemented, so it cannot pass whilee2e_workflow.jsdrifts. Covers the collision case, both flag spellings, bare and multi-valued flags, agreement-is-not-an-override, repeatable flags, and that the orchestrator actually hands the merged strings to the tuner.kb/tests/test_attest.pycases — the fourth outcome, the retire arithmetic (manyinapplicablereads never retire; a real pattern still does), carry-forward of aninapplicable-only ledger, pre-existing documents.kb/tests+e2e_workflow/scripts/tests/test_e2e_store.py— 127 passed, 1 skippede2e_workflow/scripts/tests— 1211 passed, 5 skipped, 77 subtestskernel_workflow/scripts/tests/test_experience_store.py— 83 passede2e_workflow/scripts/test_*.js, andnode --check e2e_workflow/e2e_workflow.jsNot yet exercised by a live run: the repair pass needs a real launch failure to fire.
Note for reviewers
mainalready has a2b(tuning skillset). The recall section is numbered2cand the PHASE=report Inputs line carries bothKB_RECALL(§2c) andTUNING_RESULT(§2b).🤖 Generated with Claude Code