Detectors

The detectors are deterministic rules over a recorded trace. No model decides whether a stall happened.

Stall windows

A stall window is a maximal run of consecutive events in which no event reports progress. Both detectors look only inside stall windows, so a reported evidence span never contains a call that made progress.

Looping

Looping is the same call, or a short cycle of calls, repeating with no progress. Inside a window the detector reports a looping stall when one of these holds.

PatternRepeats needed
A single call3 consecutive times
A cycle of 2 to 4 calls2 consecutive times

Calls are compared as exact text, so grep(pattern=config, path=src) and grep(pattern=config, path=docs) are different calls. After a match the search resumes at the step after its span, so one window can yield more than one looping detection.

$ ./target/debug/westering detect --trace examples/looping_trace.json
{
  "detections": [
    {
      "detail": "call pattern of length 1 repeated 4 times with no progress",
      "evidence_span": {
        "end_step": 4,
        "start_step": 1
      },
      "pattern": [
        "grep(pattern=config, path=src)"
      ],
      "shape": "looping",
      "trace_id": "trace-loop-001"
    }
  ],
  "trace_id": "trace-loop-001"
}

Tool fixation

Tool fixation is one tool called again and again with varying calls while other available tools go unused. A span qualifies for a tool when all of these hold.

ConditionRule
Calls to the toolAt least 4
Share of the spanThe tool makes at least three quarters of the calls
VarietyThe calls to the tool are not all identical
Unused toolsAt least one tool in tools_available makes no call in the span

The detector reports the shortest qualifying span for each tool, and a window yields at most one fixation detection per tool. The fixation example has five varied grep calls with no progress, and the report names the shortest span of four.

$ ./target/debug/westering detect --trace examples/fixation_trace.json
{
  "detections": [
    {
      "detail": "tool grep made 4 of 4 calls with no progress while read, edit, test, finish went unused",
      "evidence_span": {
        "end_step": 3,
        "start_step": 0
      },
      "pattern": [
        "grep"
      ],
      "shape": "tool_fixation",
      "trace_id": "trace-fixation-001"
    }
  ],
  "trace_id": "trace-fixation-001"
}

Output

detect prints one JSON document with the trace_id and a detections list ordered by span. Each detection carries the shape, the pattern, the evidence_span with its first and last step, and a detail sentence. A trace with no stall prints an empty detections list.