Skip to content

1.47.1: close a background session when Claude Code's background service is off - #68

Closed
writingdeveloper wants to merge 1 commit into
mainfrom
fix/bg-close-service-down
Closed

writingdeveloper wants to merge 1 commit into
mainfrom
fix/bg-close-service-down

Conversation

@writingdeveloper

Copy link
Copy Markdown
Owner

Problem

Closing a Claude Code background session from the sidebar (1.46.0) failed with "Could not close the background session '…' — try claude rm in a terminal", on this PC and on a paired one. Running claude rm <id> by hand on this PC for a session on the other PC answered No job matching.

Cause

claude stop / claude rm talk to Claude Code's background service — an on-demand daemon that exits 50 s after its last client, and is absent after a Claude Code update. With none running, Claude Code 2.1.312 answers couldn't remove <id> — the background service may be restarting. Try again in a moment. and does not start one. Opening claude agents once fixes it, because that starts the service. DevDeck did not read stderr, so the log said only failed.

Fix

  • closeBackgroundAgent: when rm refuses, start the service the way Claude Code itself does (claude daemon run --origin transient — exits on its own once idle), wait for claude daemon status, then stop + rm once more. "No job matching" counts as closed. rm's stderr goes to the diagnostics log.
  • The failure toast names the PC the command has to run on, and the claude agents workaround (ko/en/ja/zh).
  • 5 unit tests; verified against real Claude Code 2.1.312 on Windows (refusal with the service off → stopped / removed once it is up; transient service exits after 50 s idle; a throwaway session closed through the built module).

Release notes: docs/releases/1.47.1.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LdbKDr2tTfCLAZv7WbV8kX

…ice is off

`claude stop` and `claude rm` talk to Claude Code's on-demand background
service, which exits 50 s after its last client and is absent after a Claude
Code update. Without it, Claude Code 2.1.312 answers "couldn't remove <id> —
the background service may be restarting. Try again in a moment." and does not
start one, so closing a background session from the sidebar failed — on this PC
and on a paired one — and the log said only "failed".

- closeBackgroundAgent: when rm refuses, start the service the way Claude Code
  does (`claude daemon run --origin transient`, which exits itself once idle),
  wait for `claude daemon status`, and run stop + rm once more. A session that
  is already gone counts as closed. What rm said on stderr goes to the log.
- The failure toast names the PC the command has to run on; before, it sent
  the user to run `claude rm` on this PC for a session on another one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LdbKDr2tTfCLAZv7WbV8kX
writingdeveloper added a commit that referenced this pull request Oct 27, 2026
…ice is off (#68)

`claude stop` and `claude rm` talk to Claude Code's on-demand background
service, which exits 50 s after its last client and is absent after a Claude
Code update. Without it, Claude Code 2.1.312 answers "couldn't remove <id> —
the background service may be restarting. Try again in a moment." and does not
start one, so closing a background session from the sidebar failed — on this PC
and on a paired one — and the log said only "failed".

- closeBackgroundAgent: when rm refuses, start the service the way Claude Code
  does (`claude daemon run --origin transient`, which exits itself once idle),
  wait for `claude daemon status`, and run stop + rm once more. A session that
  is already gone counts as closed. What rm said on stderr goes to the log.
- The failure toast names the PC the command has to run on; before, it sent
  the user to run `claude rm` on this PC for a session on another one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LdbKDr2tTfCLAZv7WbV8kX
@writingdeveloper

Copy link
Copy Markdown
Owner Author

Merged into main as 08e485f (local squash; released as v1.47.1).

@writingdeveloper
writingdeveloper deleted the fix/bg-close-service-down branch October 27, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant