Skip to content

aggregator(attention): stuck-retrying is unreachable for live sessions — classifyAttention checks lastTurnError before repeatedErrorCount, and the only producer always sets both #2590

Closed

Description

@dezren39

Problem

The attention classifier's stuck-retrying state is unreachable for every live session entry: the only producer of repeatedErrorCount always sets lastTurnError on the same entries, and classifyAttention checks lastTurnError first.

  • classifyAttention (pm-stack/aggregator/src/derive.ts:197-215) is first-match-wins: awaitingQuestion → lastTurnError ("errored", :203-205) → only then repeatedErrorCount >= RETRY_LOOP_THRESHOLD (3) ("stuck-retrying", :206-209).
  • The sole live producer, the OpenCode mapper mapOne (pm-stack/aggregator/src/sources/opencode.ts), sets entry.lastTurnError whenever the last turn has any error (:246 if (lastTurnError) entry.lastTurnError = lastTurnError) and sets entry.repeatedErrorCount only as an addition to that same run of errors (:232-240, consecutive identical errors at the head of the run). Every entry that could ever satisfy the retry-loop test therefore already matched the errored branch one check earlier.
  • Even the shipped fixture entry designed to demo this state (ses_f_phase13, src/sources/fixtures.ts:525-539: repeatedErrorCount: 4 and lastTurnError: "claude_session_limit (retry)") classifies as plain errored.
  • The existing unit test (test/render.test.ts:233-237) passes only because it constructs the one shape no producer emits — repeatedErrorCount: 4 with no lastTurnError.

Evidence (verified this run on main 3a425552)

Laptop Bun probe driving the real modules (aggregator src/ copied verbatim; probe ~/git/fleet/probe-2026-10-30-laneB-retryloop/): a fake v2 OpenCode server returns one session whose newest turn is 4 consecutive assistant messages carrying the identical tool error boom; the probe runs the real mapServerSessions and feeds its output to the real classifyAttention:

mapper entry: {"sessionId":"ses-retry","lastTurnError":"boom","repeatedErrorCount":4}
classifyAttention state: errored | evidence: Last turn error: boom
RETRY_LOOP_THRESHOLD: 3
control (no lastTurnError) state: stuck-retrying

The mapper emits repeatedErrorCount: 4 (≥ threshold 3) with lastTurnError set — exactly as the code predicts — and the classifier returns errored. The control entry with the test's shape (count only) does return stuck-retrying, confirming the branch works only for shapes no live producer creates.

Why it matters

stuck-retrying is a distinct published state with its own label ("stuck retrying", derive.ts:245), sort rank (ORDER, derive.ts:182), and orchestrator playbook ("Orchestrator breaks the retry loop and reroutes the work", derive.ts:294, applied via tierEntry's ORCHESTRATOR_NOTES[e.state]). A session spinning on the same error — the exact failure the state exists to surface — is instead shown as a generic one-off error, sorted and narrated as such, so the retry-loop intervention never triggers and the taxonomy silently overstates its own coverage: the state lights up in tests and never in the live feed.

Acceptance criteria

  • An entry with lastTurnError set and repeatedErrorCount >= RETRY_LOOP_THRESHOLD classifies as stuck-retrying (treatment pinned at triage: reorder the checks in classifyAttention, or split the states in the mapper — either way the pinned precedence vs awaitingQuestion and vs the credential-error tiering in tierEntry is stated explicitly).
  • A regression test classifies the mapper-shaped entry (both fields set, count ≥ 3) as stuck-retrying, plus a count of exactly RETRY_LOOP_THRESHOLD - 1 still classifying as errored, and a single error with no count staying errored.
  • The fixture entry ses_f_phase13 renders as stuck-retrying in the fixture attention view (or the fixture is adjusted to the shape triage pins).
  • Existing derive/render tests stay green.

Dedup

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 30, 2026
  2. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator (new-issue-creator-code-b)
    • Session / ID: new-issue-creator-code-b cron run 2026-10-30T06:01Z
    • Found via: filed this run
    • Task: Filed aggregator(attention): stuck-retrying is unreachable for live sessions — classifyAttention checks lastTurnError before repeatedErrorCount, and the only producer always sets both #2590 — classifyAttention (derive.ts:197) checks lastTurnError ("errored") before repeatedErrorCount >= RETRY_LOOP_THRESHOLD ("stuck-retrying"), and the only live producer (sources/opencode.ts mapOne) always sets lastTurnError on the same entries it sets repeatedErrorCount on, so stuck-retrying is unreachable in the live feed; even fixture ses_f_phase13 carries both fields and renders "errored". Verified this run (laptop probe, real mapServerSessions + classifyAttention, main 3a42555): mapper emitted {lastTurnError:"boom", repeatedErrorCount:4} for 4 identical tool errors -> state "errored"; control with count only -> "stuck-retrying".
    • Expectation: effort/xs — triage pins the precedence (reorder classifyAttention vs mapper split), then routes the fix with a mapper-shaped regression test.
    • Links: queue packet packet-2590-triage.json (repo-health-code-pilot)
  3. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 1, 2026
  4. 17 remaining items

  5. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

    • Agent: OpenChamber scheduled lane (repo-worker-code)
    • Session / ID: ses_e5e69850bcaffeLF07FcV6aSvp; queue task 5388
    • Found via: repo-health-code-pilot
    • Task: PR Fix stuck-retrying attention precedence #3464 is open with the classifier reorder and focused tests.
    • Reason: CodeRabbit is neutral/skipping; the two push-triggered jules-daily workflows failed without jobs or logs. Full render/slice2 tests are blocked by the existing syntax error in base src/feed.ts:350-352.
    • Resume when: checks are green or the workflow/base blockers are resolved; rerun focused and aggregator tests before merge.
    • Links: Fix stuck-retrying attention precedence #3464
  6. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  7. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  8. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  9. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  10. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  11. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 1, 2026
  12. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

Labels

app/aggregatorPackage/app: aggregator (pm-stack in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions