Repository navigation
Model: qwen3.8-27b — feat: codex compression-budget coordination (PR-D/E1/C/E2) - #326
ranxianglei wants to merge 1 commit into
Conversation
PR-D: bili codex launcher injects -c model_context_window /
model_auto_compact_token_limit from bili's effective window (single
source of truth shared with the server pipeline), so codex's
auto-compact ledger aligns with bili and ACP fires first.
PR-E1: bundled codex model-table snapshot (scripts/update-codex-models-snapshot.mjs,
same refresh pattern as registry-snapshot); when the client is codex
(x-codex-turn-metadata header) and the model is in the table, the
effective window clamps to min(bili window, codex table).
PR-C: semantic rebasing gate — the native-compaction boundary is now
marked only on a confirmed response.completed (SSE observer / JSON
parse); failed/incomplete/truncated/empty-body outcomes leave ACP
state untouched. Trigger-final requests take a read-only projection
(no kernel state mutation, no injections, no preflight).
PR-E2: conditional interception + forge (kill-switch
BILI_CODEX_COMPACT=intercept, default pass). When ACP state is
healthy, codex compaction requests (trailing compaction_trigger or
/responses/compact) are answered locally: V2 SSE with a single
compaction item + response.completed, or V1 JSON {output:[compaction]}.
The ACP summary is recorded by forged item id and replayed as a
developer message on the next request, giving a deterministic handoff.
Unhealthy ACP passes through to native compaction (PR-C gates the
rebase correctly).
Tests: tests/codex-compact-coordination.test.ts (12 unit + 11 e2e).
Full suite 763/763, typecheck + build clean.
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-326Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr326.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] 收到。PR #326(分支 |
[bot] Independent verification of PR #326 (branch Pre-flight (re-run by me, all pass)
Code review — all four PRs meet #320 acceptance
Codex wire contract — verified against source (/tmp/codex-src)I checked the forged format against codex's actual parsers:
Tests — 23 total, comprehensiveCoverage maps cleanly to #320: kill-switch pass/intercept, V2+V1 forge, unhealthy/over-limit/non-codex pass-through, PR-C's five terminal states, and E1 clamp-vs-control. The e2e forge test simulates codex's next turn by sending the compaction item in the input (mock-level, matching the PR's stated scope — real codex serialization is the real-machine follow-up).
CI status — 5/6 green, 1 flaky cell
Recommendation
Bottom line: the code, contract, and tests are solid and meet #320's acceptance criteria. The only open item is the flaky windows/22 CI cell, which is pre-existing on master and should clear on re-run. I won't merge (human-only per AGENTS.md) — please re-run the check and merge when green. |
- custom type acp-nudge (was bili-nudge); compact one-liner [ACP nudge] <pct>% · T<tier>[ EMERGENCY][ · top range a–b] - the compact record line is ALWAYS on (no debug config needed): one per user turn, persistent in the session file, pi-visible / model-invisible (type:custom never enters LLM context) - the verbatim wire text becomes a transient terminal notification (debug switch on: ACP_DEBUG / config debug), shown once per turn after the model answered — never persisted - dedup per (session, turn) via a stable key of the last text user message (anthropic tool_result user messages skipped) - bus events carry the record metadata (pct/tier/emergency/topRange/ turnKey); emitters compute it from the PRE-nudge array
…otify only Per owner review: the always-on compact record line (acp-nudge CustomEntry, billion-context-pi #326 parity) is unnecessary — the transient verbatim terminal notification (debug switch on) is the whole point of this feature. - src/agent/pi.ts: no more registerEntryRenderer/appendEntry wiring; one after_provider_response hook shows the verbatim wire text once per user turn via ctx.ui.notify (consumes+clears the pending event, turnKey dedup) - src/nudge-debug.ts: drop ACP_NUDGE_CUSTOM_TYPE + formatNudgeRecord - tests: wiring test asserts the pi host carries exactly one extra after_provider_response subscription vs omp (the #3248 ack channel subscribes both lanes); formatNudgeRecord test removed - docs en+zh, architecture.md: transient notify only, never persisted
Model: qwen3.8-27b
Closes #320.
What changed
PR-D — launcher budget coordination.
bili codexnow injects-c model_context_window=<N>and-c model_auto_compact_token_limit=<N>(same value; codex internally clamps the compact limit to min(configured, 90% x window)). N comes from the same window-resolution chain the server uses —resolveStaticWindow(model, host, routes, upstream, launcherWindows)= launcher windows > registry peek > per-route config > model table — so the launcher and the proxy can never disagree. The value is additionally clamped to codex's own model table (codexModelWindow) so bili never tells codex a window bigger than codex assumes. Logged as[bili] codex budget: model=... window=... (source=...).PR-E1 — anonymous-mode window clamp. Bundled codex model-table snapshot (
src/codex-models-snapshot.json, 10 models, generated from openai/codexcodex-rs/models-manager/models.jsonvianpm run codex:snapshot— same refresh pattern as the models.dev registry snapshot). When the request carries the codex client header (x-codex-turn-metadata) and the model is in the table, the effective window clamps tomin(bili window, codex table)(applyCodexWindowClamp). Model not in table → codex has no knowledge → no clamp.PR-C — semantic rebasing gate. The native-compaction boundary is now marked only on a confirmed success: SSE streams are observed for the terminal event (
response.completed→ mark;response.failed/response.incomplete→ no mark; stream end without terminal → unknown → no mark), non-SSE JSON bodies are buffered and parsed (2xx + parseable → mark), and empty-body 2xx no longer marks (previously any 2xx did — the #249 bug). Trigger-final requests now take a read-only projection: sanitized original input, no kernel state mutation, no compress prompt/tools, no nudge, no preflight.PR-E2 — conditional interception + forge (kill-switch
BILI_CODEX_COMPACT=intercept, defaultpass). When the switch is on, the client is codex, the request is a compaction request (trailingcompaction_triggeror/responses/compact), and ACP state is healthy (steady-state usage below the window AND compression state exists), bili answers locally instead of forwarding: V2 → SSE with exactly onecompactionoutput item +response.completed; V1 → JSON{output:[compaction item]}(contract verified against codex'scollect_compaction_output/ResponseCompletedparsers). The ACP summary is recorded under the forged item id (bounded map) and replayed as a developer message on the next request — deterministic handoff, no boundary heuristics. Unhealthy ACP (or non-codex, or switch off) passes through to native compaction, where PR-C gates the rebase correctly.Pre-flight
tests/codex-compact-coordination.test.ts: 12 unit + 11 e2e covering kill-switch pass/intercept, V2+V1 forge, unhealthy/over-limit/non-codex pass-through, PR-C completed/failed/incomplete/truncated/empty-body, PR-E1 clamp vs control).npm run typecheckclean;npm run buildclean (snapshot JSON inlined into dist).t.after+closeAllConnectionspattern deadlocked against the proxy's pooled upstream connections.Notes
intercept— mock-upstream validation is in this PR.Feature::TokenBudget(UnderDevelopment, default off) tracked as an observation item per the issue.