fix: drain Brabble subprocess output before waiting - #13
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 15, 2026, 11:24 PM ET / September 16, 2026, 03:24 UTC. ClawSweeper reviewWhat this changesThe PR drains Brabble speech-recognition output before waiting for process completion, handles oversized stderr diagnostics, and adds subprocess regression tests and documentation. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful, focused fix for defects present on main. No blocking code defect was found, but the reported runtime results need an inspectable transcript before merge. Likely related people: Mariano Belinky and SebTardif are routing candidates for the adapter and transcript forwarding, respectively. Priority: P2 Review scores
Verification
How this fits togetherClawgo launches Brabble as a speech-recognition subprocess and converts its stdout into transcripts. Those transcripts feed local routing and gateway requests, while stderr carries diagnostics. flowchart LR
A[Recognizer subprocess] --> B[Read stdout transcripts]
A --> C[Drain stderr diagnostics]
B --> D[Transcript stream]
D --> E[Local routing and gateway]
B --> F[Wait for both readers]
C --> F
F --> G[Reap child and close stream]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Retain the existing engine contract while ensuring both output pipes finish draining before child reaping and cancellation releases blocked readers. Do we have a high-confidence way to reproduce the issue? Yes, from source: a slow stdout consumer races concurrent Wait on main, and unconsumed or oversized stderr can block the child. The added subprocess cases target these mechanisms; this review did not execute them. Is this the best way to solve the issue? Yes. Coordinating existing pipe readers before Wait directly repairs the lifecycle defect without adding configuration, changing transcript parsing, or duplicating another supported path. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning medium; reviewed against 6889cdb0060e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Brabble could lose final transcripts because a concurrent
cmd.Waitclosed stdout before its reader finished. It could also stall when stderr was not consumed: logging disabled returned without reading, and a long diagnostic exhausted the scanner.One goroutine now owns process completion and waits for both readers before reaping the child. Stderr is always drained, including after an oversized diagnostic. Cancellation closes the readers and terminates the child; stdout scanner failures also cancel it. Nonzero process exits are logged.
Regression tests launch real subprocesses and cover 500 transcripts with a slow consumer, a 9 MB diagnostic with/without logging, and cancellation. Before the fix, the output test delivered only 56/500 and both stderr tests timed out. Built-CLI proof against a synthetic recognizer and delayed loopback handshake delivered 80/500 before and 500/500 after. The standalone adapter proof improved from 39/500 to 500/500.
go test -race ./...,go vet ./..., build, the pinned deadcode analyzer, and independent P0–P2 autoreview passed. README and Unreleased changelog document the correction. No production gateway or recognizer was used.