Repository navigation
fix: stop Claude CLI sessions when the Gateway is killed - #171016
Conversation
Expose the existing owned stdio process lifecycle through the SDK. Opted-in hosts authorize normal stdin EOF explicitly and kill the child tree on host loss before EOF can become a false permission refusal. Preserve secret descriptors, native launch errors, OOM policy, and startup cleanup ownership.
…en-follow-gateway-lifetime
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…en-follow-gateway-lifetime
…en-follow-gateway-lifetime
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR moves Claude CLI processes onto the shared process owner so Gateway loss terminates them without forwarding a false permission refusal through stdin EOF. Example: A Linux Gateway is SIGKILLed between two Claude Bash permission requests.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a confirmed lifecycle bug still present on main and in v2026.10.2; no actionable introduced defect was found, and exact-head CI passes. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Anthropic plugin exchanges stream-json messages with Claude CLI through the SDK process runtime; the shared child owner manages launch, credentials, pipes, cancellation, and descendant cleanup. flowchart LR
A[Gateway turn] --> B[Anthropic CLI transport]
B --> C[SDK process runtime]
C --> D[Shared child owner]
D --> E[Claude CLI]
A --> F[Host lifetime channel]
F --> D
Technical reviewBest possible solution: Land the shared-owner repair while preserving graceful explicit EOF, warm-session permission checks, and truthful interrupted-session history. Do we have a high-confidence way to reproduce the issue? Current-main and released source establish the detached-child lifetime gap, and the reporter supplies a SIGKILL reproduction with persistent false-refusal history; this review executed no target code. Is this the best way to solve the issue? Reusing the existing process owner fixes the lifetime boundary without a platform launcher dependency or competing cleanup manager, while preserving explicit EOF and credential delivery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6906be69a219. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +83, Tests +348, Docs +39. Total +470 across 20 files. Added test files: 3. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 13, 2026, 9:13 AM ET / 13:13 UTC. |
|
Merged via squash.
|
…1016) * fix(anthropic): stop CLI children when the Gateway is killed Expose the existing owned stdio process lifecycle through the SDK. Opted-in hosts authorize normal stdin EOF explicitly and kill the child tree on host loss before EOF can become a false permission refusal. Preserve secret descriptors, native launch errors, OOM policy, and startup cleanup ownership. * fix(anthropic): retain the admitted transport through dispatch * fix(anthropic): join async discovery and preserve shutdown ordering * test(process): read the extra lifetime probe descriptor safely * fix(process): preserve remote stdin closure across relay teardown
…tial pipes (#174571) On Windows, end() on an extra overlapped stdio pipe shuts the pipe down with FlushFileBuffers, which blocks until the child reads every byte. Native Windows Claude Code never reads its fd-3 credential, and since #171016 the owned stdio process awaits that delivery before the live session initializes, so every claude-cli turn stalled. Complete delivery when the pipe accepts the bytes and close the writer, matching POSIX pipe semantics. Fixes #174204
…tial pipes (#174571) On Windows, end() on an extra overlapped stdio pipe shuts the pipe down with FlushFileBuffers, which blocks until the child reads every byte. Native Windows Claude Code never reads its fd-3 credential, and since #171016 the owned stdio process awaits that delivery before the live session initializes, so every claude-cli turn stalled. Complete delivery when the pipe accepts the bytes and close the writer, matching POSIX pipe semantics. Fixes #174204 (cherry picked from commit d401ad3)
…tial pipes (openclaw#174571) On Windows, end() on an extra overlapped stdio pipe shuts the pipe down with FlushFileBuffers, which blocks until the child reads every byte. Native Windows Claude Code never reads its fd-3 credential, and since openclaw#171016 the owned stdio process awaits that delivery before the live session initializes, so every claude-cli turn stalled. Complete delivery when the pipe accepts the bytes and close the writer, matching POSIX pipe semantics. Fixes openclaw#174204
…tial pipes (openclaw#174571) On Windows, end() on an extra overlapped stdio pipe shuts the pipe down with FlushFileBuffers, which blocks until the child reads every byte. Native Windows Claude Code never reads its fd-3 credential, and since openclaw#171016 the owned stdio process awaits that delivery before the live session initializes, so every claude-cli turn stalled. Complete delivery when the pipe accepts the bytes and close the writer, matching POSIX pipe semantics. Fixes openclaw#174204 (cherry picked from commit d401ad3) Co-authored-by: RomneyDa <[email protected]>
…tial pipes (openclaw#174571) On Windows, end() on an extra overlapped stdio pipe shuts the pipe down with FlushFileBuffers, which blocks until the child reads every byte. Native Windows Claude Code never reads its fd-3 credential, and since openclaw#171016 the owned stdio process awaits that delivery before the live session initializes, so every claude-cli turn stalled. Complete delivery when the pipe accepts the bytes and close the writer, matching POSIX pipe semantics. Fixes openclaw#174204 (cherry picked from commit d401ad3) Co-authored-by: RomneyDa <[email protected]>
* test(ui): deslop o0796 tests Keep all eight action-feedback cases and their outcome, attribution, busy-state, and history-refresh assertions. Trim fixture overrides and repeated table data. Remove redundant RPC-shape checks: index.test.ts covers authoritative toggle revision updates, while action-feedback retains explicit run-mode checks. Preserve queued-notice regression coverage from #177543. * test(ui): inline o0796 feedback fixtures * test(image-generation): deslop o0795 tests Compact response fixtures and exact asset expectations without removing cases. The data URL round-trip and malformed-input tests retain parser success and rejection coverage through generatedImageAssetFromDataUrl. * test(shared): deslop o0794 tests Trim duplicate frozen-state and mutation checks while preserving all seven test declarations and ten expanded cases. The shared-cycle test retains mutation rejection; the shared-tail test retains identity, queue-work, and deep-freeze checks with one representative retained entry. Keep oversized-cycle eviction and opaque/accessor safety coverage. * test(shared): consolidate o0794 immutable graph coverage Use one shallow-frozen cycle row per freezer. Mutable root freezing remains covered by oversized cycles and the shared snapshot tail test; memoized descendant reuse remains covered by republishing child and snapshot objects. Consolidate forbidden accessor/proxy invocation checks and inline the mutable-cycle fixture. Reduce the shard from its original 135 lines to 108 without removing distinct safety or cycle behavior. * test(vault): deslop o0800 tests Reuse the plan fixture for existing-file and symlink refusal checks, simplify CLI helpers, and remove redundant suite nesting. Keep all six cases and their distinct behavior assertions. * test(venice): deslop o0797 tests * test(session-maintenance): deslop o0798 tests Trim async wrapper and event-recording boilerplate while retaining all authority and lifecycle assertions. Keep both queued-read paths: scheduling directly and waiting for foreground owner settlement exercise distinct admission paths. The suite was already consolidated; retain all three cases rather than cut distinct behavior for the line target. * test(session-maintenance): remove duplicate adapter layer for o0798 Assert prepared facts and authority isolation at createSessionMaintenanceFollowup, without replaying the embedded-run adapter. Adapter vision remains covered by agent-runner-vision.test.ts (prepared vision); policy propagation by agent-runner-utils.test.ts (uses the queued conversation policy snapshot). Keep both scheduling paths and all lifecycle-ordering assertions. Remove the initial operation-defined assertion subsumed by the completed-owner result assertion. Total shard LOC: 105 to 84. Static checks only under CI-only campaign mode. * test(secrets): deslop o0799 tests * test(secrets): consolidate o0799 redaction scenarios Share the corrupted-row fixture across resolution, audit, and exec checks while retaining repair rollback and stale-write assertions. Reference identity fields remain covered by resolve.mixed-failures.test.ts: retains every ref failure from one provider batch. * test(abliteration): deslop o0801 tests * test(abliteration): trim o0801 catalog inventory assertions Keep credential-free default-model discovery and every reasoning/privacy assertion. Remove the copied four-model inventory; manifest row conversion is covered by src/plugin-sdk/provider-catalog-shared.test.ts in converts manifest rows and reads the default model reference. Use direct payload field assertions without changing expected values. * test(promos): deslop o0805 tests Share promotion rendering setup and JSON-mode assertions. Remove the test-owned JSON serialization layer and assert the payload at the runtime writer boundary instead. Keep all seven cases, including JSON success and 404 fallback, both countdown branches, empty and unavailable text output, and terminal-control sanitization. * test(promos): consolidate o0805 output fixtures Reuse the hostile-text promotion across list-output cases and remove the override/render helper. Keep all seven expanded cases and their distinct list-command branches. Assert JSON payloads without repeating writer call-count and formatting-argument details covered by src/runtime.test.ts (writes JSON). * test(video): deslop o0804 tests Simplify deadline setup and reuse the pending response fixture while retaining all three cases and every assertion for both providers. The explicit long budget, original deadline after slow submission, and default polling budget regressions remain covered by testVideoGenerationDeadlines in the Runway and Together provider suites. * test(video): further reduce o0804 deadline harness Assert the generation promise directly while checking settlement at the fake-clock deadline. Keep all three timing branches, Error/message assertions, downloaded bytes and MIME type, no download after timeout, and submission release. Remove duplicated submission call-count proof: runway's submits/polls/downloads table asserts exactly one create request, and together's creates/polls/downloads test verifies the single submission through requireFirstPostJsonRequest. Preserve both provider suites unchanged. * test(process): deslop o0803 tests Keep all four input-lifetime regression cases from #171016. Replace deferred readiness and EOF scaffolding with the readiness callback and native event promise, and register group cleanup with the test lifecycle. Preserve exact output, exit status, closing receipt, and root-result assertions. * test(process): deduplicate o0803 retirement assertions Successful root-result delivery remains covered by service-child-group-anchor.retirement.test.ts in 'retires gracefully only after the closing receipt is acknowledged', including matching and legacy-host cases. Keep all four input-lifetime cases, exact exit/output checks, and explicit parent-lost versus lineage-lost closing reasons. * test(qa-lab): deslop o0808 tests Use catalog module-flow metadata and consolidate Matrix binding and voice configuration assertions. Keep all three scenario cases and their canary, isolation, provider, and media contracts. Remove the redundant plugin collector assertion covered by suite-planning.test.ts: collects unique scenario-declared bundled plugins in encounter order. Execution config accessor remains covered by scenario-catalog.test.ts: keeps the pinned gateway restart scenario owned by the OpenClaw runtime. CI-only validation: plain oxlint, oxfmt, and git diff --check passed. Test file reduced from 101 to 80 lines; no test or coverage execution. * test(workboard): deslop o0809 tests Remove the repeated absence assertion after a no-op hidden=false write. The preceding assertion in pauses lifetime while hidden already proves expiration for both initial visibility states. Preserve all four distinct lifecycle cases; further case removal would lose initial-hidden, paused-lifetime, dialog-dismissal, or error-recovery proof. * test(workboard): consolidate o0809 toast fixtures Replace separate result, error, and visibility signals with a single reactive props fixture. Keep both initial-hidden and partial-lifetime paths plus manual dismissal, shared-dialog suppression, expiry, error recovery, and new-result behavior. Preserve the DOM assertions and both two-case tables. CI-only validation: oxfmt, plain oxlint, and git diff --check. * test(meta): deslop o0807 tests Remove subprocess invocation bookkeeping and the duplicate backend fixture guard; the successful browser-approval test still asserts the exact credential environment and one browser handoff. Simplify approval and authority-revocation setup while retaining all four behavior cases. * test(meta): consolidate o0807 login lifecycle cases Share cancellation setup across separate signal-cancellation and authority-revocation rows. Preserve child termination, pending presentation, un-aborted signal, browser handoff, and credential absence assertions. Simplify the executable fixture to one temporary root while retaining exact managed credential environment checks. * test(channels): deslop o0811 tests * test(sdk): deslop o0810 tests Remove redundant cleanup-error aggregation from the disposable retention probe. Uncaught assertion and cleanup failures are already checked through the child exit status by event-hub.test.ts: releases retired payloads but lets a closed hub drain. Preserve all four retirement scenarios, GC controls, drain identity checks, and success-path cleanup. * test(ui): deslop o0813 tests Remove generated Linux, audio, modified-video and unused video-key rows filtered out by both consumers. Preserve the rows used by loads older history only when %s yields navigation and resolves pending restoration ownership for %s. Share Mac fixtures and compact DOM fixture construction without changing assertions. * test(media-understanding): deslop o0812 tests Keep the selected-model alias regression and both assertions. Reuse provider fixture defaults and replace manual resource cleanup with an async disposable stack. No distinct behavior or test case removed. * test(media-understanding): reuse alias fixture in o0812 Reuse the existing identical model-alias metadata builder. Drop the unused snapshot agentId: image runtime resolution uses the supplied agentDir and workspaceDir. Preserve the selected-model case, catalog rows, competing metadata, and both assertions. * test(llm-task): deslop o0815 tests Consolidate allowlist migration cases and repeated policy fixtures while retaining all nine cases. Replace diagnostic prose snapshots with resulting config and change-count assertions; preserve permission, precedence, empty-policy, fail-closed and idempotence contracts. CI-only validation: oxlint, oxfmt and diff checks. * test: retain boundary assertions in cleanup batch d638 * test(media-understanding): retain required context window fixture
…185152) * test(ui): deslop o0796 tests Keep all eight action-feedback cases and their outcome, attribution, busy-state, and history-refresh assertions. Trim fixture overrides and repeated table data. Remove redundant RPC-shape checks: index.test.ts covers authoritative toggle revision updates, while action-feedback retains explicit run-mode checks. Preserve queued-notice regression coverage from openclaw#177543. * test(ui): inline o0796 feedback fixtures * test(image-generation): deslop o0795 tests Compact response fixtures and exact asset expectations without removing cases. The data URL round-trip and malformed-input tests retain parser success and rejection coverage through generatedImageAssetFromDataUrl. * test(shared): deslop o0794 tests Trim duplicate frozen-state and mutation checks while preserving all seven test declarations and ten expanded cases. The shared-cycle test retains mutation rejection; the shared-tail test retains identity, queue-work, and deep-freeze checks with one representative retained entry. Keep oversized-cycle eviction and opaque/accessor safety coverage. * test(shared): consolidate o0794 immutable graph coverage Use one shallow-frozen cycle row per freezer. Mutable root freezing remains covered by oversized cycles and the shared snapshot tail test; memoized descendant reuse remains covered by republishing child and snapshot objects. Consolidate forbidden accessor/proxy invocation checks and inline the mutable-cycle fixture. Reduce the shard from its original 135 lines to 108 without removing distinct safety or cycle behavior. * test(vault): deslop o0800 tests Reuse the plan fixture for existing-file and symlink refusal checks, simplify CLI helpers, and remove redundant suite nesting. Keep all six cases and their distinct behavior assertions. * test(venice): deslop o0797 tests * test(session-maintenance): deslop o0798 tests Trim async wrapper and event-recording boilerplate while retaining all authority and lifecycle assertions. Keep both queued-read paths: scheduling directly and waiting for foreground owner settlement exercise distinct admission paths. The suite was already consolidated; retain all three cases rather than cut distinct behavior for the line target. * test(session-maintenance): remove duplicate adapter layer for o0798 Assert prepared facts and authority isolation at createSessionMaintenanceFollowup, without replaying the embedded-run adapter. Adapter vision remains covered by agent-runner-vision.test.ts (prepared vision); policy propagation by agent-runner-utils.test.ts (uses the queued conversation policy snapshot). Keep both scheduling paths and all lifecycle-ordering assertions. Remove the initial operation-defined assertion subsumed by the completed-owner result assertion. Total shard LOC: 105 to 84. Static checks only under CI-only campaign mode. * test(secrets): deslop o0799 tests * test(secrets): consolidate o0799 redaction scenarios Share the corrupted-row fixture across resolution, audit, and exec checks while retaining repair rollback and stale-write assertions. Reference identity fields remain covered by resolve.mixed-failures.test.ts: retains every ref failure from one provider batch. * test(abliteration): deslop o0801 tests * test(abliteration): trim o0801 catalog inventory assertions Keep credential-free default-model discovery and every reasoning/privacy assertion. Remove the copied four-model inventory; manifest row conversion is covered by src/plugin-sdk/provider-catalog-shared.test.ts in converts manifest rows and reads the default model reference. Use direct payload field assertions without changing expected values. * test(promos): deslop o0805 tests Share promotion rendering setup and JSON-mode assertions. Remove the test-owned JSON serialization layer and assert the payload at the runtime writer boundary instead. Keep all seven cases, including JSON success and 404 fallback, both countdown branches, empty and unavailable text output, and terminal-control sanitization. * test(promos): consolidate o0805 output fixtures Reuse the hostile-text promotion across list-output cases and remove the override/render helper. Keep all seven expanded cases and their distinct list-command branches. Assert JSON payloads without repeating writer call-count and formatting-argument details covered by src/runtime.test.ts (writes JSON). * test(video): deslop o0804 tests Simplify deadline setup and reuse the pending response fixture while retaining all three cases and every assertion for both providers. The explicit long budget, original deadline after slow submission, and default polling budget regressions remain covered by testVideoGenerationDeadlines in the Runway and Together provider suites. * test(video): further reduce o0804 deadline harness Assert the generation promise directly while checking settlement at the fake-clock deadline. Keep all three timing branches, Error/message assertions, downloaded bytes and MIME type, no download after timeout, and submission release. Remove duplicated submission call-count proof: runway's submits/polls/downloads table asserts exactly one create request, and together's creates/polls/downloads test verifies the single submission through requireFirstPostJsonRequest. Preserve both provider suites unchanged. * test(process): deslop o0803 tests Keep all four input-lifetime regression cases from openclaw#171016. Replace deferred readiness and EOF scaffolding with the readiness callback and native event promise, and register group cleanup with the test lifecycle. Preserve exact output, exit status, closing receipt, and root-result assertions. * test(process): deduplicate o0803 retirement assertions Successful root-result delivery remains covered by service-child-group-anchor.retirement.test.ts in 'retires gracefully only after the closing receipt is acknowledged', including matching and legacy-host cases. Keep all four input-lifetime cases, exact exit/output checks, and explicit parent-lost versus lineage-lost closing reasons. * test(qa-lab): deslop o0808 tests Use catalog module-flow metadata and consolidate Matrix binding and voice configuration assertions. Keep all three scenario cases and their canary, isolation, provider, and media contracts. Remove the redundant plugin collector assertion covered by suite-planning.test.ts: collects unique scenario-declared bundled plugins in encounter order. Execution config accessor remains covered by scenario-catalog.test.ts: keeps the pinned gateway restart scenario owned by the OpenClaw runtime. CI-only validation: plain oxlint, oxfmt, and git diff --check passed. Test file reduced from 101 to 80 lines; no test or coverage execution. * test(workboard): deslop o0809 tests Remove the repeated absence assertion after a no-op hidden=false write. The preceding assertion in pauses lifetime while hidden already proves expiration for both initial visibility states. Preserve all four distinct lifecycle cases; further case removal would lose initial-hidden, paused-lifetime, dialog-dismissal, or error-recovery proof. * test(workboard): consolidate o0809 toast fixtures Replace separate result, error, and visibility signals with a single reactive props fixture. Keep both initial-hidden and partial-lifetime paths plus manual dismissal, shared-dialog suppression, expiry, error recovery, and new-result behavior. Preserve the DOM assertions and both two-case tables. CI-only validation: oxfmt, plain oxlint, and git diff --check. * test(meta): deslop o0807 tests Remove subprocess invocation bookkeeping and the duplicate backend fixture guard; the successful browser-approval test still asserts the exact credential environment and one browser handoff. Simplify approval and authority-revocation setup while retaining all four behavior cases. * test(meta): consolidate o0807 login lifecycle cases Share cancellation setup across separate signal-cancellation and authority-revocation rows. Preserve child termination, pending presentation, un-aborted signal, browser handoff, and credential absence assertions. Simplify the executable fixture to one temporary root while retaining exact managed credential environment checks. * test(channels): deslop o0811 tests * test(sdk): deslop o0810 tests Remove redundant cleanup-error aggregation from the disposable retention probe. Uncaught assertion and cleanup failures are already checked through the child exit status by event-hub.test.ts: releases retired payloads but lets a closed hub drain. Preserve all four retirement scenarios, GC controls, drain identity checks, and success-path cleanup. * test(ui): deslop o0813 tests Remove generated Linux, audio, modified-video and unused video-key rows filtered out by both consumers. Preserve the rows used by loads older history only when %s yields navigation and resolves pending restoration ownership for %s. Share Mac fixtures and compact DOM fixture construction without changing assertions. * test(media-understanding): deslop o0812 tests Keep the selected-model alias regression and both assertions. Reuse provider fixture defaults and replace manual resource cleanup with an async disposable stack. No distinct behavior or test case removed. * test(media-understanding): reuse alias fixture in o0812 Reuse the existing identical model-alias metadata builder. Drop the unused snapshot agentId: image runtime resolution uses the supplied agentDir and workspaceDir. Preserve the selected-model case, catalog rows, competing metadata, and both assertions. * test(llm-task): deslop o0815 tests Consolidate allowlist migration cases and repeated policy fixtures while retaining all nine cases. Replace diagnostic prose snapshots with resulting config and change-count assertions; preserve permission, precedence, empty-policy, fail-closed and idempotence contracts. CI-only validation: oxlint, oxfmt and diff checks. * test: retain boundary assertions in cleanup batch d638 * test(media-understanding): retain required context window fixture
Fixes #170868
What Problem This Solves
Fixes Claude CLI children continuing after a killed Gateway and recording an unanswered permission hook as a user refusal.
User Impact
New Claude CLI processes on Linux and macOS stop with their Gateway host, so host loss cannot reach Claude as stdin EOF and contaminate the resumed conversation. Normal explicit stdin closure remains graceful. Existing callers retain their EOF behavior unless they select the new lifetime policy; Windows retains the existing process owner's platform guarantees. Previously written transcripts are not rewritten.
Why This Change Was Made
The plugin's detached spawn and in-process kill callback could not run after Gateway SIGKILL. This reuses the existing service-child owner through a compatible, additive
process-runtimeSDK export (createOwnedStdioProcess,closeOwnedStdioProcess, and their types). The capability ladder requires this narrow generic seam because the plugin cannot import the core owner directly. No new manager, config option, native dependency, or schema is introduced.Opted-in owners distinguish explicit stdin closure from host loss over their existing control channel. They retain the child's stdin until explicit closure, or kill the child tree when the host disappears. Anonymous fd3 credential delivery, argv0, cwd/environment, native spawn errors, and Linux OOM policy are preserved. The session lifecycle now joins asynchronous startup before reporting cleanup complete. Production growth is the generic owner contract and EOF ordering; the superseded Claude spawn/kill implementation is removed.
Evidence
POSIX anchor input lifetimeregression cases cover host loss after observed stdin EOF (no synthetic refusal), explicit end before/after EOF, and unchanged default EOF/input flushing. The fixture exercises the real anchor with deterministic pipe/control handshakes.git diff --checkpass. Type-aware lint could not resolve the unbuilt plugin SDK declarations; no local declaration/typecheck build was run under the proof policy.pnpm plugin-sdk:sync-exportspassed with no generated change: the runtime subpath already exists; the shipped-surface inventory is derived from stable releases and is unchanged.5abb27443c9fe. Current main (6b031bff125b4) was merged without owner-file conflicts immediately before the final push.ECANCELED. The owner now preservesEPIPEfor canceled pending writes and retains independent errors. The newpreserves remote pipe closure when buffered writes fail with %sregression covers both canceled-write codes and anEIOcontrol, including callback-before-error ordering. Existing Claude broken-pipe, cancellation, and diagnostic assertions remain unchanged. A Windows regression also covers tree extinction before stdin EOF. Final exact-head CI: run 38397485207 on157241f128644e24558ca74e98e3f6e1618d52f4passed, including the aggregate gate, regression shards, production/test types, lint, package boundaries, docs, and build.Production delta is +209/−126 (+83 lines); tests +369/−21; docs +40/−1. The net production increase is the generic SDK contract, host-loss/EOF ordering, startup join, and preservation of native error semantics; the old plugin spawn and kill implementation is removed. Further reductions would require unrelated cleanup or weaken these guarantees.
CI timing examples: startup/exit join regression 184 ms, OOM/argv0 regression 231 ms, Windows extinction-before-EOF regression 2 ms. No local test wall times exist because local execution was intentionally skipped. An unrelated CLI fixture mock-isolation ratchet in the superseded run was already fixed on main by
3cffaf5fc5a6b; the final merged-base run passes it. No ClawSweeper P0–P2 code findings have been posted.