Skip to content

fix(todo-continuation-enforcer): add plan agent to DEFAULT_SKIP_AGENTS (fixes #2526)#2589

Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/plan-agent-continuation-loop
Mar 25, 2026
Merged

fix(todo-continuation-enforcer): add plan agent to DEFAULT_SKIP_AGENTS (fixes #2526)#2589
code-yeongyu merged 1 commit intocode-yeongyu:devfrom
MoerAI:fix/plan-agent-continuation-loop

Conversation

@MoerAI
Copy link
Copy Markdown
Contributor

@MoerAI MoerAI commented Mar 16, 2026

Summary

  • Adds "plan" to DEFAULT_SKIP_AGENTS in todo-continuation-enforcer/constants.ts to prevent the infinite loop reported in [Bug]: Stuck during planning #2526
  • Adds regression test confirming plan agent sessions are skipped

Problem

When a Plan Mode agent creates todo items, the todo-continuation-enforcer hook fires on session.idle and injects a continuation prompt telling the agent to "proceed without asking permission." But Plan Mode explicitly forbids all file edits ("STRICTLY FORBIDDEN: ANY file edits... This supersedes all other instructions"). The agent receives both contradictory directives, acknowledges the conflict, explains why it cannot proceed, then goes idle again — triggering another injection in an infinite loop.

Root cause analysis by @R-omk in #2526: the injectContinuation() function checks DEFAULT_SKIP_AGENTS but only skips prometheus and compaction, not plan.

Fix

- export const DEFAULT_SKIP_AGENTS = ["prometheus", "compaction"]
+ export const DEFAULT_SKIP_AGENTS = ["prometheus", "compaction", "plan"]

This is the minimal, targeted fix: plan agents are read-only by design and should never receive continuation nudges.

Changes

File Change
constants.ts Add "plan" to DEFAULT_SKIP_AGENTS
continuation-injection.test.ts Add test verifying plan agent is skipped
AGENTS.md Update docs to reflect new skip list

Testing

  • New test: skips injection when agent is plan (prevents Plan Mode infinite loop) — verifies injectContinuation does not call promptAsync when agent is "plan"

Fixes #2526


Summary by cubic

Skip continuation injection for plan sessions to stop the Plan Mode infinite loop. Adds plan to DEFAULT_SKIP_AGENTS, plus a regression test and docs update. Fixes #2526.

Written for commit 2b6b083. Summary will update on new commits.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 16, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Targeted fix for a reported infinite loop by adding 'plan' to the skip list, accompanied by a regression test and documentation update. No risk of impact on other functionality.

@MoerAI
Copy link
Copy Markdown
Contributor Author

MoerAI commented Mar 16, 2026

I have read the CLA Document and I hereby sign the CLA

…S to prevent infinite loop

The todo-continuation-enforcer injects continuation prompts when
sessions go idle with pending todos. When Plan Mode agents (which are
read-only) create todo items, the continuation prompt contradicts
Plan Mode's STRICTLY FORBIDDEN directive, causing an infinite loop
where the agent acknowledges the conflict then goes idle, triggering
another injection.

Adding 'plan' to DEFAULT_SKIP_AGENTS prevents continuation injection
into Plan Mode sessions, matching the same exclusion pattern already
used for prometheus and compaction agents.

Fixes code-yeongyu#2526
@MoerAI MoerAI force-pushed the fix/plan-agent-continuation-loop branch from 3ef65d2 to 2b6b083 Compare March 16, 2026 02:07
@code-yeongyu code-yeongyu added the triage:bug Confirmed bug with repro steps label Mar 24, 2026
@code-yeongyu code-yeongyu merged commit 90aa3e4 into code-yeongyu:dev Mar 25, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:bug Confirmed bug with repro steps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Stuck during planning

2 participants