Repository navigation
native pi e2e (#1239) + fix one-shot stamp race (#1243) - #1246
Merged
Merged
Conversation
A native-lane 'pi -p' fires before_provider_headers exactly once, inside the async proxy bootstrap window: BILLION_CONTEXT_PROXY is not written yet, proxyBaseForCtx() resolves undefined and the handler returns — the x-bili-plugin / x-bili-plugin-conversation headers are never stamped and the session binds anonymous wire mode for the whole process. Reader awaits writer: pi-native registers a NativeOriginWaiter (readyOrigin(state)) with native-bootstrap; the shared factory's before_provider_headers awaits awaitNativeProxyOrigin() whenever the base is unresolved. Hosts without a native entry register no waiter and get an immediate undefined — zero added latency for wire/launcher modes.
…ream (#1239) fake-upstream-chat.mjs: chat-completions fake with scripted tool_calls (marker directives in the last user message, queue-per-user-turn, stream + non-stream) and a JSONL oracle (headers, tools, roles, tool results). e2e-native-pi.test.ts (ACP_TEST_E2E_NATIVE=1): hermetic PI_CODING_AGENT_DIR + XDG + spawn-cwd outside the repo (#815); asserts #1239's acceptance — interception + per-request x-bili-plugin stamp (#1243), /acp exit-clean with a live /__bili/plugin/status endpoint, acp_status executes and returns the status report, compress executes and the fold lands (result string + proxy log + persisted blocks after graceful stop). cleanEnv() must strip NODE_TEST_CONTEXT: the node:test runner exports it into spawned children and pi-native deliberately stands down inside node:test — without this the suite exercises a disabled bootstrap. CI: ci-e2e-native.yml runs the suite on every PR with pi pinned (pi-stable@0.83.6, same discipline as the codex pin #815).
This was referenced Sep 24, 2026
Contributor
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1246Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1246.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Merged
This was referenced Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes the pi-lane gap from #1239 and fixes a real bug the new suite caught immediately.
test: native pi e2e (Refs #1239)
tests/e2e/fake-upstream-chat.mjs— deterministic chat-completions fake: scriptedtool_callsdriven by marker directives in the last user message (请调用<tool>/请调用<tool> {json}), stream + non-stream shapes, JSONL oracle (plugin/conv headers, tools, roles, acp tag counts, tool results).tests/e2e/e2e-native-pi.test.ts(ACP_TEST_E2E_NATIVE=1, zero tokens) — drives the realpiCLI in package-native mode (repo root loaded as a pi package = thebili plugin install pilane) and asserts #1239's acceptance list:x-bili-plugin: pi+ conversation header/acpcommand exits clean and the/__bili/plugin/statusendpoint it consumes answers liveacp_statusexecutes and its result (the status report) is re-sent in historycompressexecutes and compression actually happens: result string reports the fold, proxy logs the plugin-channel execution, persisted session carries ≥1 block after graceful stopMechanics: hermetic
PI_CODING_AGENT_DIR+ XDG + spawn cwd outside the repo (#815); run 1 loads ~7.6KB filler (kernel protected-zone + 5000-char minimum), run 2 (--continue) scripts the compress round. Sessions persist lazily → suite SIGTERMs the hermetic proxy before on-disk assertions.fix: #1243 one-shot stamp race (Fixes #1243)
A native-lane
pi -pfiresbefore_provider_headersexactly once, inside the async proxy-bootstrap window —BILLION_CONTEXT_PROXYnot yet written → nox-bili-pluginstamp → the session binds anonymous wire mode for the whole process (found live while building this suite; verified by the new per-request stamp assertions failing on master and passing with the fix).Reader awaits writer:
pi-nativeregisters aNativeOriginWaiter(readyOrigin(state)) withnative-bootstrap; the shared factory handler awaitsawaitNativeProxyOrigin()when the base is unresolved. No waiter registered (wire/launcher hosts) → immediateundefined, zero added latency.Also documents the
cleanEnv()lesson: the node:test runner exportsNODE_TEST_CONTEXTinto spawned children andpi-native.tsdeliberately stands down inside node:test — the suite must strip it or it exercises a disabled bootstrap.Pre-flight
npm run typecheck✅npm run build✅ (dist restored pristine after canary experiments — verified by diff)ACP_TEST_E2E_NATIVE=1 node --import tsx --test tests/e2e/e2e-native-pi.test.ts→ 4/4 pass, ×4 consecutive runsnpm testhas known sandbox hangs (pre-existing; master same)Notes
ci-e2e-native.ymlruns the suite on every PR with pi pinnedpi-stable@0.83.6(same discipline as the codex pin, [e2e] fake-upstream overflow 测试与仓库 AGENTS.md 体积隐性耦合:AGENTS.md 增长即破坏 CI(#803 触发) #815)src/agent/*wire-adjacent paths → both compression modes reasoned (fix only affects the header-stamp path; proxy mode unaffected — no waiter registered)