parseArgs records the -s pin in overrides, but the launch path skips the
generic env merge the start/update lanes use, so BILI_PI_INLINE=0 never
reached the child: with an ambient BILI_PI_INLINE=1 (shell export, alias, or
a nested bili session), 'bili -s pi' still flipped onto the inline lane and
the launcher proxy idled — the exact case the flag documents defeating.
applyPosturePins mirrors the env merge for the two posture keys in
runLaunch/runTestPi; a regression test pins the parse-to-env delivery.
The misuse test asserted exit code 2 but its per-case message regexes
were never matched against anything (assert.ok(re) is always true).
Capture console.error and assert.match each case's actual message.
Human surface for the inline default: nobody types BILI_PI_INLINE=0.
bili -i pi == bili pi-inline (forced inline: env scrub + extension
preflight + BILI_PI_INLINE=1 preset, no proxy spawned)
bili -s pi proxy posture pinned: child gets BILI_PI_INLINE=0 so an
inherited/ambient inline env can't flip it while the
launcher proxy runs
Flags must PRECEDE the client name (everything after the client token
is forwarded verbatim — bili pi -i stays pi's own flag). opencode maps
the same way (-i -> opencode-inline, -s -> BILI_OPENCODE_INLINE=0).
Misuse exits 2 with a pointed message: other lanes, -s on the inline
lane, -i+-s together, or a posture without a client.
New read-only diagnostic command 'bili acp-cache diff <dump-dir>': pairs
adjacent same-session requests from ACP_DUMP_BODY dumps (INCOMING = client
wire, REQ = proxy-rebuilt wire) and classifies each pair:
- pure-append prefix stable, growth only at the tail (healthy)
- mid-stream-rewrite first divergent byte inside the shared prefix; reports
byte offset + first divergent message and attributes
proxy vs client vs both by comparing where each side's
wire first diverged (#1249 shape = incoming append +
outgoing mid drift -> proxy)
- prefix-stable-miss outgoing prefix append but provider usage shows the
cached prefix collapsed (--log / bili.log correlation;
upstream TTL/eviction, the unattributed bucket of
acp-kernel#393)
Comparison is two-tier: byte-prefix first, then JSON message-array-aware so
a healthy array append (which moves the closing bracket) is not misread as a
mid-stream rewrite. Output: per-pair lines + worst offenders; --json emits
the machine-readable report. --log FILE / --no-log control usage-log
correlation (default auto-discovers <dump-dir>/bili.log or defaultLogFile()).
Prerequisite fix in the same issue scope: INCOMING dump filenames now carry
the bound session id (<ts>-<sid>-INCOMING.txt; OUTGOING already had it) so
concurrent sessions can be paired; the dump moves from the pre-prepare site
to right after prepare, where the session is bound. Requests rejected before
prepare no longer get an INCOMING dump (they never got a REQ dump either);
legacy session-less INCOMING dumps still parse via timestamp proximity.
Tests: synthetic dump pairs for all three shapes + legacy filenames + usage
alignment + render modes (tests/acp-cache-diff.test.ts), parseArgs cases,
and a full-proxy harness test pinning the new INCOMING filename.
Behavior changes (disclosed):
1. INCOMING body-dump filename: <ts>-INCOMING.txt -> <ts>-<sid>-INCOMING.txt.
Any external tooling keying on the old shape must adapt (none in-repo does;
DUMP_FILE_RE regexes still match).
2. INCOMING dumps now written post-prepare instead of pre-prepare (content and
masking unchanged); pre-prepare rejections (bypass/passthrough/unknown
paths) no longer produce INCOMING dumps.
- Unset upstreamProxyMode now resolves to "direct" (matches the web UI's
直连(默认) and ZCode's default) instead of falling through to env/system
proxy auto-detection. Set mode "auto" to follow the system/env proxy; an
explicit proxy (-F / BILI_UPSTREAM_PROXY / config) still wins regardless.
- Add `-F <url>` (gost-style --forward) to set the upstream proxy for a run;
works for launcher cmds (before the client name) and `start`. HTTP/HTTPS
only for now (SOCKS5 is a follow-up).
- Log the resolved upstream-proxy decision once per unique (host, proxy,
source) — `[upstream-proxy] <host> via <proxy> (source=<source>)` — with
non-public hosts masked (#255), so a silently-picked env proxy is visible.
- Fix the misleading `bili pi --mitm-domain ...` help example (that form
forwarded the flag to the client; the working form is `bili --mitm-domain ... pi`).
Tests: default-direct (unset mode ignores HTTPS_PROXY), auto-mode opt-in
still follows the env proxy, and parseArgs -F placement (before/after client,
start cmd, composition).