276 Commits
Author SHA1 Message Date
ranxianglei 5a99a475ef Merge PR #7285: perf(registry): index relay model suffix candidates 2026-11-20 17:18:26 +08:00
ranxianglei df25acb38b Merge PR #7162: fix: normalize plan text once per source 2026-11-20 17:18:26 +08:00
Afloat cee5b4e081 perf(registry): index relay model suffix candidates 2026-11-19 17:51:45 +08:00
ci-check 7ec502fba7 test: register storage-integrity-cache in LIVE_FILES (SPAWN_RE tripwire, #1248)
The #7156 fix added a spawn to this suite (one bare `node -e` dummy
child as a live PID holder for the <db>.lock fixture in the close-time
cache-refresh gate test). scripts/run-ci-tests.mjs's SPAWN_RE tripwire
(#1248) requires every process-spawning test file to be registered in
scripts/live-files.mjs after reviewing its concurrency assumptions.

Concurrency review: single bare node child (setTimeout 30s backstop),
stdio ignore, no ports, no servers, mkdtemp-isolated per test,
SIGKILL'd in t.after — same pattern as the #5046/#4612 entries, so the
zone band is irrelevant.
2026-11-18 22:46:01 +08:00
Afloat 955af1513c fix: normalize plan text once per source
Reuse the stripped, lowercased plan string across token matches instead of normalizing it for every token. Preserve extraction and search results while avoiding repeated full-text scans on CJK and mixed-language plans.

Add a reproducible benchmark using actual compressed blocks and the plan-aware search entry point.

Fixes ranxianglei/billion-context#7160
2026-11-18 20:42:10 +08:00
Afloat 55d1f69729 test: register the default CA trust child in the CI live-file table
(cherry picked from commit b20d51ae07)
2026-11-18 09:46:06 +08:00
Afloat 16db722f5c perf: consume repeated canonical pointers in linear time
(cherry picked from commit 244d526385)
2026-11-17 23:25:08 +08:00
Afloat 466fdaae58 perf: frame loop SSE chunks in linear time
Preserve existing newline and EOF semantics while scanning only newly
received text in the four SSE loop adapters.

Fixes #6849

(cherry picked from commit 7a1f401b6b)
2026-11-17 23:25:08 +08:00
Afloat 7f3c8c5020 fix: bound retained image encode cache payloads
Fixes ranxianglei/billion-context#6846

(cherry picked from commit c39ace7aab)
2026-11-17 23:25:08 +08:00
Afloat 248221bbdd perf: scan cache body boundaries in linear time
Avoid repeated suffix searches when settling a long transcript and defer
boundary work until append/head checks need it.

Fixes ranxianglei/billion-context#6839

(cherry picked from commit 43dfba5870)
2026-11-17 23:25:08 +08:00
ranxianglei 28f11a09eb fix(gate): agentsR example default, fresh rc files, README knob parity (PR#6938 review)
- 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).
2026-11-16 20:32:17 +08:00
ework-agent aa92494115 fix(gate): t1 prompt quoted the corpus line count dynamically
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.
2026-11-16 18:23:41 +08:00
ework-agent 850f0adf08 fix(gate): snapshotRender knob via config tier — env tier never reaches lane proxies
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.
2026-11-16 17:01:59 +08:00
ework-agent 772af00a4f feat(gate): laneScript + snapshotRender config knobs
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.
2026-11-16 16:59:38 +08:00
ci-check f68f0813bf docs(gate): document the snapBase config key (promised in the PR body)
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.
2026-11-16 14:13:13 +08:00
ci-check 58fa063368 refactor(gate): one gateStorageCfg — export from plugin-lanes, import in restart-lanes
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.
2026-11-16 14:13:13 +08:00
ci-check 977985d2c7 fix(gate): GATE_SNAPBASE was dead — RUN+= before the RUN=(...) init gets wiped by the reassignment
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.
2026-11-16 14:13:13 +08:00
ework-agent 48980eb543 feat(gate): GATE_SNAPBASE knob — run P/R lanes with the candidate's snapBase egress plane
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.
2026-11-16 13:52:29 +08:00
ework-agent 764ab5a9bd fix(gate): claude R-lane window keys must match the client's model ids
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.
2026-11-16 13:39:55 +08:00
ci-check f69e0addd2 docs(gate): sync restart-lanes header protocol doc with the claude lane (PR #6823)
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.
2026-11-15 20:34:00 +08:00
ework-agent da2db8cf66 fix(gate): import-guard plugin-lanes main() — stop restart-lanes double-running the P suite
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.
2026-11-15 20:23:15 +08:00
ework-agent 732d957518 feat(gate): anthropic-wire restart lane (claude) + dsh-google in default matrix
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.
2026-11-15 20:13:00 +08:00
ework-agent 2c6c51ef38 fix(gate): default restart-lane agents to dsh,pi in the launcher
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.
2026-11-15 19:29:56 +08:00
ci-check db25b22737 fix(gate): pass concurrency knobs through bili-gate.sh + document them
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.
2026-11-15 18:17:16 +08:00
ework-agent 57e75a9b94 perf(gate): run plugin (P) + restart (R) lanes concurrently
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.
2026-11-15 17:51:57 +08:00
ework-agent 22f5e1bb1a fix(gate): readable evidence after run + one retry on the R-lane small-window turn
- 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.
2026-11-15 17:29:08 +08:00
ework-agent 268280f02b fix(gate): forward a/b/u skips to release-gate-local as its CLI flag
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.
2026-11-15 15:37:44 +08:00
ework-agent cd817f697e fix(gate): cache-ratio check evidence-only when the upstream reports no usage; keep config off argv
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.
2026-11-15 15:24:48 +08:00
ci-check cf10455b73 fix(gate): make bili-gate.sh required-key check actually fail fast
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 (小问题直接修).
2026-11-15 14:52:27 +08:00
ework-agent 67eeb303aa feat(gate): containerized full real-model gate + config-driven launcher
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
2026-11-15 14:38:50 +08:00
ework-agent d7cd5485e8 fix(gate): plugin-lane claim via index.db, resp-body tail + latency on wire log
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.
2026-11-15 14:38:41 +08:00
ranxianglei 4511559723 Merge Afloat16/2026-11-14_linear-handoff-capture (PR #6748) into batch8-wave8 2026-11-14 22:32:51 +08:00
ranxianglei 224a6cec37 Merge Afloat16/2026-11-14_linear-fold-registration (PR #6747) into batch8-wave8 2026-11-14 22:32:50 +08:00
ranxianglei becb595d24 Merge Afloat16/2026-11-14_join-message-content (PR #6733) into batch8-wave8 2026-11-14 22:32:41 +08:00
Afloat 94ae15f18d perf: avoid repeated fold closure scans within a batch 2026-11-14 22:00:16 +08:00
Afloat 34eb19e584 perf: meter handoff reply deltas incrementally 2026-11-14 21:58:13 +08:00
Afloat a2fa9891b5 perf: batch message content reads without per-row queries 2026-11-14 21:20:52 +08:00
ranxianglei 2221db1c9d Merge Afloat16/2026-11-14_linear-cache-usage-alignment (PR #6722) into batch7-wave7 2026-11-14 20:53:12 +08:00
ranxianglei b07fffaf03 Merge Afloat16/2026-11-14_linear-coverage-timestamps (PR #6716) into batch7-wave7 2026-11-14 20:53:09 +08:00
Afloat c8b86a3f0b perf: align cache usage in a single ordered pass 2026-11-14 20:35:42 +08:00
Afloat 185042eb54 perf: index covered timestamps in compression receipts 2026-11-14 20:09:19 +08:00
ranxianglei 0484d98acc Merge Afloat16/2026-11-14_linear-fork-ref-membership (PR #6683) into batch6-wave6 2026-11-14 19:50:43 +08:00
ranxianglei 33c2f61ac7 Merge Afloat16/2026-11-14_linear-subagent-capture (PR #6668) into batch6-wave6 2026-11-14 19:50:43 +08:00
ranxianglei 76640c7c95 Merge Afloat16/2026-11-14_linear-boot-file-index (PR #6663) into batch6-wave6 2026-11-14 19:50:43 +08:00
Afloat 5a116b3936 perf: reuse the fork prefix index when inheriting ref state 2026-11-14 16:40:53 +08:00
ranxianglei ac2eb2db3c Merge Afloat16/2026-11-12_async-zstd-decode (PR #6489) into batch5-wave5 2026-11-14 16:16:47 +08:00
ranxianglei 6ceebbfd59 Merge Afloat16/2026-11-13_count-active-blocks (PR #6626) into batch5-wave5 2026-11-14 16:15:39 +08:00
ranxianglei d34333666b Merge Afloat16/2026-11-13_join-block-content (PR #6618) into batch5-wave5 2026-11-14 16:15:35 +08:00
ranxianglei 179397be6a Merge Afloat16/2026-11-13_point-session-removal (PR #6615) into batch5-wave5 2026-11-14 16:15:34 +08:00
ranxianglei a27c87d636 Merge Afloat16/2026-11-13_index-fold-image-notes (PR #6612) into batch5-wave5 2026-11-14 16:15:33 +08:00