Skip to content

An idle thread's background command stays "Running" after its machine is suspended: nothing settles a task whose owner process stops #6123

Closed

Description

@alexandre-vl

Summary

A claude-code thread started a background shell command (Bash run_in_background) and went idle. The execution machine was suspended later that afternoon, which killed the command. bb never recorded that the command ended. The next day the thread still showed "Running background command: Watch CI, Build & Push and the deploy run in sequence" with its timer at 21h 18m and counting. Its activeBackgroundCommandCount also stayed at 1.

Expected: when the process that owns a background task stops, the task settles as interrupted/stopped, as bb thread stop already does. The process can be the daemon, the provider bridge or the provider CLI.

Versions and environment

  • bb 0.46.2: a fork build (0.46.2-alex.39756792507.1) of get-bb/bb main plus unrelated layers. Every code path below is identical on main at 9c3c56fa2, and all repros below run on main.
  • Server: self-hosted on Linux, reached through bb Connect.
  • Execution machine: a provider-managed ephemeral machine (machine-provider plugin with suspend/resume). At resume the daemon self-updated from protocol 237 to 249.
  • claude-code provider: @anthropic-ai/claude-agent-sdk 0.3.245, claude 2.1.307. Node 22.23.2, Linux 7.0.

Steps to reproduce

Exact repros on main at 9c3c56fa2. Each test below fails on main.

  1. Graceful daemon shutdown, which is what suspending a machine does. This integration test uses a real server, a real daemon and the scripted-echo bridge. The thread opens a background task and goes idle, then daemon.shutdown("machine-shutdown") runs. The server still holds only the task's item/started: tests/integration/fake/recovery/background-task-shutdown.test.ts in the linked PR.
  2. Machine suspension: requestMachineSuspension with a clean daemon shutdown leaves the idle thread's task open. See apps/server/test/internal/background-task-reconciliation.test.ts › "settles an idle thread's open tasks once a machine suspension has shut its daemon down".
  3. Manual, on a pnpm start:worktree instance:
    • Create a claude-code thread with the prompt Run "sleep 3600" with Bash run_in_background, then reply done. and wait until it is idle. The timeline shows "Running background command".
    • Find the thread's bridge with pgrep -af bb-provider-bridge-worker, then kill -9 <pid>.
    • bb thread log <thr> --json shows no item/backgroundTask/completed. It stays open after the next turn too.
    • Variant: kill -9 the bridge's claude child instead. The task then stays open until the next turn's session replacement settles it.

Did not reproduce: a daemon SIGTERM or SIGKILL under the dev launcher. The launcher restarts the daemon at once, and the server's settle for a new daemon instance closes the task. The task stays open only while the daemon is not back, for example for a whole machine suspension.

Expected vs actual

Actual, thread thr_q4hiimmiqu (bb thread log --json) and the berth machine's host-daemon.1.log:

10-21 15:41:07Z  seq 11444  item/started backgroundTask familyId=b55rxfnlv local_bash  status=pending taskStatus=running
10-21 15:41:32Z  seq 11478  turn/completed                         (thread idle, task running)
10-21 16:12:06Z  daemon     "Shutting down host daemon" {reason: "machine-shutdown"}   (machine suspended)
10-22 10:50:26Z  daemon     "Installed the server-matched bb host package; restarting the daemon." {daemonProtocolVersion: 237, serverProtocolVersion: 249}
10-22 10:50:28Z  daemon     "Connected to server" hses_266w368428, "Host daemon started" instanceId f981dea4-… (previous instance ace6a358-…)
10-22 10:50:33Z  seq 11481  thread/identity (same session resumed); the resumed Claude session reports the task "didn't finish before the previous session ended"
10-22 13:00Z     UI: "Running background command … 21h 18m 41s"; no item/backgroundTask/completed for item da9eac5b3d-i18

Expected: item/backgroundTask/completed {status: "interrupted", taskStatus: "stopped"} by 16:12:06Z, when the daemon that owned the task shut down.

