You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Planner agent gets stuck in infinite loop when planning undefined projects #9445
The Planner agent enters an infinite loop when invoked to plan a project that doesn't have existing specs or documentation in the codebase. The agent was invoked via @planner develop opencode-council-swarm and got stuck, requiring manual abort.
Steps to Reproduce
Start an opencode session
Invoke the planner agent with a project that doesn't exist: @planner develop opencode-council-swarm
Observe the agent spinning indefinitely until manually aborted
Expected Behavior
The planner should:
Search for existing specs/docs (reasonable timeout)
If nothing found, acknowledge this and either:
Ask clarifying questions about what the project should be
Create a plan based on the project name semantics ("council-swarm" suggests multi-agent coordination)
Return a "no context found" response with suggestions
Actual Behavior
The agent enters an infinite loop, likely:
Repeatedly searching the same locations
Making identical exploration queries
No termination condition or max iteration limit
Root Cause Hypothesis
No exploration timeout/limit - The planner's exploration phase has no max iterations
Recursive search pattern - When no results found, it may retry the same search
Missing early-exit condition - No check for "zero context found, ask user"
Model looping - The claude-opus-4.5 model may be generating identical tool calls repeatedly
Proposed Fixes
Short-term
Add max iteration limit (e.g., 10 exploration attempts)
Add timeout for planning phase (e.g., 60 seconds)
Detect repeated identical tool calls and break
Long-term
Planner should have explicit "context gathering" phase with bounded scope
If no specs/docs found after N attempts, prompt user for requirements
The planner agent is configured at ~/.config/opencode/agents/planner.md and is designed to create .ralph-plan-*.md files for autonomous execution by Ralph. The loop appears to occur in the exploration phase before any plan file is created.
Additional Notes
This is a usability issue that wastes user time and API tokens. The agent should fail gracefully rather than loop indefinitely.
Activity
github-actions commentedon Jan 19, 2026
This issue might be a duplicate of existing issues. Please check:
Additionally, this relates to:
@planner develop opencode-council-swarmwhich triggered this loop bugThe core issue appears to be missing max iteration limits and loop detection mechanisms in the agent/task execution system.
mannyluvstacos commentedon Jan 19, 2026
please ignore, local agent pushed an issue that was not meant to be pushed