Merge dev to main#1354
Merged
Merged
Conversation
MNG-699 (ucho PR #400, 2026-05-12): respond-to-review run b728fa3e completed its real work at 08:43:22 (commit 547c4c5d pushed, review reply posted) yet kept its claude-code SDK session alive for ~32 more minutes until the user manually cancelled at 09:15:08, burning compute and blocking follow-up dispatches via the work-item lock. Root cause: Finish DOES terminate the session (it throws TaskCompletionSignal from llmist, which the framework catches), but agent prompts don't mandate calling Finish. Without an explicit instruction the model decides it is done by emitting trailing text and never invokes the gadget — so the SDK keeps streaming. Two surgical changes: 1) NATIVE_TOOL_EXECUTION_RULES (src/backends/shared/nativeToolPrompts.ts) gains a "Termination protocol" section that every agent inherits via buildSystemPrompt — explicit Finish-call mandate, do-not-keep- working-after-Finish, and guidance for the Finish-rejected retry path. 2) validateFinish (src/gadgets/session/core/finish.ts) routes every rejection through rejectFinish() which emits a structured WARN with reason + agent state. Ops can now grep `docker logs cascade-router | grep "[Finish] validation rejected"` for the precondition the agent is looping on — the breadcrumb that was missing during MNG-699 triage. TDD-first: 4 new tests pinning the prompt-rule presence and 5 new tests pinning the WARN log on each rejection path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rompt-mandate fix(agents): mandate Finish in prompt + log Finish rejections (MNG-699)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Routine dev → main promotion. Single feature PR:
Commits
NATIVE_TOOL_EXECUTION_RULESgains a "Termination protocol" section every agent inherits.validateFinishrejections now emit structured[Finish] validation rejectedWARN logs for prod grep.🤖 Generated with Claude Code