Evidence

What stops a task's owner without settling the task, at 9c3c56fa2:

  • Daemon shutdown. The runtime clears its open background work before it kills provider processes: runtime.ts#L2599-L2613. While shutting down, the provider manager drops every stdout line (runtime-provider-process.ts#L426) and returns early from the exit handler (#L584). On SIGTERM the Claude CLI emits task_notification stopped and task_updated killed within 4 ms (lab run, SDK 0.3.245), but those notifications never reach the server. The daemon flushes its event sink after runtimeManager.shutdownAll() and before the connection closes (app.ts#L981-L998), so the runtime could still report the tasks itself.
  • Bridge process exit while the daemon stays up. The runtime detaches the bridge's threads and forgets their open work without reporting it: runtime.ts#L345-L351. The daemon's exit events cover only threads with an active turn: runtime-manager.ts#L1092-L1135.
  • Claude SDK stream end (CLI killed or crashed). The bridge reports the error but leaves the translator's tasks open: bridge.ts#L1658-L1679.
  • Machine suspension. The server shuts the daemon down (provider-orchestration.ts#L703) and settles nothing.
  • Resumed Claude session. It reports the previous process's task as stopped, as the first message after resume. The fresh translator drops it as an unknown task: task-translation.ts#L380-L382.

The only net is the server's settle when a new daemon instance opens a session: session-owner-side-effects.ts#L78-L111. That net runs only once the machine is back. On this host it worked on 10-21: at resume (15:39:40Z) it settled task be6xpktnu (seq 11376). On 10-22 at 10:50:28Z it did not fire, although a new instance opened the session. Unverified: why. A harness test of that exact sequence passes on main: suspend, resume, the protocol-237 open rejected with 400, then the new instance's open settles the task. The server's Session opened line at 10:50:28Z (with replacedSessionId) would answer it. I could not read that line from the machine.

What you ruled out

Suggested priority and effort (optional)

Medium. The card and its timer lie, and activeBackgroundCommandCount stays above 0, so machine-idle logic that waits for background commands keeps a paid machine up. Message edits are refused with 409 while it lasts. No data is lost. Workaround: bb thread stop the thread. Effort: Medium.

AGENT GENERATED: by Claude (claude-opus-5-5, claude-code) in the reporter's bb thread thr_q4hiimmiqu (private).

Activity

  1. added theissue type on Oct 22, 2026
  2. added
    host
    threads
    provider-claude-code
    confirmed-repro
    on Oct 22, 2026
  3. bb-slop-cop commented on Oct 22, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Medium.
    • Labels: host, threads, provider-claude-code, confirmed-repro.
    • Reproduction and root-cause report: REPRODUCED · confidence: high.
    • Evidence: Graceful runtime shutdown and bridge SIGKILL each leave a started task without a terminal event in two clean checkouts of trusted main (c7a10f237). Both cases fail at the expected settlement assertion; 60 existing lifecycle/recovery tests pass. The report includes the complete reproduction test. Live machine suspension and the reported resume history were not tested.
    • Root cause: Runtime shutdown and provider detachment discard pending background work without emitting task completions; the daemon's turn-level exit handling skips idle threads.
    • No new PR: Settle background tasks when the bridge, Claude Code or the daemon that owns them stops #6124 is already open and linked; a duplicate fix PR is not appropriate.

    AGENT GENERATED

  4. seklow commented on Oct 25, 2026

    @seklow

    Another occurrence on stock bb 0.47.1 (npm), triggered by bb's own in-app update from 0.46.1. Three things this issue does not have yet: (1) the settle for the new daemon instance did run, but skipped the item as a pre-#5650 row (#6124's description notes the same skip on another instance; this is a production hit with 7 items); (2) that skip probably explains why the settle "did not fire" here at 10:50:28Z; (3) the resumed session's local_workflow notification left nothing in the journal.

    Summary

    A claude-code thread on bb 0.46.1 ran a background Workflow (local_workflow) and went idle. The in-app update to 0.47.1 sent SIGTERM to the host daemon, and the Claude Code process and the workflow died with it. After the update the workflow card still shows "17/18 agents" with a spinning E3.5:verify1 and a timer past 18 h, and a page reload does not change it (from the user's report). Observed: at 12:44:11Z the 0.47.1 server ran its settle for the new daemon instance, but it skipped this item with Skipping dangling background task with unparsable item payload. Expected: the item settles as interrupted/stopped, at the latest when the new daemon instance opens its session.

    Versions and environment

    • Now: bb 0.47.1, npm bb-app with in-app updates, Linux x86_64 (Debian 13), Node v24.22.1. Server and host daemon run on the same machine.
    • When it happened: bb 0.46.1 (daemon protocol 237) from task start at 2026-10-24 07:29:23Z until the daemon SIGTERM at 12:43:57Z, then bb 0.47.1 from 12:44:06Z. Sources:
      • the package root in PATH of provider.env-resolved: seq 37758 shows the 0.46.1 root, seq 39515 and seq 40862 show app-versions/0.47.1;
      • bb-app-update.json: 0.46.1 → 0.47.1, outcome updated at 12:44:11.105Z.
    • Provider: claude-code.
      • The process that started the task ran Claude Code 2.1.309. Version 2.1.310 was installed at 12:38Z, but that process kept running 2.1.309 until it died at 12:43:58Z.
      • The processes that resumed the session (13:33Z and 01:27Z) ran 2.1.310, the version installed now.
    • Code references use base commit 7f3414a707a54519749d098165e3a98ff73a4b88 (main as of 2026-10-24). Every cited file is identical in desktop-v0.47.1 and in that commit.

    Steps to reproduce

    Unverified: observed in production, not re-run on purpose. The sequence I observed:

    1. On bb 0.46.1, a claude-code thread starts a background Workflow. bb stores item/started for a backgroundTask item (local_workflow). The 0.46.1 translator writes no foreground field.
    2. The turn completes. The thread is idle while the workflow keeps running.
    3. bb is updated in-app to 0.47.1 while the workflow is still running. The daemon gets SIGTERM, and the Claude Code process and the workflow die with it.
    4. 0.47.1 starts and the new daemon instance opens its session. The server logs the skip warning for the item.
    5. Send any message to the thread. The resumed CLI (same session id) queues a stopped task-notification for the old task; it shows up in its transcript. Nothing is written to the journal.
    6. The card stays "running". TaskStop with the old task id answers "No task found".

    Closest faithful repro for the legacy-row part, which I did not run: the #6124 test "settles a task stored before items carried the foreground flag". It stores an item without foreground and fails unless the legacy upgrade is applied.

    Not checked here: whether a Claude Code process that dies while the daemon stays up (no bb update) also leaves an item open on 0.47.1. This issue already covers that path.

    Expected vs actual

    bb thread log thr_t9xt22j7id --json --all (UTC):
    seq 37772  07:29:23.658Z  item/started    toolCall da02d9fa0e-i3 Workflow (resumeFromRunId <run-id>) -> "Task ID: wcwsxfjkl"
    seq 37773  07:29:23.725Z  item/started    backgroundTask da02d9fa0e-i4 familyId=wcwsxfjkl local_workflow "<workflow>" pending/running
    seq 39177  11:12:30.992Z  turn/completed  da02d9fa0e-t2 (thread idle, workflow running)
    seq 39511  12:41:58.248Z  item/backgroundTask/progress da02d9fa0e-i4 pending/running, 17 agents done, E3.5:verify1 running
    (no item/backgroundTask/completed for da02d9fa0e-i4, neither in the journal nor in bb.db)
    
    server.1.log / host-daemon.1.log:
    12:43:45.090Z  server       {"targetVersion":"0.47.1","targetCommit":null,"msg":"In-app bb update requested"}
    12:43:57Z      host-daemon  Shutting down host daemon {"mode":"shutdown","reason":"SIGTERM"}
    12:44:11.037Z  server       {"level":40,"component":"server","itemId":"da02d9fa0e-i4","threadId":"thr_t9xt22j7id","msg":"Skipping dangling background task with unparsable item payload"}
    
    Resumed process: seq 39512 client/turn/requested 13:33:15Z, seq 39513 thread/identity (same providerThreadId).
    Claude Code transcript, 13:33:16.738Z:
    <\task-notification>
    <task-id>wcwsxfjkl</task-id>
    <status>stopped</status>
    <summary>Background workflow "<workflow>" (run <run-id>) didn't finish before the previous session ended</summary>
    ...
    <\/task-notification>
    Journal: no event from it (no backgroundTask event, no provider/unhandled).
    
    seq 40960/40961  2026-10-25 01:28:14.838Z  TaskStop wcwsxfjkl -> failed:
    <\tool_use_error>No task found with ID: wcwsxfjkl<\/tool_use_error>
    

    Expected: at 12:44:11Z the new-instance settle appends item/backgroundTask/completed with interrupted/stopped for da02d9fa0e-i4. Failing that, bb thread stop should settle it.

    Evidence

    Observed:

    • Missing field in the stored rows. I read bb.db read-only. The raw data of rows 37773 and 39511 has no item.foreground, while rows written by 0.47.1 have it. bb thread log prints foreground: false for the old rows too, so the log alone hides the difference.
    • Pruned snapshots. Earlier progress snapshots of this item were pruned, so 39511 is the last one left. It is the row the settle reads, since the open-task query takes the latest item/started / progress row per item.
    • Other threads hit too. The same warning appeared for 6 more items in 6 other threads within the same 2 ms of this update.
    • How the old process ended. Its transcript ends at 12:43:58Z, one second after the daemon SIGTERM. In it, the E3.5:verify1 agent's tool call is rejected with [Request interrupted by user for tool use].
    • What the notification looks like. In the resumed process it is a transcript record with origin: {kind: "task-notification"}, queueTranscriptOnly: true and no output-file.
    • Controls in the same thread show that the live paths work:
      • The same run, resumed as wqmm8x1pu (item dadd9283c3-i13), settled completed/completed at seq 40857 (18:24:08.939Z), 24 ms after its notification.
      • wmynkg48b, stopped with TaskStop in a live process, settled interrupted/stopped at seq 37650.
      • Of 138 background tasks in the thread, only wcwsxfjkl and one task that is still running have no completion event.

    Suspected cause (from code at 7f3414a):

    1. The settle skips legacy rows.
    2. bb thread stop likely fails the same way. The new-instance settle (session-owner-side-effects.ts#L78-L112) and the thread-stop settle (thread-lifecycle.ts#L1013-L1020, #L1040-L1051) both use this parse. So the workaround named in this issue, bb thread stop, should not settle items whose latest row was written before Show foreground Claude Code commands and subagents as foreground work #5650 (0.47.0). This comes from the code only; I did not run bb thread stop on this thread. Settle background tasks when the bridge, Claude Code or the daemon that owns them stops #6124 sends these reads through convertLegacyStoredThreadEvent, so after it ships the next daemon restart should settle such rows.
    3. This may explain the case in this issue where the settle "did not fire" at 10:50:28Z. Daemon protocol 237 predates Show foreground Claude Code commands and subagents as foreground work #5650, which moved the protocol from 239 to 240; desktop-v0.46.1 ships 237. So the task item there was probably stored without foreground, and a post-Show foreground Claude Code commands and subagents as foreground work #5650 server (249) skips such a row and only logs this warning. This is an inference; grepping that server log at 10:50:28Z for Skipping dangling background task with unparsable item payload would confirm or refute it.
    4. The resumed notification is dropped silently.
    5. The owner's shutdown settled nothing, as this issue describes. The runtime clears its background work on shutdown (runtime.ts#L2599-L2613) and drops stdout while shutting down (runtime-provider-process.ts#L424-L432). 0.46.1, the version that was running, has the same backgroundWorkState.clear() in shutdown().
    6. The UI has no fallback. It treats a local_workflow item as active by status === "pending" alone (build-event-projection.ts#L132-L150), so the orphan stays "running".

    Investigation: bb thread thr_agudxusj98 (private). The user's original report is bb-bug-stale-background-task.md in the thread storage of thr_t9xt22j7id (private). That report put the end of the session down to the session itself; the evidence above shows the bb in-app update killed it.

    What you ruled out

    Suggested priority and effort

    AGENT GENERATED` and links the thread or report.

    AGENT GENERATED

  5. markushha commented on Oct 28, 2026

    @markushha

    Another production hit of the legacy-row skip, on stock bb 0.48.0 (desktop app, macOS 27.0.1). Same cause as seklow's comment above. This is the third report of it, and it confirms the cleanup still skips these rows in 0.48.0. A user-visible card has been stuck "running" for 80+ hours.

    What happened

    • 2026-10-25 09:11:25Z: a claude-code thread starts a local_workflow (long-docs-fix-round4, 3 agents). The stored item/started and the one item/backgroundTask/progress (09:27:52Z) have no foreground field. This build predates Show foreground Claude Code commands and subagents as foreground work #5650.
    • 09:27:53Z: the host daemon session closes (daemon-disconnect), and the workflow dies with it. Claude Code's own run record says status: killed, Error: Workflow aborted.
    • 09:46:41Z: a new daemon instance opens a session with a different instanceId. Later, the same session resumes, and the agent re-runs the remaining work as a new workflow, which settles normally.
    • The original item never gets item/backgroundTask/completed. Its card shows 0/3 agents with spinners and a timer of 80h+. bb restarts and an update to 0.48.0 don't change it.

    Evidence

    Each new-instance settle since then skipped the item (~/.bb/logs/server.*.log):

    2026-10-27T13:22:46Z  WARN  itemId=dae866b177-i721 threadId=thr_mes9m9d9b8  "Skipping dangling background task with unparsable item payload"
    2026-10-27T14:08:03Z  (same)
    2026-10-28T18:20:13Z  (same)
    2026-10-28T18:20:59Z  (same)
    

    In this DB, every backgroundTask event written before the user's Oct 25 update lacks foreground, and every one after it has the field. So any task that a pre-#5650 build left open can never be settled by the server.

    Workaround that confirmed the diagnosis

    With bb quit, I appended an item/backgroundTask/completed for the item: a copy of its last progress payload with status: "interrupted" and taskStatus: "stopped", the same shape appendDanglingBackgroundTaskCompletions writes. After reopening, the card shows as stopped.

    Suggestion

    The legacy-row part of #6124 is small and on its own: run convertLegacyStoredThreadEvent in parseStoredBackgroundTaskItem before safeParse, plus the "settles a task stored before items carried the foreground flag" test. Could it land separately while the larger process-lifecycle changes are in review? It would self-heal every stuck card on the next daemon restart.

    AGENT GENERATED: by Claude (claude-opus-5-5, claude-code) in the reporter's bb thread (private).

  6. seklow commented on Oct 29, 2026

    @seklow

    A lighter workaround until #6124 ships. I verified it on bb 0.48.0 (Linux, npm bb-app) on the 7 items from my comment above. bb does not need to be stopped and no events are written by hand: the fix only adds the missing field, and bb's own settle path writes the completion.

    Why it works. The open rows fail parseStoredBackgroundTaskItem only because foreground is missing (it is required since #5650). Everything else in those rows matches rows written by 0.48.0. Once the field is present, bb thread stop runs settleDanglingBackgroundTasksForStoppedThreadInTransaction. That function appends item/backgroundTask/completed with interrupted/stopped and notifies the thread. A daemon restart (settleDanglingBackgroundTasks) would do the same for all threads.

    Steps (default data dir ~/.bb):

    1. Back up the database:
      sqlite3 ~/.bb/bb.db ".backup $HOME/bb-before-bgtask-fix.db"
    2. Find open background tasks whose latest row lacks the field:
      SELECT e.thread_id, e.item_id, e.id
      FROM events e
      WHERE e.item_kind = 'backgroundTask'
        AND e.type IN ('item/started', 'item/backgroundTask/progress')
        AND json_type(e.data, '$.item.foreground') IS NULL
        AND e.sequence = (
          SELECT MAX(l.sequence) FROM events l
          WHERE l.thread_id = e.thread_id AND l.item_id = e.item_id
            AND l.type IN ('item/started', 'item/backgroundTask/progress'))
        AND NOT EXISTS (
          SELECT 1 FROM events c
          WHERE c.thread_id = e.thread_id AND c.item_id = e.item_id
            AND c.type = 'item/backgroundTask/completed');
    3. Add the field to exactly those rows, in one statement:
      UPDATE events SET data = json_set(data, '$.item.foreground', json('false'))
      WHERE id IN (/* ids from step 2 */);
    4. For each listed thread that is idle or errored, run bb thread stop <thread-id>. It only releases the agent runtime. Skip threads that are in the middle of a turn: the next daemon restart settles those.
    5. Re-run the query from step 2. It should return no rows, and the cards should show as stopped.

    Result here: bb settled all 7 items itself as interrupted/stopped, and no open backgroundTask items are left. This is a direct edit of the database, so keep the backup. It becomes unnecessary once the legacy conversion from #6124 lands.

    AGENT GENERATED

  7. skyremote commented on Nov 2, 2026

    @skyremote

    Another occurrence on stock bb 0.48.1 (Windows 11 desktop), triggered by the desktop quitting to install the 0.48.1 update from 0.46.1.

    Correction (same day): this is the legacy-row skip after all. The foreground: false below comes from bb thread log, which converts legacy events on read (convertLegacyStoredThreadEvent). The row 0.46.1 wrote has no flag, so the host settle that runs when the new daemon instance opens skips it as unparsable. A server test with a stale active session and a new daemon instance fails on desktop-v0.48.1 and passes once the stored row goes through convertLegacyStoredThreadEvent before the schema check, which is the parse part of #6124.

    Reported by Tom Moore; times are UTC on 2 Nov 2026, from bb thread log <id> --json --all.

    seq time event
    137 12:08:55 item/started backgroundTask …-i240, taskType: local_agent, foreground: false, taskStatus: running
    162 12:09:30 item/backgroundTask/progress for i240, still running
    ~12:10 desktop quits to install 0.48.1 (installer writes files 12:10:46 to 12:11:02), bb reopens 12:12:55
    167 12:13:00 turn/completed, status: interrupted
    168 12:13:00 system/error thread_command_failed: "Thread interrupted because the host daemon disconnected"
    169 12:13:00 system/thread/interrupted, reason: host-daemon-restarted
    no item/backgroundTask/completed for i240 through seq 819 (14:06)

    Two later background tasks in the same thread settled normally (one completed, one interrupted/stopped after a stop), so the provider path works; only the task that was open across the full desktop restart is left pending. The card reads "Running background agent" with its timer still counting, and the resumed Claude session keeps the same providerThreadId.

    What this adds: the trigger was a full desktop quit for an update (server and daemon together) on Windows, and the 0.46.1 to 0.48.1 path still produces legacy rows, so the conversion in #6124 matters for anyone updating from 0.46.x.

    Checked against the latest nightly (0.48.2-nightly.41329093127.1): the server bundle has the same settle call sites as 0.48.1.

    AGENT GENERATED

  8. markasoftware-tc commented on Nov 2, 2026

    @markasoftware-tc

    Additional occurrence: stale sidebar terminal icon on bb 0.48.1, with no live watcher process

    The same dangling-task problem affects the sidebar: MorkTile (thr_ssc5wgvdpx) still displays the terminal / “Background command running” indicator although the agent is errored and no corresponding Linux process exists. Observed directly on 2026-11-02; the user reports the process has been gone for days. I verified its absence now, not its historical exit time.

    Investigation: @thread:thr_m6ks6scdfm (private BB thread); affected thread: @thread:thr_ssc5wgvdpx. Written by GPT-6.

    Versions and environment

    • Latest release checked: desktop-v0.48.1; installed bb --version: 0.48.1.
    • Nix-packaged bb-app 0.48.1, web surface, local server and execution host; Ubuntu 24.04.5 LTS.
    • claude-code; currently installed claude --version: 2.1.316 (Claude Code). Provider version at task creation was not established.
    • Inspected source base: 4ac8be40a904aa75983b0947314e18ccc8b6ad34. The live observation is against installed 0.48.1, not a fresh source build.

    Steps to inspect the existing reproduction

    1. On the affected installation, run:
      bb thread list --thread thr_ssc5wgvdpx --json
      bb terminal list --thread thr_ssc5wgvdpx --json
    2. Open MorkTile in the sidebar and inspect its terminal indicator (user-reported visual symptom; no screenshot captured).
    3. Inspect the host process table, outside the agent sandbox:
      ps -eo pid,ppid,lstart,etime,args -ww |
        rg 'thr_ssc5wgvdpx|bokhnt48r|12b25caa-f9f0-4078-9ed5-b6acaa0303df|morktile/'
      Exclude the inspection command itself. I also scanned host /proc/*/cmdline for these identifiers: zero matching processes.

    This verifies the existing affected installation on the latest release. I did not create a fresh thread and reproduce the original process-exit sequence; the exact exit trigger remains unverified.

    Expected vs actual

    Verbatim fields from the thread-list response:

    "status": "error"
    "activeBackgroundCommandCount": 1
    "runtime": {
      "displayStatus": "error"
    }

    Terminal-list output:

    {
      "sessions": []
    }

    The raw database contains only item/started at sequence 12743 for item dacbb564de-i1954, family/task bokhnt48r, description Restart PR watcher (main-only, until end of October), with status: pending, taskStatus: running, and no foreground field. There is no progress/completion event for that item.

    Server log evidence (verbatim):

    {"level":40,"time":1793640981065,"component":"server","itemId":"dacbb564de-i1954","threadId":"thr_ssc5wgvdpx","msg":"Skipping dangling background task with unparsable item payload"}

    The same warning exists at timestamps 1793391814275 and 1793064219591. This is consistent with the legacy-row parsing failure already discussed here; it is not merely a missing periodic process poll.

    Expected: once execution is known to have ended, persist settlement so the activity count and sidebar stop claiming the command is running.

    Code evidence

    At the inspected source base:

    What was ruled out

    • A live matching watcher or original Claude session: none found in the host process table or /proc scan.
    • A persistent BB terminal: terminal list is empty. That alone does not establish process death; the host process check is separate.
    • A client-only cached count: the CLI/server still reports one active background command.
    • No database changes, task cancellation, or restart were performed to clear the symptom.
    • This belongs here rather than a duplicate issue; Settle background tasks when the bridge, Claude Code or the daemon that owns them stops #6124 already proposes lifecycle settlement and legacy-row handling.

    Design decision required

    The broader reconciliation policy requires a design decision; the following are suggestions, not an agreed implementation:

    • Settle tasks on verified owner/session exit and reconcile after daemon restart, including legacy stored events.
    • Consider periodic host/provider reconciliation as a fallback for missed lifecycle events. Use provider task identity or process identity including start time, not a reusable PID alone.
    • Decide how to represent unavailable liveness information (for example, disconnected host or provider without task inspection): “unknown” should not silently become “running” or “stopped.”
    • Persist corrections so timeline and sidebar agree. Do not simply suppress activity for idle/errored agents: their background work can legitimately survive a turn ending.

    AGENT GENERATED

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

    confirmed-reprohostprovider-claude-codethreads

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions