fix(bake): strip model-conditional betas from baked base set#487
Merged
Conversation
#485 made the drift CHECK ignore betaForModel()-managed betas, but the BAKE (capture-and-bake.mjs) still wrote the raw captured anthropic_beta verbatim — so a rebake from a capture riding context-1m (the runner's does) re-added it to the base, undoing #475 (seen in the closed #486). Run the scrubbed beta header through a shared stripModelConditionalBetas helper (drift-report.mjs, same MODEL_CONDITIONAL_BETAS set as the detector) before writing. Base never carries the per-request betas; betaForModel re-adds them at request time. test/bake-drift-report.mjs +2 (88/88).
Contributor
Compat test: ✅ PASSEDRan Output |
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.
What
Follow-up to #485, required before re-baking on the runner (issue #484).
#485 made the drift detection (
computeDrift) ignore thebetaForModel()-managed betas. But the bake path (capture-and-bake.mjs) still wrote the raw capturedanthropic_betaverbatim —scrubTemplatepreserves it by design. So the first auto-rebake after #485 (PR #486, closed) correctly droppedafk-mode-2026-01-31but re-addedcontext-1m-2025-08-07to the base set, undoing #475's model-conditional design.Fix
capture-and-bake.mjsnow runs the scrubbedanthropic_betathrough a new shared helperstripModelConditionalBetas(exported fromdrift-report.mjs, backed by the sameMODEL_CONDITIONAL_BETASset the detector uses) before writing the template. The baked base set therefore never carries the per-request betas;betaForModel()re-adds them at request time exactly as #475 intended. The bake logs the strip when it changes anything.Detection and bake now share one source of truth, so a re-bake can't drift back from what the check expects.
Tests
test/bake-drift-report.mjs+2 cases (now 88/88):stripModelConditionalBetasremovescontext-1m/fallback-creditwhile preserving base order and no-opping when absent; and a bake-vs-check consistency case provingcomputeDrift(baked-base, capture)is empty on the managed betas after the strip.After this merges
Re-dispatching the drift watcher produces a rebake PR whose only
anthropic_betachange is droppingafk-mode(real drift) — nocontext-1mre-add — plus the system_prompt refresh. That's the clean, canonical runner bake.