-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Summary
When csa review --branch main selects claude-code as the review tool, the spawned claude-code-acp sub-agent reads the project's CLAUDE.md/AGENTS.md rules which contain "MUST use csa review" directives, causing it to invoke csa run inside Bash — creating an infinite recursion loop.
Reproduction
cd /path/to/project # with CLAUDE.md containing CSA delegation rules
csa review --branch main
# Result: exit 143 (SIGTERM), zero stdout outputRoot Cause Analysis (via strace)
Fault Chain
csa review --branch main
└─ selects tool: claude-code (claude-code-acp)
└─ claude-code-acp starts, reads CLAUDE.md/AGENTS.md
└─ Turn 1: git log, git diff (normal)
└─ Turn 2: Bash("csa run --tool auto \"Review...\"") ← RECURSION
└─ csa run spawns another sub-process...
└─ parent csa idle-timeout triggers SIGTERM
└─ claude-code-acp stderr write → EPIPE (pipe closed)
└─ Node.js unhandled 'error' event at utils.js:50
└─ Process exits with code 143
Evidence from strace
- Successful exec:
claude-code-acpstarts viasystemd-run --user --scope - JSONRPC output: 362 write(1,...) calls — sub-agent is actively working
- Recursive
csa runinvocation found: claude-code-acp callsBash("csa run --tool auto \"You are performing a comprehensive code review...\"") - EPIPE on stderr:
node:events:486 throw er; Error: write EPIPE at ...utils.js:50:28 - Final status:
termination_reason = "sigterm",exit_code = 143
Impact
csa reviewis completely non-functional for projects with CSA delegation rules in CLAUDE.md- Zero output returned to caller — silent failure with no diagnostic information
- User sees only
exit code 144or143with empty stdout/stderr
Suggested Fixes
Fix 1: Anti-recursion environment variable (recommended)
Set CSA_IN_SUBPROCESS=1 (or similar) when spawning sub-tools. claude-code-acp (and other tools) should check this env var and skip CSA-related rules/invocations.
Fix 2: Instruction injection for claude-code tool
When csa review spawns claude-code-acp, prepend to the system prompt:
CRITICAL: You are running INSIDE a CSA subprocess. Do NOT invoke `csa run`, `csa review`, or `csa debate` — this would cause infinite recursion.
Fix 3: Capture and report EPIPE errors
Currently, when claude-code-acp crashes with EPIPE, CSA reports a generic SIGTERM with zero output. The EPIPE error message should be captured and included in the error report.
Environment
csa 0.1.43 (v0.1.15-38-g718232d-dirty)claude-code-acpvia@zed-industries/claude-code-acp- Node.js v24.14.0 / v25.6.1
- Linux 6.1.0-43-amd64
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels