Skip to content

docs: env vars primary config method + cleanup - #15

Merged
ranxianglei merged 1 commit into
masterfrom
2026-08-08_docs-env-primary
Aug 8, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-08-08_docs-env-primary

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Restructures the Configuration section to match how config is actually used: environment variables as the primary/recommended method, JSON file as an optional alternative.

Changes

  • Intro now leads with "env vars (recommended) OR JSON file" + priority (CLI flag > env var > config file > default)
  • Env vars section moved up before Config file (was buried after Routing)
  • Removed 4 stale env vars for the deleted condense feature (ACP_CONDENSE_ENABLED, ACP_KEEP_RECENT_TOOL_RESULTS, ACP_MIN_CHARS_TO_CONDENSE, ACP_MAX_KEPT_CHARS) — that feature was removed in v0.1.4
  • Added missing env vars: ACP_AUTO_UPDATE, ACP_LOG_FILE (added in v0.1.3/v0.1.4 but never documented)

Docs-only, no code change.

…ADME

- Configuration intro now leads with 'env vars (recommended) OR JSON file'
- Environment variables section moved before Config file
- Removed 4 stale condense env vars (feature deleted in v0.1.4)
- Added ACP_AUTO_UPDATE + ACP_LOG_FILE (missing from table)
- Fixed priority order: CLI flag > env var > config file > default
- Move 'Session identity' out of Configuration → new '## How sessions work'
  (it describes proxy behavior, not configuration)
- Add README.zh-CN.md (Chinese translation) with cross-language toggle
  links at the top of both files, mirroring billion-context-pi's pattern
