MG-4.6 rehearsal evidence — durable transcript
Why this directory exists. The reviewer of #3650 could not re-verify the drain
claim: "I cannot re-read the logs, because the gateway restarted at
2026-09-28T19:10Z and the rehearsal lines are gone." A rehearsal whose evidence
lives only in a container's log ring is a rehearsal that expires. These files are
committed so the claims in ../model-gateway-rollback.md §10 can be re-checked
later, and so the checker's replay arms run against real captured bytes rather
than invented ones.
| file | what it is |
|---|---|
2026-09-29-L1d-probe.json | run 3's L1d transcript, as bare grpcurl emits it — with NO session id. Kept deliberately: it is the shape that proved the round-1 anchor never fired, and the checker now REFUSES it. |
2026-09-29-L1d-probe-run4-with-session-id.json | run 4's transcript in the corrected §4 L1d form, with the session id prepended. This one anchors. |
2026-09-29-run5-L1a-snapshot.txt | run 5's L1a snapshot — the subject set input to check 6 |
2026-09-29-run5-probe-97a5cf02.json | run 5's probe for one of the three agents, in the loop's output form |
../../../tests/scripts/fixtures/mg-rollback/pass1-dead-agent.worker.log | real worker log of the pass-1 dead agent (ANSI intact) |
../../../tests/scripts/fixtures/mg-rollback/pass1-probe.json | the failing L1d transcript (404) |
../../../tests/scripts/fixtures/mg-rollback/pass2-served.worker.log | a turn that actually completed on the direct path |
../../../tests/scripts/fixtures/mg-rollback/pass2-probe.json | the completed L1d transcript |
2026-10-12-config-lever-armA-grace-210s.log | L4 config lever, arm A — the shipped stop_grace_period: 210s. The in-flight stream completed (drained_for=12s). Also a check-5 fixture. |
2026-10-12-config-lever-armB-grace-5s.log | L4 config lever, arm B (the mutant) — stop_grace_period: 5s. The stream was SIGKILLed: the drain began and shutdown complete never printed. Zero in-flight streams were cut lines, because SIGKILL beat the log line. Also a check-5 fixture. |
2026-10-12-config-lever-rehearsal.sh | the rehearsal, RUNNABLE as committed. ./2026-10-12-config-lever-rehearsal.sh reproduces both arms and ASSERTS each one's expected outcome; --arm A/--arm B for one. Scratch state goes to a temp dir, so a run leaves the repo clean. |
docker-compose.scratch.yml | the isolated scratch project (mg-rollback-scratch-3150): no published ports, no volumes, own network, nothing shared with upsquad-dev. Torn down on exit, including on failure. |
stub.sh | the stub standing in for cmd/model-gateway's drain contract (main.go:462-475), mounted read-only by the compose file above |
Run 6 — 2026-10-12, the L4 config lever (.env + recreate). PASSED, and the mutant is the finding.
Measured on an isolated compose project, not on upsquad-dev: no live
container was stopped, recreated or otherwise touched. The stub honours the
gateway's drain contract and carries a generation with 12 s of work left at the
instant of the flip.
stop_grace_period | flip → new config live | in-flight stream | shutdown complete | cut lines | check 5 verdict |
|---|---|---|---|---|---|
| 210s (as shipped) | 12.91 s | completed | 1 | 0 | ok (12 026 ms) |
| 5s (mutant) | 5.89 s | SIGKILLED | 0 | 0 | FAIL (unpaired start) |
The broken configuration is FASTER and also reports zero cut lines. Neither a
stopwatch nor the cut-line count separates them. Check 5 does — it demands a
paired start → done — but only once somebody runs a rehearsal. The arithmetic
in check 8 is what catches it at review time:
drain 180s + SIGKILL margin 30s <= stop_grace_period 210s <= 300s - 10s overhead
floor 210s SHIPPED 210s ceiling 290s
The shipped value sits exactly on the floor, and that is acceptable — the
30 s is the headroom (ruling on review 5489803877), and the gateway budgets the
same 30 s on the other side as drain − MaxRequestMarginSeconds
(internal/modelgateway/config.go). A 180 → 181 drain under 210 s of grace
leaves 29 s and kills nothing: it breaches the policy margin, which is a
different and lesser thing than cutting a stream. An earlier revision of this
file said it "starts cutting in-flight generations"; that was wrong.
test_the_shipped_grace_sits_exactly_on_the_floor pins the equality, and
test_a_margin_breach_is_not_reported_as_a_kill pins the distinction so the
wrong claim cannot come back.
Only grace < drain is a demonstrated kill, which is what arm B below measures.
The four fixtures are live inputs to --self-test-empty and to
tests/scripts/test_model_gateway_rollback.py, so they cannot rot silently: if
their shape stops matching what the parser expects, CI reddens.
Run 1 — 2026-09-26, L1 flag only. FAILED.
| step | wall | result |
|---|---|---|
UPDATE ... gateway_routed=false (3 rows) | 0.10 s | UPDATE 3 |
| flag read back | 0.11 s | 0 of 18 routed |
| CreateSession (new session) | 0.17 s | 123e1078-d76c-4e33-a30b-288195b52710 |
| first direct turn | 1.90 s | 404 not_found_error: model: openai/gpt-oss-120b:free |
| decide → outcome | 2.27 s | agent de-routed and DEAD |
Worker log: pass1-dead-agent.worker.log. Note the ordering, which is the whole
finding — adapter_resolved gateway_routed=False at 09:21:00.382801Z,
then node.call_llm.error at 09:21:02.216339Z.
Negative control, same minute: never-routed generalist
(claude-haiku-4-5-20251001) served direct in 1.0 s — session
e25564dc-fdf0-4793-a0eb-e76b478fcfad, pass2-served.worker.log. So the direct
path was healthy and the model id was the whole fault.
Run 2 — 2026-09-26, L1 flag + L1c model. PASSED.
| step | wall | result |
|---|---|---|
flag and model_id, one statement | 0.16 s | UPDATE 3 |
| flag read back | 0.14 s | 0 routed |
| CreateSession | 0.12 s | ok |
| first incumbent turn | 4.95 s | INCUMBENT |
| decide → served | 5.37 s | ≪ 5 min |
Run 3 — 2026-09-29, re-verification after review. PASSED.
Re-run with the review's CASE WHEN guard and the amended checker.
| step | wall | result |
|---|---|---|
UPDATE ... CASE WHEN model_id LIKE '%/%' | 0.10 s | UPDATE 3 |
| CreateSession | — | f3d20fac-4877-4a82-9ad8-32432128c1bb |
| L1d probe turn | 4.77 s | INCUMBENT (2026-09-29-L1d-probe.json) |
| decide → served | 5.10 s | ≪ 5 min |
Checker, --probe-transcript supplied → rc=0:
ok 1/flag-off 0 of 18 agent_configurations are gateway_routed
ok 2/no-new-governed-rows 0 governed rows since 04:49:07Z, against a non-empty
corpus of 56 prior governed rows (249 total)
ok 3/incumbent-serving 1 de-routed session after 04:49:07Z, none with a failure
signal, probe completed finalResponse='INCUMBENT'
ok 4/direct-path-model-… 18 agents examined, none provider-prefixed
Same instant, --probe-transcript omitted → rc=1, FAIL 3/incumbent-serving.
That contrast is the review's C1 fix demonstrated live: route evidence alone is
unproven, not clean.
CASE ELSE branch verified read-only (the live run could not exercise it —
all three routed agents had provider-prefixed ids):
would_change=3 preserved_unchanged=15 total=18
So an agent that already holds a native id is not rewritten.
Run 4 — 2026-09-29, after the round-2 review (N1/N2). PASSED, and the anchor fires.
Re-run with the corrected L1d form (session id prepended to the teed transcript).
6.27 s decide → INCUMBENT.
Checker rc=0, and check 3 now demonstrably anchors — the suffix the round-1 run
could never produce:
ok 3/incumbent-serving
1 in-scope de-routed session(s) after 2026-09-29T05:19:32+00:00 (1 de-routed
overall, all scanned for failures, none failed), and the probe transcript
completed with finalResponse='INCUMBENT', anchored to session e20af612…
Two live negative controls against the same window, both rc=1:
| control | verdict |
|---|---|
the same transcript with its sessionId line stripped (the bare grpcurl shape) | FAIL — "carries NO session id … a transcript committed from an earlier rehearsal would pass" |
run 3's committed evidence probe replayed as if fresh (session f3d20fac) | FAIL — "not among the 1 session(s) de-routed after … either STALE or from an agent that was never de-routed" |
That second row is the N2 defect reproduced and then refused: the round-1 checker accepted exactly this input.
Run 5 — 2026-09-29, after the round-3 restructure (N4). PASSED, per agent.
The runbook as written: L1a snapshot, one UPDATE, then a probe loop over the L1a
|t| ids — all three rolled-back agents, each by its own id.
| config | agent | session | reply |
|---|---|---|---|
4cd4fc1d | 133138cb | caa2b934 | INCUMBENT |
97a5cf02 | 5410c9e4 | 6c98401f | INCUMBENT |
ebfa8582 | 477daf95 | fe52ca29 | INCUMBENT |
5.20 s decide → all three served. Checker rc=0:
[pass] 4cd4fc1d-… was_routed_on='openai/gpt-oss-120b:free'
[pass] 97a5cf02-… was_routed_on='openai/gpt-oss-120b:free'
[pass] ebfa8582-… was_routed_on='google/gemini-2.5-flash'
ok 6/per-agent-verdict all 3 rolled-back agent(s) pass every arm
Two live negative controls on the same window — both rc=1
1. Probe only 1 of the 3 agents. Partial coverage must not certify the set:
[pass] 4cd4fc1d-…
[FAIL] 97a5cf02-… (f) no completed probe transcript attributed to this agent
[FAIL] ebfa8582-… (f) no completed probe transcript attributed to this agent
2. N4 reproduced: a COMPLETED probe of the never-routed control agent, as the
only probe. This is the input that went GREEN at 34f4e2fa:
[FAIL] 4cd4fc1d-… (f) no completed probe transcript attributed to this agent
[FAIL] 97a5cf02-… (f) ...
[FAIL] ebfa8582-… (f) ...
[probe] session 25e7e85d… belongs to agent f0dce705…, which is NOT in the
rolled-back set — a probe of a healthy bystander proves nothing about the
agents this rollback de-routed (N4)
f0dce705 is the generalist config. The resolution is done in the database, so
the transcript cannot lie about which agent answered.
Run 6 — 2026-09-29, after the round-4 review (N5 + N6). PASSED, and N5 refused live.
| result | |
|---|---|
| all three agents probed fresh | rc=0, ok 6/per-agent-verdict |
N5 live: probe #3 swapped for a transcript of the same agent from an earlier rehearsal (f3d20fac → 97a5cf02) | rc=1 |
[probe] session f3d20fac… belongs to rolled-back agent 97a5cf02… but was NOT
created after --since — a STALE transcript from an earlier rehearsal is
not evidence about THIS rollback (N5)
This is the production query path, not a fake: agent_sessions genuinely
resolves f3d20fac to 97a5cf02, which is exactly why identity alone was not
enough. N4 was window-without-identity; N5 is identity-without-window.
Drain rehearsal — 2026-09-26, two runs
| SIGTERM fired at | drain held | in-flight streams were cut | exit | |
|---|---|---|---|---|
| run 1 | inflight=0 | 0 ms (09:23:52.825Z → 09:23:52.825Z) | 0 | 0 |
| run 2 | inflight=1 | 14 553 ms (09:24:49.724Z → 09:25:04.277Z) | 0 | 0 |
Run 2's client received a complete 15 058-character response with a
completion block and no error block — the in-flight stream was not cut.
docker start → readyz=200 in 1.3 s; a routed turn served immediately after.
Both runs have zero cut lines. That is why check 5 requires a non-zero drain
duration; the two timestamp pairs above are the fixture behind
5/drain zero-duration (the false green) and 5/drain real 14.5s drain PASSES.
beta-dev state after every run
All 18 agent_configurations diffed IDENTICAL to the pre-run snapshot on
gateway_routed and model_id; gateway running, restarts=0,
readyz=200; a routed turn served after restore. ProductionRoutingReleased
and ENVIRONMENT never touched — the #3148 default flip was never taken.
No docker compose down, no volume touched, the database never restarted.
The harness is committed RUNNABLE, and that was a correction
The first version of these files could not run as committed: the driver opened
docker-compose.scratch.yml while the committed file was named
...-harness-compose.yml, and the compose file mounted ./stub.sh which was
committed as ...-harness-stub.sh (review 5489757012 #4). Worse, the driver
ignored exit codes — with every Docker call stubbed to return 42 it still exited
0, printing empty before/after values, container replaced: NO and 0.00 s.
Both are fixed and both are pinned by tests
(HarnessIsRunnableAsCommitted): the names now match, a missing artefact is a
named failure, each arm asserts its expected outcome, and the timing ends only
once the new value is verified live rather than when Compose returns. Measured
after the fix: a docker-returns-42 run exits 1 with
FAIL [A-real-grace-210] initial 'up -d' failed, and a run with stub.sh
removed exits 1 naming the missing artefact.