- config.example.json shipped agentsR='' (present-but-empty), which the
jget/:-/|| chain treats as unset-inherited from GATE_AGENTS — Lane R
would run the full P agent set, hit 'unsupported lane' and false-red
after paying for six agents of real-model turns. Example now ships the
launcher default dsh,pi, matching _doc_agentsR.
- entrypoint.sh: rm the per-run rc files before launching the concurrent
subshells — a stale .rc-plugins/.rc-restart in a persistent outDir
could be read back if the subshell died before its final echo, a
failure direction that HIDEs a red in release verification.
- both READMEs: the dsh-variants opt-in sentence still listed dsh-google
(now in the default set), and laneScript/snapshotRender were missing
from the config-key lists (they only had _doc_* in the example).
buildCorpus() produces a 441-line file, but the t1 recipe said "~1300
lines". Most models ignored the mismatch; opencode/codex occasionally
flagged it ("the file is only 441 lines, but the task says ~1300") and
wasted the turn, red-ing S40/S07 t1 (2026-11-16 gate run 4). Quote the
actual count instead.
cleanEnv() strips BILI_* from the lane spawn env by design, so
BILI_ROLLOUT_SNAPSHOT_RENDER set container-wide still resolved to
off(bucket) in every lane (verified in the #6785 gate run: rollout line
showed snapshotRender=off(bucket, 7206/10000 vs 0bp) with the env set).
The knob now writes rollout.features.snapshotRender=true into the P/R
lane bili.json — the config tier the rollout resolver honors above
bucketing. GATE_SNAPSHOT_RENDER stays harness-internal; the proxy never
sees it.
The snapBase storage substrate reaches the R lanes via the bundled
restart-lanes.mjs, but the P lanes prefer the candidate checkout OWN
plugin-lanes.mjs — which predates the GATE_SNAPBASE knob, so P ran
off-state in candidate-branch verification. laneScript forces the
bundled copy (the entrypoint already supports GATE_LANE_SCRIPT for
exactly this). snapshotRender flips BILI_ROLLOUT_SNAPSHOT_RENDER
(env tier > 0% rollout) so the egress BODY plane renders live —
without it storage.snapBase only exercises the v2 substrate, not the
body path the verification is actually after. Both keys documented in
config.example.json.
config.example.json gains the key with a _doc_snapBase line; README en/zh
config-key lists gain the entry: P/R lanes only, "all" or protocol
cohort subset, absent/off = byte-identical gate.
The 8-line GATE_SNAPBASE mapping was copy-pasted into both lane scripts.
restart-lanes.mjs already imports buildCorpus/CODEWORDS from
plugin-lanes.mjs, so the function now lives in one place (exported) and
is imported — same knob, same bili.json surface, no second copy to drift.
The snapBase env append landed in the config-parse block, but RUN is
(re)initialized with 'RUN=(docker run --rm ...)' further down, which
replaces the whole array — so GATE_SNAPBASE never reached the container
and the switch could never turn the plane on. Move the append to right
after the RUN init, alongside the other -e flags.
Verified via --dry-run: with snapBase set the docker command now carries
GATE_SNAPBASE (all / subset values); without it, nothing changes.
Config key "snapBase" on bili-gate.sh --config ("all" = every protocol
cohort, or a comma list of openai,responses,anthropic,google) sets
GATE_SNAPBASE in the container; plugin-lanes and restart-lanes then add
storage.snapBase to the bili.json every lane proxy reads. Unset/off keeps
the gate byte-identical (plane default-off). Needed to validate #6785's
egress snapshot plane end-to-end against real clients.
bili's window lookup is keyed by the model id the CLIENT requests
(resolveModelEntry in src/server/handle.ts). The claude lane's bili.json
map only carried the upstream MODEL1 ids, so claude-code's own ids
(claude-sonnet-4-5-*/claude-haiku-4-5-*) missed it: configured=none,
source=registry-peek 200k, the small window never applied and every fold
assertion ran against raw history (2026-11-15 clauder validation run:
15/18, the 3 reds were all 'no fold fired').
Harvest the real ids from the [window] log lines before each window
rewrite (same mechanism as plugin-lanes' harvestWireModels), so both
claude's main and background model ids carry the gate window.
The claude (anthropic-wire) lane landed in this PR but the file-header
protocol block still read "dsh headless, pi" / "Per agent (dsh, pi)" and
claimed the hostile mid-turn variant runs per agent (it is dsh-only in code).
Header now names claude, notes its R0/R1-only harness-re-established matrix,
and the GATE_R_CONC comment drops the stale "both agents" phrasing.
Comments only — no behavior change.
restart-lanes.mjs imports { buildCorpus, CODEWORDS } from plugin-lanes.mjs;
the unguarded top-level main() re-ran the whole P-lane suite inside the
restart-lanes process (GATE_AGENTS there = dsh,pi), in the SAME $WORK lane
dirs: two npm -g installs into one prefix -> ENOTEMPTY, a sibling pi
recorder killed via the shared instance registry (503 connect-refused on
pi t2-t4), and the side-effect suite's process.exit(1) became the R
process's exit code. Every containerized gate run since the in-repo move
was contaminated; the 2026-11-15 concurrent verification run's wall time
(39.5min) included doubled model load in the R phase.
Coverage follow-up (PR#6793 review, owner asked: 协议是否齐全/场景/客户端):
1) Lane R gains a claude agent (opt-in via agentsR): the first non-openai
CLIENT-SIDE wire through the deep restart scenario. Prefix topology —
claude-code speaks anthropic over HTTP to a harness-managed bili proxy
child (-> recorder -> model); the small window is bili-side (provider
context + proxy restart, prefix-lane rule) at 32768 (claude's
unfoldable floor sits near the wall — Lane P lesson). Kill matrix:
the proxy is killed via SIGTERM/SIGKILL and re-established on the SAME
port by the harness (nothing auto-respawns a manually started proxy);
each respawn must resume the session, outbound stays compact AND
non-empty, exactly one live proxy (no split-brain). Every turn also
gets the 600s budget (claude small-window preflight is a multi-stage
distillation; the 300s budget SIGTERMs mid-preflight — Lane P lesson).
2) dsh-google joins the default Lane P matrix: the google-generative-ai
client door now runs in every gate (the harness lane + wire assertions
already existed; it just was never in the default set).
Also: restart-lanes setHostWindow is now async (the claude window flip
restarts the proxy and must complete before the next turn); the claude
proxy handle is hoisted to lane scope so teardown always reaps it; stale
duplicate comment removed.
Without an agentsR key in the local config the launcher exported
GATE_AGENTS_R="" — and the entrypoint's
${GATE_AGENTS_R:-${GATE_AGENTS:-dsh,pi}} fallback then fed the FULL
plugin-lane agent list (5 agents) into restart-lanes, which only
supports dsh and pi ("unsupported lane" reds). Default it to dsh,pi.
The PR's GATE_CONCURRENT / GATE_P_CONC / GATE_R_CONC are read inside the
container but were never passed through by the host launcher, so the
documented GATE_CONCURRENT=0 escape hatch (pristine cache isolation to
re-check a false-red R cache-recovery assertion under concurrency) was
unreachable via the standard bili-gate.sh path. Pass the three vars straight
into the container with the same defaults the entrypoint / lane scripts
already use (no default-behavior change), and document them in the gate
README (en + zh).
Review fix for #6810.
The gate ran everything serially (~45-50 min wall), but the shared
upstream (sglang / relay) comfortably takes ~6 concurrent consumers and
the lanes are fully independent: per-lane recorder ports, per-lane XDG
dirs, per-agent BILI_ZONE_PORT ladders (restart lanes already hash with
a distinct prefix).
- plugin-lanes: agents now run through a worker pool (GATE_P_CONC,
default 4) instead of a serial for-loop.
- restart-lanes: same (GATE_R_CONC, default 2 = both agents at once).
- entrypoint: sections 5.5 (P) and 5.7 (R) launch side by side and wait
on both; their internal pools keep total in-flight model consumers at
~6. Lane I/X still runs after: its publish flips the in-container
registry's latest tag, which must not race the P/R lanes' update
probes (Lane U's assertion already ran in section 5).
- GATE_CONCURRENT=0 restores the legacy serial order for
measurement-sensitive runs (cache-isolation fallback).
- per-lane recorder handle map replaces the process-global activeRec.
- entrypoint: chown /work to GATE_UID:GATE_GID at the end (bili-gate.sh
passes the invoking user) — lane logs/sessions were root-owned 0600 and
unreadable on the host, which blocked post-run diagnosis (2026-11-15)
- restart-lanes t3: one retry before the post-fold bound check. The client's
(dsh/pi-ai) proactive overflow fold is estimated-tokens based and wobbles:
measured same fixture fold-fires on one run, raw send + client-side
CONTEXT_WINDOW_EXCEEDED on the next (also the 11-03 signature). bili's
engine folds correctly whenever the client asks (99% shrink in the green
run); the retry mirrors the existing t2 needle-retry policy and also
prevents the post-kill continuation cascade from one wobbled turn.
The entrypoint exported GATE_SKIP but release-gate-local.mjs only reads the
--skip CLI flag — so --skip a/b/u was a silent no-op (observed live: a run
launched with GATE_SKIP=a,b,u still executed all three lanes). The P/R/I/X
scripts DO read GATE_SKIP themselves, so only the a/b/u subset needed
forwarding. Observed in the 2026-11-15 0.1.215 full-gate run.
Review follow-ups on this PR:
- restart-lanes: the lane contract (header + README) says the cache-hit
recovery ratio is asserted 'whenever the upstream reports usage
details' and is evidence-only when it does not — but the code recorded
ok=false in the no-pair case, turning an upstream that strips usage
details (environment fact, same class as Lane P's ENV-BLOCKED demotion)
into a red lane. Now: ZERO usage records on the wire → evidence-only,
out of the tally; usage present but no prev-prompt/next-cached pair →
the cache plainly did not recover, stays red.
- bili-gate.sh: the config JSON was passed through "$(cat ...)" argv to
node -e, exposing any apiKey values in ps during the parse window.
The path is passed and node reads the file itself.
The jget() helper was meant to treat model1.baseUrl / model1.model as
required (no default arg) and fail before the docker build, but the
unset-$2 default collapsed to "" (a string), so node's argv[3] was never
undefined and the process.exit(3) required branch was dead code. A config
missing model1.baseUrl silently produced MODEL1_BASE_URL= and proceeded to
a full image build before the container entrypoint caught it.
Pass an explicit has-default flag so a missing required key now fails fast
with the documented FATAL message (exit 2). Optional keys (all called with
a default) are unaffected.
Review fix for #6798 (小问题直接修).
The full real-model gate (A compression / B model switch / U registry /
I install / X auto-update / P host-plugin lanes / R restart kill matrix)
moves into this repo so the lane logic versions with the code under test
and remote CI can run the SAME scripts from the candidate checkout.
Lanes I/X/R and the A/B model calls need a real model endpoint, so they
remain operator-run via the new launcher; ci-gate-plugins.yml keeps
driving Lane P.
- Dockerfile: node:22-slim + the host CLIs pinned to the versions this
repo's own CI uses (dsh / pi / codex / opencode / claude / opencode-v1)
- entrypoint.sh: build the candidate rev, in-container ephemeral verdaccio
(lanes U/I/X, no host registry dependency), keyed-API shims, then run
release-gate-local (A/B/U) + plugin-lanes (P) + restart-lanes (R) +
docker-lanes (I/X) and roll up one GREEN/RED
- docker-lanes.mjs / restart-lanes.mjs / patch-gate.mjs /
verdaccio.config.yaml: the lane drivers and shims
- bili-gate.sh: config-driven launcher — scripts/gate/bili-gate.sh
--config <path> [--rev REF] [--skip ...] [--keep] [--dry-run]. ALL
host-specific facts (model endpoints, API keys, npm registry, git
proxy/mirror, out dir) live in the local JSON config only; nothing
machine-specific is committed here (config.example.json is
placeholders). The stale-image guard from the old host wrapper comes
along: on build failure the existing image is reused only after
byte-comparing every /gate-tools lane script, drift = FATAL.
- README(.zh-CN): full lane table + the endpoint/secret contract +
how-to-run; the old 'the containerized wrapper lives outside this repo'
section is retired
plugin-lanes.mjs — bring the lane script forward to the state that ran the
#6552 full gate (the repo copy predated it):
- plugin claim is read from the sessions index.db metadata FIRST and the
JSONL envelope scan is kept only as a fallback. Pure-SQLite has been the
storage default since 2026-11-13, so JSONL-only claim checks could go red
on a perfectly healthy session (that is exactly what the #6552 gate
review found — the data sat in index.db while the lane asserted on the
JSONL that was never written).
- CODEWORDS / buildCorpus are exported: restart-lanes.mjs reuses the same
corpus generator (commit 2).
- requireSync via createRequire (node:sqlite is loaded lazily, only when a
candidate session actually has an index.db).
- keep the recorder-spawn comment for the 2026-11-14 wedged-tee fix.
upstream-recorder.mjs — record a capped 256KiB rolling tail of each response
body plus per-request ms: usage / cached_tokens live in the FINAL stream
chunk, and Lane R's cache-hit assertions read them from the recorded tail.
Sensitive headers (authorization / x-api-key / cookie / ...) stay masked —
bili forwards the model API key into this hop on every request.
The recorder was spawned with stdio ['ignore','ignore','inherit'] and
detached:true. When a lane aborted before its own teardown, the detached
recorder kept the inherited stderr open — which, in the entrypoint's
'| tee lane.log' pipeline, is the very pipe the entrypoint waits on.
The whole gate then sat in do_wait until someone killed the recorder
(observed 2026-11-14: master candidate run wedged 3h after the restart
lanes; I/X never ran).
- stderr goes to a per-lane recorder.stderr.log instead of the lane's
inherited log pipe (a leaked recorder is now harmless).
- main()'s per-agent catch SIGKILLs the in-flight recorder so aborted
lanes do not leave orphans behind.
scripts/gate/plugin-lanes.mjs carries the identical folded-recall prompt at t2 (:395) and t4 (:473) — same "Without reading any file again" wording the local gate fixed in 9bae4fae9. Plugin lanes drive real host CLIs (dsh/pi/codex/claude/opencode), whose models can equally detour into search_context/decompress/shell during the recall turn and leave an empty final, false-reding the assertion (#4028). Apply the same hard constraint so the mechanism family is closed in one PR (#4028, found during #4029 review).
t3/t4 at the derived small window trigger a multi-stage distillation
(observed 297s of local preflight work for a 170KiB history — the #3452
first-sight marathon shape); the shared 300s turn budget SIGTERMs the
CLI mid-preflight (turn artifacts empty, 'summarization aborted: client
disconnected'). 600s keeps the lane asserting the fold path itself
instead of racing the summarizer.
Extend the dsh gate lanes from one protocol to all four pi-ai protocols
(openai-completions / openai-responses / anthropic-messages /
google-generative-ai) plus a dsh proxy-mode lane for same-host
two-activation-path contrast. Same headless driver and corpus flow; only
the cordis provider api + baseURL suffix differ per lane.
- per-door WIRE_EXPECT hard assertion: every recorder POST must match the
door path regex AND body top-level shape; first request dumped to
egress-sample.json as round-trip evidence
- blocked semantics: ENV-BLOCKED (door unhealthy: all-rejected or degraded
mid-flow, opencode2/#3461 rule) and CLIENT-BLOCKED (client config surface
cannot express the api yet — dsh's cordis schema lists no
google-generative-ai in 0.2.0-rc.2 / 0.2.1-rc.1); excluded from tally,
printed at exit
- calibration fixes from real-model runs: GATE_OUTPUT_TOKENS (thinking
models degenerate when output budget < thinking budget), p1 = max over
full post-t1 log, post-fold small-window widening for adaptive recipes,
mid-seed guard, lane-local dsh install (GATE_DSH_VERSION) + lane TMPDIR
- t1 dual marker (S40+S07): verify the read precondition so downstream
S07 recalls can't fail for fixture reasons
Existing lanes' generated configs are byte-identical to pre-#3475
(parity harness); new lanes are GATE_AGENTS opt-in. Local real-model run:
56/56 passed (dsh-responses:env, dsh-google:client).
scripts/gate/README.md becomes the English document (repo docs are
English-first); the previous Chinese text moves verbatim to
README.zh-CN.md, cross-linked from both headers. Ref #3475.
- seed mid from the biggest t1 request body on the wire (idle log lines
lag the corpus read; a stale line put dsh t2 at 285% usage and the
EMERGENCY nudge rode a fail-fast 502 that never forwarded)
- t2 retry: up to 3 attempts, require in-band + ok + non-empty + the
S07 marker (wrong-marker answers get one cheap retry)
- dsh setWindow rewrite all contextWindow entries (multi-model cordis)
- opencode v1 bin honors GATE_OC1_BIN (image installs it as opencode-v1;
plain 'opencode' resolves to the v2 line whose managed service fights
the port and crashes at cli.server-connect)
- BILI_ZONE_PORT per native lane (19000+hash): a leftover proxy on the
default 18787 can no longer capture a lane or force a mid-run drift
- BILI_MODEL_INFO_RETRY_MS=1000: the dsh native plugin's boot-time
model-info resolve races the host's provider-adapter registration
("no adapter registered"), and the failure shape eats a 30s cooldown —
longer than a whole short headless turn; 1s retry + a leading cheap
bash tool call per prompt (warmupPrefix) guarantees request #2+ lands
with the x-bili-plugin-context-window header stamped
- t3/t4 retry loop (2x) absorbs tag-echo-only empty replies
The recorder logged every request header verbatim; bili forwards the model API key into this hop on every request, so the key landed in upstream.jsonl on disk. Mask authorization/proxy-authorization/cookie/x-api-key/api-key values, and warn once on stderr if the JSONL cannot be written instead of swallowing it silently.
scripts/gate/plugin-lanes.mjs + upstream-recorder.mjs: drive dsh/pi/codex/
claude/opencode through native and /bili/ prefix lanes against a real model,
asserting on the recorded wire (tools declared, hard nudge-on-wire, fold,
marker recall, no unknown-tool loops). ci-gate-plugins.yml is manual-only
(workflow_dispatch, no push/PR trigger, skips green without an endpoint
secret). Container harness stays out of the repo.