Skip to content

Agent: CLI log stuck at generateSpec during loop execution #130

@federiconeri

Description

@federiconeri

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

  1. Stream subprocess output: Pipe feature-loop.sh stdout to the agent's event emitter as progress events
  2. Periodic status updates: Poll the loop's status files (/tmp/ralph-loop-*.status, .phases) and emit structured progress events
  3. 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

  • Agent log shows phase transitions during loop execution
  • User can see loop progress without checking monitor separately
  • At minimum: "Loop phase: planning", "Loop phase: verification", etc.

Metadata

Metadata

Assignees

Labels

ai/llmAI workflows, agents, promptsbugSomething isn't workingcliCommand line interface, commands, entry points

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions