Skip to content

session-flow: a finished worker's hung background shell stays pinned in the agent panel #4284

Closed

Description

@kyle-sexton

What happened

During a 2026-09-19 multi-agent research session, one research lane launched a Bash background
shell (awk over a ~9 MB file) that hung. The worker agent that launched it finished and returned
its report, but the hung background shell kept that worker listed in the agent panel for hours
afterward. Neither session-flow:orchestrate's standing imperatives nor session-flow:reconcile's
retire step calls for stopping a finished worker's own background tasks.

Evidence

  • plugins/session-flow/skills/orchestrate/SKILL.md imperative 4 ("RUN WORKERS WELL") covers
    non-blocking dispatch, worker reuse, and intervening when a worker drifts, but says nothing about
    stopping a worker's own background shell once the worker itself has reported.
  • plugins/session-flow/skills/reconcile/SKILL.md step 3 ("Retire the finished + reconcile the
    ledger") retires off-thread work proven finished from this session's task ledger, and
    plugins/session-flow/reference/off-thread-work.md covers judging liveness of that off-thread
    work, but neither mentions stopping a reported-finished worker's own still-running background
    bash tasks so it clears from the agent panel.
  • Locally observed: a discovery:research-deep lane ran an awk scan over a ~9 MB file that hung;
    the dispatching worker agent completed and returned its report while the background shell kept
    running, and the agent panel continued to show that worker as active for hours.

Candidate fix

Have session-flow:orchestrate imperative 4, or session-flow:reconcile's retire step, name
explicitly stopping a finished worker's still-running background tasks as part of retiring it, so
a hung background shell doesn't keep a reported-finished worker pinned in the agent panel.

🤖 Generated with Claude Code

Activity

  1. added
    needs-triage
    agent-ready
    status: ready
    and removed
    needs-triage
    on Sep 19, 2026
  2. added theissue type on Sep 23, 2026
  3. kyle-sexton commented on Sep 23, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Agent Brief

    Type: Bug
    Summary: When retiring a worker whose own dispatch has finished, also account for and gate the stop of any of that worker's own still-running background shell tasks, so a hung one doesn't keep the worker pinned in the agent panel.

    Current behavior:
    A worker agent can launch its own background shell command mid-task. If that agent finishes and returns its report while the background shell it launched is still running (for example, because the command hung), nothing in the orchestration guidance or the session-reconciliation flow accounts for that worker's own background task. The reconciliation flow's retire step reconciles the session's task ledger against off-thread work it directly tracks, and the orchestration guidance covers watching and reusing workers, but neither names a finished worker's own still-running background shell as something to check. The result: a worker that has already reported back stays listed as active in the agent panel for as long as its hung shell keeps running.

    Desired behavior:
    When a worker is retired, whether through the orchestration guidance's ongoing worker management or through the session-reconciliation flow's retire step, the retiring process also checks whether that worker itself launched any background shell tasks that are still running after the worker reported completion. A background task found in that state is treated the same way any other still-running work already is: it is not auto-settled just because its owning worker returned, but it is surfaced as still-running work whose termination goes through the same explicit-confirmation gate that already governs stopping any other still-running work in this flow. A worker is not reported as fully retired while it still has a background task in this state pending that confirmation.

    Key interfaces:

    • The orchestration guidance's worker-management imperative, or the session-reconciliation flow's retire step (either surface, or both): gains an explicit check for a retiring worker's own still-running background shell tasks
    • The existing confirmation gate that already requires approval before stopping still-running work: extended to cover this case rather than adding a new, separate confirmation path

    Acceptance criteria:

    • The orchestration guidance or the reconciliation flow's retire step names checking a finished worker's own background shell tasks as part of retiring that worker
    • A background shell task still running after its owning worker reported completion is surfaced as still-running work, not silently cleared
    • Stopping that background task requires the same explicit confirmation already required for other still-running work in this flow; it is never auto-stopped
    • A worker is not reported as retired while it still has such a background task pending that confirmation

    Out of scope:

    • Automatically killing a hung background task without confirmation
    • Sibling-session liveness reporting, an already-covered, separate concern
    • Detecting a hang itself (distinguishing "still running" from "genuinely hung") — this brief covers surfacing and gating the stop, not hang detection
  4. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    This comes from the 2026-09-29 audit of the Cursor run (report: .work/audit/REPORT.md). No reopen.

    In #5239 (fix/audit-session-flow) the orchestrate imperative-4 sentences about a hung background shell now carry a dated four-part record. Its basis is the single local observation of 2026-09-19 (no upstream doc found), and the sentences read as an observation. Behaviour text is unchanged. #5239 uses Refs #4284.

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

    agent-readystatus: ready

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions