workflows/implement: filter claude stderr before forwarding to caller#159
workflows/implement: filter claude stderr before forwarding to caller#159ooloth wants to merge 1 commit into
Conversation
#81 Previously every line from the Claude subprocess's stderr was forwarded verbatim to the caller's stderr via `eprintln!`. With `--output-format stream-json --verbose`, Claude's stderr can contain tool call results and file contents — including email addresses, API responses, or other personal data from repositories being processed. This adds `is_claude_diagnostic`, a heuristic filter that passes only lines that look like Claude's own status/diagnostic output: short lines (<= 200 chars) that don't start with `{` or `[`. All stderr lines continue to be written to the transcript file for local debugging. Closes #81 https://claude.ai/code/session_01NX6Sqy1LRifn2ZbMjm4gcM
There was a problem hiding this comment.
Pull request overview
This PR reduces the risk of leaking sensitive tool output or repository contents by filtering which claude subprocess stderr lines are forwarded to the caller’s stderr, while still capturing all stderr lines in the on-disk transcript for debugging.
Changes:
- Added an
is_claude_diagnosticheuristic to decide whichstderrlines are safe to forward to caller output. - Updated the
claudestderr forwarding loop to always write fullstderrto the transcript and only forward “diagnostic-like” lines to callerstderr. - Added unit tests covering the new heuristic behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Suppress anything over 200 chars — diagnostic messages are short. | ||
| if line.len() > 200 { |
| fn short_status_messages_are_diagnostic() { | ||
| assert!(is_claude_diagnostic("Waiting for API…")); | ||
| assert!(is_claude_diagnostic("hub implement: starting ooloth/hub#81")); | ||
| assert!(is_claude_diagnostic("Error: something went wrong")); | ||
| assert!(is_claude_diagnostic("")); | ||
| } |
|
Closing as obsolete. This PR filters Claude subprocess stderr in The replacement dispatch architecture ( Superseded by main's deletion of the dead code. See #81. |
✅ What
is_claude_diagnosticto filter Claude subprocess stderr before forwarding to caller stderr{/[(JSON) are suppressed from caller output🤔 Why
👩🔬 How to validate
hub implementon an issue in a repo that contains files with email addresses~/.hub/transcripts/— expect the full interaction including tool results to be present🔖 Related links
Closes #81
Generated by Claude Code