Skip to content

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

Open

Description

@ClaudiaFang

狀態更新(2026-10-28)

Parent: #31 · Phase A (P1)

Verified baseline

firstsun-dev/main:cli/src/analysis/loop-detector.ts has the same blob SHA (4ff49ea4b6f7060fd59c138c9355bf1a75213b8b) as b08x; do not copy it again. Firstsun's prompts.ts already passes a <rage_loop> hint, but classification coverage must be verified. Its JSON Schema currently lacks the rage-loop enum value present in b08x, potentially causing rejected output.

Scope

  • Audit both CLI and server analysis paths: detector -> hint -> schema enum -> response normalization -> storage -> Dashboard/Patterns and export.
  • Ensure the rage-loop category and repeated-mistakes remain distinguishable and consistently supported in prompt constants, JSON Schema, parser, persistence and UI.
  • Improve heuristic if warranted: do not count repeated null tool-call fields as evidence; handle invalid/out-of-order timestamps, >50k-token threshold variability, compactions and different provider usage shapes.
  • Show supporting turn range and confidence as an advisory rather than asserting wasted effort from high token count alone; minimize false positives.

Acceptance

  • Positive and negative fixture tests for repeated failed tool actions, compaction, high-context but productive iterative work, missing usage and very short sessions.
  • No changes to historical DB migration numbers; no duplicate detectors.
  • CLI + server results agree and no regression in existing Reflect/Patterns.

Source: https://github.com/b08x/code-insights/blob/development/cli/src/analysis/loop-detector.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions