Repository navigation
Conversation
Observe prompt admission and turn settlement concurrently so early child failures cannot escape as unhandled rejections. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
✅ Deterministic PR hygiene checks passed. |
|
No description provided. |
Summary
A Pi child can fail while its prompt acknowledgement is still pending. The runtime created a separate turn-settlement promise but did not observe it until after awaiting that acknowledgement. A process exit, malformed RPC output, or early extension error could therefore reject both promises while only the command rejection was handled. Even a caller that caught
handle.prompt()still received a process-levelunhandledRejection.Observe prompt admission and turn settlement concurrently with
Promise.all. Either failure rejects the prompt immediately, and success still requires both a successful prompt response and the turn's settlement event. Clear only the active settlement owned by this prompt. Process launch, remote permissions, tool admission, cleanup and replay policy are unchanged.Add seven isolated synthetic RPC scenarios covering child exit, malformed output, extension errors before/after acknowledgement, explicit rejection, and successful completion in either order. The fixture records process-level unhandled rejections without changing the test runner's rejection policy. Update the architecture contract and English/Korean guide.
This is a pre-existing application lifetime bug reproduced on official Bun 1.4.3 and 1.4.4, not a newly introduced Bun 1.4.4 regression. The daemon's crash guard may absorb an unhandled rejection; this PR does not claim that every occurrence terminates the daemon.
Verification
Base: fork
devatc4d4bb2da2162e23c314befafc5ec104292902a0. Local execution: Linux x64. Tests use the repository's normal preload/shared lock in the host PID namespace.Reproduction and regression
On untouched base, a real synthetic child exiting with code 7 before acknowledging a prompt produced both:
Pi RPC exited with code 7;This was reproduced on both Bun versions. Early extension failure and malformed RPC output independently produced the same double-reporting shape on Bun 1.4.4. With this patch, the prompt still rejects with the relevant error and the fixture records zero unhandled rejections.
The fixture accepts an absolute source path, so the exact same probe can target a baseline worktree:
Commands and results
bun run test --parallel=1 ./tests/clients/remote-workspace-cli-runtimes.test.ts— pinned Bun 1.4.3bun test ./tests/clients/remote-workspace-cli-runtimes.test.ts— official Bun 1.4.4bun run test:changed --parallel=2 ./tests/clients/ ./tests/cli/ ./tests/ci-workflows/docs-link-targets.test.ts ./tests/ci-workflows/file-size-ratchet.test.ts— pinned Bun 1.4.3bun run test --parallel=2 ./tests/ci-workflows/file-size-ratchet.test.ts ./tests/ci-workflows/docs-link-targets.test.ts ./tests/clients/remote-workspace-sessions.test.ts ./tests/clients/remote-workspace-management.test.ts— explicit source-reading and session oraclesbun run typecheck;bun run structure:check;bun run privacy:scan;git diff --check --cacheddocs-site/:bun install --frozen-lockfile --offline;OPENCODEX_DOCS_OFFLINE=1 bun run buildThe focused subprocess fixture is explicitly invoked because changed-mode import analysis cannot follow the source filename passed to a child. The broad repository suite was not rerun under the documented constrained-worktree/resource exception; validation covers the changed runtime and connected client/CLI paths plus explicit session, documentation and size guards. Exact-head hosted CI remains separate. Native Windows/macOS execution, real Pi/provider execution, and live CLI confinement are unverified; opt-in skips are not counted as passing evidence.
Independent source/test/documentation review by a separate agent found no material issue. This is an agent review, not a maintainer approval or hosted bot review.
Checklist
Co-authored-by: luvs01 27862058+luvs01@users.noreply.github.com
Summary by CodeRabbit
Bug Fixes
Documentation