Skip to content

fix(bake): strip model-conditional betas from baked base set#487

Merged
askalf merged 1 commit into
masterfrom
fix/bake-strip-model-conditional-betas
Jun 10, 2026
Merged

fix(bake): strip model-conditional betas from baked base set#487
askalf merged 1 commit into
masterfrom
fix/bake-strip-model-conditional-betas

Conversation

@askalf

@askalf askalf commented Jun 10, 2026

Copy link
Copy Markdown
Owner

What

Follow-up to #485, required before re-baking on the runner (issue #484).

#485 made the drift detection (computeDrift) ignore the betaForModel()-managed betas. But the bake path (capture-and-bake.mjs) still wrote the raw captured anthropic_beta verbatim — scrubTemplate preserves it by design. So the first auto-rebake after #485 (PR #486, closed) correctly dropped afk-mode-2026-01-31 but re-added context-1m-2025-08-07 to the base set, undoing #475's model-conditional design.

Fix

capture-and-bake.mjs now runs the scrubbed anthropic_beta through a new shared helper stripModelConditionalBetas (exported from drift-report.mjs, backed by the same MODEL_CONDITIONAL_BETAS set 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): stripModelConditionalBetas removes context-1m/fallback-credit while preserving base order and no-opping when absent; and a bake-vs-check consistency case proving computeDrift(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_beta change is dropping afk-mode (real drift) — no context-1m re-add — plus the system_prompt refresh. That's the clean, canonical runner bake.

#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).
@github-actions

Copy link
Copy Markdown
Contributor

Compat test: ✅ PASSED

Ran node test/compat.mjs against dario proxy --passthrough on the self-hosted runner for commit 763dd8a2a300b349be7ef6db2830b1d76149cbff.

Output
============================================================
  dario Compatibility Validation (--passthrough via dario)
  2026-06-10T11:46:50.163Z
============================================================

--- Anthropic Messages API (Hermes) ---
✅ #1 Anthropic non-stream: "COMPAT OK" | thinking_injected=false | service_tier=-
✅ #2 Anthropic stream: 8 events | order=correct | "**STREAM COMPAT**"
✅ #3 SSE framing: event:/data: pairs correctly paired

--- Passthrough Verification ---
✅ #4 No thinking injection: No thinking block in response (passthrough clean)
✅ #5 Client betas preserved: Client-requested thinking honored (status=200)

--- Tool Use (OpenClaw) ---
✅ #6 Tool use: tool=get_weather | input={"location":"Tokyo"}
✅ #7 Tool use stream: 12 events | tool_use=true | input_json_delta=true

--- OpenAI Compat ---
✅ #8 OpenAI non-stream: "OPENAI COMPAT"
✅ #9 OpenAI stream: 3 chunks | [DONE]=true | "**STREAM OPENAI**"

--- Header Visibility ---
✅ #10 Header visibility: request-id=true | ratelimit=true (12 headers)

============================================================
  RESULTS: 10 passed, 0 failed, 0 warnings
============================================================

Full workflow run

@askalf askalf merged commit bb2d118 into master Jun 10, 2026
12 checks passed
@askalf askalf deleted the fix/bake-strip-model-conditional-betas branch June 10, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant