Skip to content

fix(anthropic): report owner loss after a broken CLI input pipe - #198778

Merged
vincentkoc merged 1 commit into
mainfrom
fix-claude-pipe-owner-loss-20261114
Nov 14, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix-claude-pipe-owner-loss-20261114

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Related: #195082

What Problem This Solves

A Claude CLI conversation can hang when its stdin pipe breaks before the process owner is lost, leaving startup and error reporting waiting for an exit event that never arrives.

User Impact

The conversation reports the failure instead of remaining pending. Unconfirmed process cleanup still returns the existing actionable error.

Why This Change Was Made

Let the existing process owner's extinction outcome release stdin failure settlement while preserving the normal exit path, diagnostics, cancellation precedence, and independent cleanup join. No new lifecycle state, public API, or dependencies.

Evidence

  • Regression red on 08ae8c62b83ede02db3a8d2bc3ce36206008d253: the new stdin/owner-loss case timed out after 120 seconds; the two existing cases passed. With the repair, all three passed and the formerly hanging case settled in 3 ms.
  • Final Anthropic fast lane: 45 files passed, 524 tests passed, one existing skip. Includes real local subprocess coverage for natural and forced pipe failures, diagnostics, and cancellation.
  • Targeted typecheck, lint, formatting, diff/privacy inspection, and test-line budget passed (+16 test lines within the 400-line allowance).
  • Fresh independent implementation review: no actionable findings. Full local ClawSweeper review completed at default medium on 08ae8c62b83ede02db3a8d2bc3ce36206008d253..170dba8a5b98f8ff500008aed51b52e8db5df830: no introduced correctness or security findings. Its requested native owner-loss proof is now covered below; the review itself did not execute that probe.
  • Native macOS red/green through the real transport and real process owner: a fixed local Node CLI closes stdin, then its verified task-owned anchor is terminated after actual EPIPE. The base leaves initialization pending with zero caller errors; the fix rejects initialization and reports exactly one error. Neither run receives an exit event. Cleanup uncertainty remains an error, and both fixture command and anchor were verified gone.
  • Both native runs used the documented Node test-runtime selector after a Bun test-worker setup stalled before executing the fixed probe. No live Claude service was exercised.

@vincentkoc vincentkoc self-assigned this Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lets Claude CLI input-failure settlement finish when its process owner disappears without reporting an exit.

Example: Claude CLI initialization encounters write EPIPE, then the process owner reports cleanup identity loss without an exit event.

  • Before: Initialization and error reporting remain pending on the missing exit event.
  • After: Initialization rejects with the owner-loss error, while cleanup independently reports that closure could not be confirmed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-supported, with a useful reported regression, but the changed failure sequence has only mocked-owner proof.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A Claude CLI conversation can remain pending when its input pipe breaks before its process owner disappears.
Reason: The maintainer-authored direction repairs a concrete missing settlement path with existing lifecycle ownership and no new configuration or public contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it provides a focused repair for a current-main failure path, and no introduced correctness or security defect was found.

Priority: P1
Reviewed head: 170dba8a5b98f8ff500008aed51b52e8db5df830

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a redacted Gateway or shipped-CLI trace showing EPIPE before real process-owner loss, prompt turn failure, and the independent cleanup result; redact IPs, API keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The Anthropic plugin translates Gateway turns into Claude Code stream-json requests; its transport sends input, reports process failures, and joins authoritative process cleanup before releasing the session.

flowchart LR
A[Gateway turn] --> B[Anthropic CLI runtime]
B --> C[CLI transport]
C --> D[Owned process]
D --> E[Claude Code]
D --> F[Extinction outcome]
F --> C
C --> G[Turn failure and cleanup]
Loading

Technical review

Best possible solution:

Retain the minimal transport repair and existing independent cleanup join, with broader conversation recovery tracked separately.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes the EPIPE-first deadlock, and the author reports a regression that fails on the base and passes with the repair; this read-only review executed no target code.

Is this the best way to solve the issue?

The smallest complete fix is to let the existing process owner's extinction outcome release input-failure settlement while preserving ordinary exit handling and the separate cleanup join.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 07e049f8d440.

Provenance checked

  • POSIX EPIPE settlement keeps the original intent (89792e5: Preserve process exit errors and redacted diagnostics after broken input while retaining forced-shutdown and cancellation behavior.)
  • Owner-loss regression keeps the original intent (4f7b426: Ensure missing exit events cannot indefinitely block cleanup when the authoritative process owner rejects its waits.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 89792e5 adds extensions/anthropic/cli-transport.ts:119 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 89792e5aeb98; files: extensions/anthropic/cli-transport.ts)

PR surface

Source +1, Tests +16. Total +17 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 1 20 4 +16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 22 5 +17

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The source-established failure can leave Claude CLI startup and conversation error reporting pending after process-owner loss.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide the pending real process-owner reproduction through the shipped CLI or Gateway.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 14, 2026, 4:19 AM ET / 09:19 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 14, 2026 13:39
@vincentkoc
vincentkoc enabled auto-merge (squash) November 14, 2026 13:51
@vincentkoc
vincentkoc merged commit 121b720 into main Nov 14, 2026
196 of 197 checks passed
@vincentkoc
vincentkoc deleted the fix-claude-pipe-owner-loss-20261114 branch November 14, 2026 14:47
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

vincentkoc added a commit that referenced this pull request Nov 14, 2026
* commit 'e741fd0d21ff7f9857a9c49f91d95166beaae83f':
  feat: invite members as existing people on a claw (#198773)
  fix(anthropic): report owner loss after a broken CLI input pipe (#198778)
  feat(browser): support experimental Kitesurf browsing (#198833)
  fix(bench): require the state-reader task counter (#198912)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: anthropic P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant