Skip to content

fix(analysis): complete rage-loop detection and avoid false positives (#34) - #38

Draft
ClaudiaFang wants to merge 2 commits into
mainfrom
fix/code-insights-rage-loop-pipeline
Draft

ClaudiaFang wants to merge 2 commits into
mainfrom
fix/code-insights-rage-loop-pipeline

Conversation

@ClaudiaFang

@ClaudiaFang ClaudiaFang commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Finish the existing Rage Loop detector end-to-end for #34 (part of #31). Firstsun and b08x already shared the same detector source, so this PR avoids copying duplicate code.

Fixes

  • Remove the major false positive: two empty tool_calls: '[]' values no longer count as repeated tool invocations. Ignore trivial short messages and non-monotonic timestamps.
  • Accept common input_tokens and total_tokens usage shapes.
  • Treat detection as advisory (suspected stalled loop): the LLM still needs to verify semantic nonprogress.
  • Add rage-loop to JSON Schema category enum (already present in prompt constants but missing from the schema).
  • Pass detected signals into both CLI and Hono server session analysis paths, including chunked and facet-only paths.
  • Regression tests for empty tool calls, invalid timestamps, low-context retries, positive loops, and prompt hint generation.

Compatibility

  • No database migrations or full-fork merge.
  • No changes to Firstsun multi-home, Personality, Kilo, Reports, Docker or Node/pnpm toolchain.
  • Keep rage-loop distinct from repeated-mistakes: repetitive failures without saturated context must not be categorized as rage loop by the heuristic.

Validation checklist (keep Draft until complete)

Refs #31 and #34.
Source: https://github.com/b08x/code-insights/blob/development/cli/src/analysis/loop-detector.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(analysis): finish rage-loop and repeated-failure detection end-to-end

1 participant