Skip to content

Conversation

@0xMink
Copy link
Contributor

@0xMink 0xMink commented Feb 11, 2026

Refs #10322

Summary

  • Bound auto-retry when the model returns no text and no tool calls (empty/malformed/reasoning-only output) by routing repeated empty outputs into the existing mistake-limit mechanism
  • Preserve grace retry behavior; from the second consecutive empty output onward, emit MODEL_NO_ASSISTANT_MESSAGES and increment consecutiveMistakeCount
  • Refactor: extract onEmptyAssistantOutput() and onNoToolUse() helpers to keep retry accounting consistent and testable

Test plan

  • Existing: pnpm exec vitest run core/task/__tests__/Task.spec.ts — 38 passed, 4 skipped
  • New: pnpm exec vitest run core/task/__tests__/grace-retry-errors.spec.ts — 14 passed (3 new tests call production helpers via (task as any).onEmptyAssistantOutput() / onNoToolUse())

Important

Integrates repeated empty assistant outputs into the mistake-limit mechanism and refactors for consistent retry handling in Task, with new tests added.

  • Behavior:
    • Integrates repeated empty assistant outputs into the mistake-limit mechanism in Task.
    • Emits MODEL_NO_ASSISTANT_MESSAGES and increments consecutiveMistakeCount from the second consecutive empty output.
  • Refactor:
    • Extracts onEmptyAssistantOutput() and onNoToolUse() in Task for consistent retry accounting.
  • Tests:
    • Adds tests in grace-retry-errors.spec.ts for new behavior, including onEmptyAssistantOutput() and onNoToolUse().
    • Confirms counters reset on success and increment independently for different error types.

This description was created by Ellipsis for 15a40c4. You can customize this summary. It will automatically update as commits are pushed.

Route repeated empty assistant outputs (no text, no tool calls) into
existing mistake-limit handling. Previously the empty-response path
incremented consecutiveNoAssistantMessagesCount but never
consecutiveMistakeCount, allowing unbounded auto-retry under
auto-approval.

Extract onEmptyAssistantOutput() and onNoToolUse() helpers to keep
retry accounting consistent and testable.
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Feb 11, 2026
@roomote
Copy link
Contributor

roomote bot commented Feb 11, 2026

Rooviewer Clock   See task

All previously flagged issues have been addressed. No new issues found.

  • ConsecutiveMistakeError reason at line ~2732 hardcodes "no_tools_used" but now the limit can also be reached via empty assistant outputs -- telemetry reason should distinguish the two paths
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Comment on lines 4479 to 4485
private async onEmptyAssistantOutput(): Promise<void> {
this.consecutiveNoAssistantMessagesCount++
if (this.consecutiveNoAssistantMessagesCount >= 2) {
await this.say("error", "MODEL_NO_ASSISTANT_MESSAGES")
this.consecutiveMistakeCount++
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that this path also increments consecutiveMistakeCount, the ConsecutiveMistakeError at line ~2732 will report "no_tools_used" as the reason even when the limit was reached via repeated empty assistant outputs. The comment at lines 2723-2724 ("The reason is 'no_tools_used' because this limit is reached via initiateTaskLoop") is also stale. Low severity since it only affects telemetry accuracy, but worth updating the reason to distinguish between the two error paths so dashboards/alerts can differentiate them.

Fix it with Roo Code or mention @roomote and request a fix.

Record which failure path triggered the mistake count increment
(no_tools_used vs no_assistant_messages) instead of hardcoding
"no_tools_used" in ConsecutiveMistakeError telemetry.
@0xMink
Copy link
Contributor Author

0xMink commented Feb 11, 2026

Addressed in 51e9866. Telemetry now records the actual trigger (no_tools_used vs no_assistant_messages) via a consecutiveMistakeReason field set at the increment site and passed through to ConsecutiveMistakeError. Reason resets to "unknown" when the mistake count resets. Two new tests verify the reason is set correctly for each path.

The inline union on Task.consecutiveMistakeReason included
"no_assistant_messages" but the canonical ConsecutiveMistakeReason type
in @roo-code/types did not, causing TS2345 compile failure.

- Add "no_assistant_messages" to the shared type
- Import ConsecutiveMistakeReason in Task.ts instead of inline union
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant