Fix stderr display corruption in TUI#213
Conversation
Implementation PlanProblem AnalysisIn interactive TUI mode, ApproachThree-layer fix:
Deliverables1.
2.
3. Modify
4. Modify
5. Modify
6. Modify
7. Modify remaining
Files to Create/Modify
Testing ApproachUnit tests (
Unit tests (
Integration test (extend existing
Acceptance Criteria
Risks
Plan created by mach6 |
Intercept process.stderr.write in interactive mode to prevent raw writes from corrupting the TUI's differential renderer. Replace all console.error calls with a structured logger (log.debug/warn/error) that routes messages through the TUI feed when active, and to real stderr in non-interactive modes. - Add stderr-guard.ts: takeOverStderr/restoreStderr lifecycle - Add logger.ts: mode-aware structured logging with DREB_DEBUG support - Wire stderr guard into interactive mode (init, suspend, editor, shutdown) - Migrate all 68 console.error calls across 15 source files - Fix package-manager.ts to pipe stderr when TUI is active - Add 15 unit tests for stderr-guard and logger - Update 5 test files to spy on log.* instead of console.error
Progress UpdateImplementation complete. All plan deliverables addressed: New files
TUI integration
console.error migration (68 calls across 15 files)
Tests
Commit: Progress tracked by mach6 |
Code ReviewCriticalFinding 1: Unguarded callback — exceptions propagate out of
ImportantFinding 2:
Finding 3:
Finding 4: Model fallback probing messages classified as
Finding 5: Triplicate
SuggestionsFinding 6:
Finding 7: Trailing-newline regex only strips one
Finding 8: Package-manager TUI stdio routing is untested
Finding 9:
Finding 10: Stale
Finding 11:
Finding 12: AC6 (spinner clears after agent turns) — no implementation
Finding 13:
Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Assessment by mach6 |
… fallback visibility
Progress UpdateAddressed 4 review findings: Finding 1: Unguarded callback
Finding 2: Uint8Array decoding
Finding 3: Error/warning severity distinction
Finding 4: Model fallback probes now visible
Tests
Commit: Progress tracked by mach6 |
Code Review (Round 2)CriticalNo critical findings. ImportantFinding 1:
Finding 2:
Finding 3:
Finding 4:
SuggestionsFinding 5:
Finding 6:
Finding 7: Unnecessary intermediate variable in
Finding 8: Inline dynamic import for
Finding 9: AC 6 (spinner clearing) has no implementation trace
Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Assessment by mach6 |
Progress UpdateAddressed round 2 review findings 1 and 4: Finding 4: exit-before-drain race in
|
Closes #212
Fix STDERR messages corrupting the TUI by intercepting
process.stderr.writein interactive mode, replacing allconsole.errorcalls with a structured logger, and displaying user-relevant warnings in the chat feed.Implementation plan posted as a comment below.