Summary
When the agent runs a loop via runLoop, the CLI agent log shows [tool:done] generateSpec → true and then shows no further updates until the entire loop completes, leaving the user with no visibility into loop progress.
Problem / Context
During the second agent test, after generateSpec completed:
- Agent log displayed:
[tool:done] generateSpec → true
- Then silence for ~12 minutes while the loop ran 3 sessions
- Finally:
[tool:done] runLoop → done
The user had to check the monitor command separately to see any progress. The agent's own stream provided zero intermediate feedback during the most time-consuming phase.
Root Cause
The runLoop tool in src/agent/tools/execution.ts spawns feature-loop.sh as a subprocess with stdio: 'pipe' but doesn't stream the subprocess output back to the agent's event stream. The tool only returns the final result.
Proposed Solution
- Stream subprocess output: Pipe
feature-loop.sh stdout to the agent's event emitter as progress events
- Periodic status updates: Poll the loop's status files (
/tmp/ralph-loop-*.status, .phases) and emit structured progress events
- Phase transition events: Emit events when the loop transitions between phases (planning → implementation → verification → PR)
Files to Modify
| File |
Changes |
src/agent/tools/execution.ts |
Stream loop subprocess output as progress events |
src/commands/agent.ts |
Handle and display progress events from tools |
Acceptance Criteria
Summary
When the agent runs a loop via
runLoop, the CLI agent log shows[tool:done] generateSpec → trueand then shows no further updates until the entire loop completes, leaving the user with no visibility into loop progress.Problem / Context
During the second agent test, after
generateSpeccompleted:[tool:done] generateSpec → true[tool:done] runLoop → doneThe user had to check the monitor command separately to see any progress. The agent's own stream provided zero intermediate feedback during the most time-consuming phase.
Root Cause
The
runLooptool insrc/agent/tools/execution.tsspawnsfeature-loop.shas a subprocess withstdio: 'pipe'but doesn't stream the subprocess output back to the agent's event stream. The tool only returns the final result.Proposed Solution
feature-loop.shstdout to the agent's event emitter as progress events/tmp/ralph-loop-*.status,.phases) and emit structured progress eventsFiles to Modify
src/agent/tools/execution.tssrc/commands/agent.tsAcceptance Criteria