@ranxianglei
ranxianglei force-pushed the 2026-08-08_docs-env-primary branch from ba0a83c to 694350a Compare August 8, 2026 08:30
@ranxianglei
ranxianglei merged commit a9443e6 into master Aug 8, 2026
2 checks passed
@ranxianglei ranxianglei mentioned this pull request Sep 20, 2026
ranxianglei pushed a commit that referenced this pull request Sep 20, 2026
…eam abort (#1064)

Follow-up to round 1 of #1064, addressing the deferred items per owner request.

- #12: clamp anthropic-beta context-Nm window to a finite safety cap so a hostile header cannot drive the effective window (and every compression threshold) toward infinity, while future betas still generalize.

- #13: require the full tail window for reattach adoption; a sub-8 leading run no longer auto-adopts an unrelated stored session by coincidence.

- #10: apply withConversationIdNote to the compress-loop rebuild system prompt so loop re-requests share the same conversation-id anchor as round-1 injection.

- #15: split fetchWithTimeout idle-timer stop from client-abort detachment so splice/continue callers drop the watchdog but keep disconnect-to-cancel.

Each carries a regression test. Gate green on rebased head (typecheck/test/build).
ranxianglei pushed a commit that referenced this pull request Sep 22, 2026
…eam abort (#1064)

Follow-up to round 1 of #1064, addressing the deferred items per owner request.

- #12: clamp anthropic-beta context-Nm window to a finite safety cap so a hostile header cannot drive the effective window (and every compression threshold) toward infinity, while future betas still generalize.

- #13: require the full tail window for reattach adoption; a sub-8 leading run no longer auto-adopts an unrelated stored session by coincidence.

- #10: apply withConversationIdNote to the compress-loop rebuild system prompt so loop re-requests share the same conversation-id anchor as round-1 injection.

- #15: split fetchWithTimeout idle-timer stop from client-abort detachment so splice/continue callers drop the watchdog but keep disconnect-to-cancel.

Each carries a regression test. Gate green on rebased head (typecheck/test/build).
ranxianglei pushed a commit that referenced this pull request Sep 22, 2026
…eam abort (#1064)

Follow-up to round 1 of #1064, addressing the deferred items per owner request.

- #12: clamp anthropic-beta context-Nm window to a finite safety cap so a hostile header cannot drive the effective window (and every compression threshold) toward infinity, while future betas still generalize.

- #13: require the full tail window for reattach adoption; a sub-8 leading run no longer auto-adopts an unrelated stored session by coincidence.

- #10: apply withConversationIdNote to the compress-loop rebuild system prompt so loop re-requests share the same conversation-id anchor as round-1 injection.

- #15: split fetchWithTimeout idle-timer stop from client-abort detachment so splice/continue callers drop the watchdog but keep disconnect-to-cancel.

Each carries a regression test. Gate green on rebased head (typecheck/test/build).
@ranxianglei
ranxianglei deleted the 2026-08-08_docs-env-primary branch October 15, 2026 05:31
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…order-safe — KDD #15 lands with PR #5469 itself, so name that PR explicitly
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…ew list) (#5403/#5418)

Owner identity ladder msgid>order>hash (#11) applied to the watermark lane: a
bare count pins the boundary by POSITION only, so when our shim is in the loop
the request now additionally carries the HOST's own message ids for the window
— element K-1 (the previous turn's anchor) plus every NEW element, per-segment
percent-encoded (separator commas literal, in-id commas as %2C).

Hosts don't put ids in chat-completions bodies; the injected extension reads
them from host context (dispatchScope.msgIds, the same all-or-nothing screening
as the incremental envelope #4491) and echoes them — no host release required.
Absent header = pure count mode: every pre-v2 behavior unchanged.

Server verdicts: bad length / duplicate / undecodable segment => CREDITED shape
fault (shim<->proxy desync, counts toward the breaker); prevId != stored anchor
=> UNcredited (a legit in-place rewrite of the user's own last message) with
self-heal on the next growth via the legacy reseed. Anchor continuity rides the
persisted pf:state list across restarts; the stored list tracks hit turns.

Also repairs the A/B golden's latent flake class: its triage dump wrote to
"${tmpdir()}pfab-diff-..." with tmpdir bound to os.tmpdir (a FUNCTION), so any
real divergence crashed the file write with EACCES on "/pfab-diff-..." — the
root cause of every "flaky after touching the test file" failure this week.

Tests: +6 unit rows (chain/self-heal, shape faults incl. breaker re-arm, comma
roundtrip); the e2e hermetic client now mints content-hash ids per element and
sends the channel every stamped turn (the corpus' t=4 image edit exercises the
prevId-break path for real); upstream-leak assertion extended. Docs: KDD #15,
technical notes en/zh (v2 channel + trust-boundary refinement).
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…otes en/zh (#5403/#5418)

Owner question: can watermark fastpath and the incremental lane both be ON?
Yes — they partition by request shape per turn (incremental divert =
anthropic wire only per #3433; #5403's chat-completions sessions are exactly
where incremental never engages), one request walks one path, marker'd
requests skip watermark evaluation, diverted responses carry x-bili-applied-seq
not pf-seq, and the synthetic re-entry header allowlist has no pf-* names.
Documented as complement-not-competitor with the single residual harmless
case (one extra verification round).
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…erage (#5403/#5418)

pi (src/agent/pi.ts) and opencode (src/agent/opencode-native.ts) now echo
the x-bili-pf-seq stamp back as x-bili-pf-count on their next request —
same handshake as the dsh shim, count mode (their header hooks see no
message list, so tail-ids stays dsh-only; absent header is count mode by
design). In-process Map per lane keyed by conversation/session id; stale
entries cost at most one verification round; inline literal header names
(#3482). Server side unchanged (agent-agnostic). Local real-pi
verification: tmux REPL session, sglang openai wire, turn1 no-stamp ->
turn2-4 consecutive 'fastpath HIT T=4/6/8'. Docs: AGENTS.md KDD #15,
TECHNICAL-NOTES en/zh lane-coverage sentences.
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
)

The per-lane echo shims (dsh headersFor / pi SDK listeners / opencode
chat.headers) are replaced by ONE client-side state machine
(src/agent/pf-channel.ts) fed at ONE chokepoint: the globalThis.fetch
intercept stamps x-bili-pf-count / x-bili-pf-tail-ids on every plugin-lane
model request — /bili/-routed branch AND raw-provider-URL rewrite branch
(attach mode, V1 fetch patch) — and learns x-bili-pf-seq back from every
successful response. Lanes differ only in the thin adapter that resolves
THIS request's host ids, all-or-nothing with clear-on-failure (a stale
anchor is worse than no field; the server degrades to count mode):
- dsh: hostMsgIdsOf off the dispatch scope (unchanged source, new sink)
- pi: shared entry walker both families — anthropic laneMsgIdsForWire,
  new laneMsgIdsForOpenAiWire (chat-completions); its config-assembled
  leading system|developer slots own no branch entry and ride position-
  pinned synthetic tokens bili-ps-N so the chain survives the first
  system element and still breaks honestly when a slot moves
- opencode: reuses the validated list the messages-transform hook already
  aligns for the incremental envelope (#4491)

Docs: AGENTS.md KDD #15 + TECHNICAL-NOTES en/zh rewritten to the unified-
channel doctrine (the old 'only dsh emits tail-ids' coverage note is gone).
Tests: tests/pf-channel.test.ts (state machine + chokepoint e2e + openai
resolver), tsc/build clean, targeted suites green (fastpath trio+intercept
193, lanes 54+16, e2e A/B golden, pf-channel 10).
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…ct (#5403/#5418)

The unified channel doctrine (pf-channel.ts module doc, KDD #15) says a
FAILED id resolution CLEARS the stored list so an unprovable turn degrades
to count mode instead of riding a stale anchor. pi and opencode follow it
(undefined flows into pfCaptureIds, which clears); dsh skipped the call on
undefined, leaving the previous turn's list in place. The length gate made
that benign in practice, but it contradicted the documented contract and
relied on subtle reasoning instead of the stated semantics. Call unconditionally.
ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…emantics (#5403/#5418 v3)

Two doc-accuracy fixes after the placeholder refactor:
- KDD #15 still carried the blanket 'all-or-nothing: a failed verification
  clears the stored list' sentence, which the owner ruling reversed for dsh's
  per-slot capture (only a wholly unresolvable list clears). Reworded to name
  pi/opencode as the all-or-nothing walkers with dsh exempt, matching
  TECHNICAL-NOTES. Also added the missing ';' between the pfSlotIdsOf clause
  and the pi clause.
- TECHNICAL-NOTES.md: sentence-initial lowercase 'the' after the lane-coverage
  enumeration.
ranxianglei pushed a commit that referenced this pull request Nov 2, 2026
…e-start case (#5403/#5418 v4)

Review fix-up (doc accuracy = defect class):
- TECHNICAL-NOTES.zh-CN.md carried no v4 clause at all while the en notes
  and KDD #15 were updated — hit condition, fail-soft list and trust
  boundary paragraphs now mirror the en wording (ledger-derived K,
  demoted echo, non-positive-width shrink catch, zero-delta no-progress).
- TECHNICAL-NOTES.md: sentence-initial lowercase 'the' after the inserted
  v4 block ('...strictly less than T). the first HEAD_CHECK_ELEMENTS').
ranxianglei added a commit that referenced this pull request Nov 2, 2026
…stamp points, with a regression pin (#5403/#5418)

7aa43e6 fixed the silent gap (dsh profile bundles dialing the proxy root never seeded the channel) but the KDD/note wording still enumerated only the /bili/ route and the URL rewrite branches — exactly the blind spot that let it ship. All three emit sites are named now (AGENTS.md KDD #15, TECHNICAL-NOTES en/zh), and the self branch gets a hermetic pin: a self-addressed plugin-lane request carries the learned x-bili-pf-count and learns back the response stamp symmetrically.

Verified locally: tests/native-intercept.test.ts 67/67, fastpath suites 153/153, tsc clean.
ranxianglei pushed a commit that referenced this pull request Nov 2, 2026
… — openai turns keep the shared hook's list (#5403/#5418)

Review fix-up for 2a4ba26. Moving the capture above the divert gate made
ompIncrementalBeforeSend re-screen OPENAI-shaped bodies with ompTurnMsgIds —
but that resolver's strict count+role proof cannot bridge the
config-assembled leading system|developer run of real egress (no branch
entry ⇒ guaranteed length mismatch ⇒ undefined). This planner runs AFTER
the shared before_provider_request capture (pi.ts) for the SAME conversation
id (prompt_cache_key === sessionIdOf), so every real openai turn now CLEARS
the position-aware list (bili-ps-N tokens) that laneMsgIdsForOpenAiWire set
moments earlier: the commit's stated benefit ('openai-shaped turns land ids
for the first time') is unreachable through this line, and its failure mode
erases a working channel instead of degrading to it.

The guard restores the pre-2a4ba262d behavior exactly: the fetch layer
re-screens only anthropic-wire turns (its proven domain, where it stays the
last word on the actually-sent bytes); openai-wire turns are covered by the
shared hook's openai resolver alone. The two harness rows now pin both
directions of the gate (#3617): a perfectly-matching openai hint still does
NOT land via the fetch layer, and an unpairable openai turn leaves an
anthropic-landed list intact (no clobber). Docs (KDD #15 + notes en/zh)
corrected to match.
ranxianglei pushed a commit that referenced this pull request Nov 5, 2026
…ping never reaches the model

Review follow-up for #5658. The copy-all header forwarding introduced by the
credential fix carries every client header through buildForwardTarget, which
strips only UPSTREAM_HOP_HEADERS — and x-bili-turn-id was not in that set. The
native plugins stamp x-bili-turn-id on a diverted model request alongside
x-bili-plugin-turn to correlate the applied-seq ack, so it leaked onto the
upstream request despite being pure host<->bili bookkeeping (same class as the
x-bili-pf-* handshake headers, KDD #15).

Add x-bili-turn-id to UPSTREAM_HOP_HEADERS so it is dropped at every egress
site (HTTP forward + WS lane), mirroring pf-*/x-bili-passthrough. Strengthen
tests/issue5658 to send x-bili-turn-id on both entry points (direct turn and
marker-divert) and assert it never reaches the upstream; previously the client
never sent it, so the assertion was tautological. Negative control confirms both
cases fail without the UPSTREAM_HOP_HEADERS entry. No user-visible change (a
random correlation id the model ignores); closes the gap between the PR's stated
intent and its implementation.
ranxianglei added a commit to feriaref/billion-context that referenced this pull request Nov 23, 2026
…root, refresh stale rollout text

- .pr-body.md, .ci6785-final.txt, .comment-7439.md, .reply-7439.md were
  working notes that slipped into the hand-resolved merge of ranxianglei#6785.
- "KDD ranxianglei#21/ranxianglei#21" -> "KDD ranxianglei#21/ranxianglei#22" in four docs.
- pluginFullResendWatermark is on by default since 2026-11-22 (owner
  ruling); AGENTS.md, design-decisions.md KDD ranxianglei#15, the PR ranxianglei#6785 doc table
  and the web config label still said 5% / experimental.
ranxianglei added a commit to RayDutchman/billion-context that referenced this pull request Nov 29, 2026
…26-11-29, ranxianglei#7960)

After the 2026-11-22 GA (PR ranxianglei#6785), one-shot host injections (pi-lens
turn-end context) left a stale seed the 8-element head check cannot see;
the fastpath mis-hit rendered an orphaned tool result and upstream 400s
(ranxianglei#7960), with unconfirmed cache-reuse collapse reports on the same
count-preserving prefix-drift trust boundary. PR ranxianglei#7962 fixes only the
tool-pairing shape, so the fastpath defaults OFF again until detection
widens: every turn goes through the legacy full-parse path (byte-identical
to v0.1.216 behavior). Opt-in unchanged: rollout.features
pluginFullResendWatermark true / BILI_ROLLOUT_PLUGIN_FULL_RESEND_WATERMARK=1
/ web quick-config ON. Explicit config overrides are untouched.

Docs synced (configuration x3, egress-plane, deprecations, KDD ranxianglei#15
addendum, web i18n x3); pinned test re-pinned 100 -> 0
(tests/wm-fastpath-intro-notice.test.ts); issue7857 test now forces the
flag on via env since its deferred-parse gate is behind the feature.
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