Skip to content

Transactional message delivery + turn watchdog against zombie 'Working' states #314

Closed

Description

@currentbits

The dominant pain in both Conductor's and T3 Code's trackers: messages silently lost (sent while a turn runs, sent to a sleeping session, bounced back to the composer) and turns stuck in 'Working' forever (one T3 user: 17 hours; a stalled Grok turn showed no tokens for 70+ minutes with no timeout).

Every sent prompt should get a durable visible state (queued, delivered, acknowledged, answered) with explicit error + retry, and a watchdog should time out turns with no token activity, surfacing 'stalled' instead of an infinite spinner. Users tolerate errors; they do not tolerate having to open the raw CLI to check whether the UI is lying.

Activity

  1. added
    bug
    plan:todo
    on Aug 17, 2026
  2. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Design note from the internal docs audit: docs/ISSUES.md records the remainder of #178 — a CLI that emits any first line (e.g. a stray task-notification) then goes silent forever defeats the 60s ACK watchdog. The prescribed fix is upgrading to command_lifecycle/command_uuid correlation. The transactional-delivery design should incorporate it.

  3. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Research note (practitioner round): adopt the silence-equals-stalled heuristic — require a report on every handoff; a quiet thread is flagged stuck, not assumed working. This is the concrete rule the turn watchdog needs.

  4. currentbits commented on Aug 18, 2026

    @currentbits
    OwnerAuthor

    Deep-dive detail (Synara 0.6.2): the recovery action for a quarantined thread — 'Unblock thread' abandons ambiguous blockers oldest-first, then replays only the skipped turn starts, restoring the conversation without risking a duplicate resend of the command whose delivery could not be proven. Also (0.6.3): the composer stays unavailable when a thread LOOKS busy but has no real active turn — queue draining requires a queueable live turn.

  5. added
    plan:doing
    and removed
    plan:todo
    on Aug 18, 2026
  6. currentbits commented on Aug 18, 2026

    @currentbits
    OwnerAuthor

    Implementation split (in flight):

    Contract (src/shared/ipc.ts, commit 7a70458): ThreadInfo.lastEventAt, ThreadInfo.stalledAt, ThreadInfo.queued.error, ThreadSummaryInfo.stalledAt.

    Main process — activity stamp on every provider stream chunk (in pushDetail), a 15s sweep that flags any working thread quiet for >10 min (env-overridable) as stalledAt with one event message, advisory only, never kills the run; the sweep reads the store rather than the active map so a working thread with no live run at all (the real zombie) is caught too. Plus the type-ahead queue drain moves from the renderer into main: take-and-clear at the run terminal, and on a failed start the prompt goes back with queued.error set instead of vanishing. No startup auto-drain.

    Renderer — flushQueued deleted (main owns delivery now), Stalled badge in place of the infinite Working spinner (sidebar, thread view, agents panel), and the queued strip grows the error text plus a Retry button.

    Deliberately NOT doing the command_lifecycle/command_uuid correlation from #178: the generic no-output watchdog covers the 'stray first line then silence' hole it was for. Reopen that as its own slice if the correlated ACK is still wanted.

  7. currentbits commented on Aug 18, 2026

    @currentbits
    OwnerAuthor

    Deep-dive detail (Conductor API polling contract): a session reports idle until a queued prompt actually starts a turn — consumers must observe 'working' at least once before trusting 'idle' as done. Delta fetching uses after=. Publish the same honesty contract for any Solenta API.

  8. currentbits commented on Aug 18, 2026

    @currentbits
    OwnerAuthor

    Implemented on coder/transactional-message-delivery-turn-watc-a3edde (not merged yet).

    Watchdog — runner.checkStalls() on a 15s unref'd interval sets thread.stalledAt when a working thread has emitted nothing for 10 min (CODER_STALL_MS overrides), is not awaitingInput, and appends one event message. It sweeps the store rather than the active map, so a working row with no live run — the actual zombie — is caught too. Advisory: the CLI is never killed, and the next stream event clears the flag. Activity is stamped in pushDetail, the one funnel every provider goes through, throttled to 5s and without touch so the sidebar does not re-sort per chunk.

    Delivery — services.takeQueued (atomic read-and-clear) + runner.drainQueued at every terminal; a failed start puts the prompt back with queued.error instead of dropping it. No startup auto-drain. The renderer's flushQueued is gone, so there is exactly one owner.

    UI — Stalled badge instead of the endless Working spinner (sidebar, thread view, agents panel), queued strip carries the failure reason and a Retry.

    Two joins needed fixing after the parallel halves came together, both the same class of bug the issue is about: the renderer's Retry cleared the queue optimistically and lost the prompt when runs.start failed, and its thread:updated merge re-pinned its own queued copy over main's explicit null, which would have stranded the Queued chip forever once main started draining.

    Green: test:electron 1168 pass / 0 fail, test:renderer 920 pass / 0 fail, typecheck clean.

  9. added
    plan:done
    and removed
    plan:doing
    on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions