feat: send loop nudge message to agent when loop is detected#488
Open
avoidwork wants to merge 3 commits into
Open
feat: send loop nudge message to agent when loop is detected#488avoidwork wants to merge 3 commits into
avoidwork wants to merge 3 commits into
Conversation
Propose OpenSpec change for injecting configurable nudge messages into the conversation when agent loop is detected. - proposal.md: Motivation and capability definition - design.md: Technical design with decisions and trade-offs - specs/loop-nudge/spec.md: ADDED requirements for nudge injection, limit enforcement, visibility, and UI nudge independence - tasks.md: Implementation checklist with 19 tasks
When the agent enters a repetitive loop, inject a configurable nudge
message into the conversation so the agent can see it and try a
different approach.
- Add loopMsg and loopLimit config fields (agent.loopMsg, agent.loopLimit)
- Track nudge count and inject HumanMessage when loop is detected
- Respect loopLimit to stop injecting nudges after configured max
- Nudge is injected as a user message, visible to the agent
- Existing UI nudge ('You're looping.') continues to work unchanged
- Add unit tests for config schema, nudge injection, and limit enforcement
Owner
Author
Final Audit Results: Loop Nudge MessageGoal FulfillmentAll detailed goals have been satisfied:
Spec ComplianceThe implementation matches the requirements in the spec documents:
Task CompletionAll tasks in tasks.md have been implemented:
Quality Check
Deviations from Original Plan
VerdictAll goals fulfilled, all specs implemented, all tests passing. Ready for merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When the agent enters a repetitive loop, the system detects it via turn hash tracking but only displays a UI nudge ("You're looping.") to the user. The agent itself never receives feedback that it is stuck, so it continues looping. This change injects a configurable nudge message into the conversation when a loop is detected, allowing the agent to see it and try a different approach.
Type of Change
Testing
Unit tests added for:
loopMsgandloopLimitusertypeAll tests pass with
npm run test.Coverage
Checklist
npm run lintpassesImplementation Tasks
This change implements the OpenSpec proposal at
openspec/changes/loop-nudge-message/:src/config/schemas.js,config.yaml)src/agent/react.js