Skip to content

fix: Open Claude on an ended session resumes it instead of attaching to it - #879

Merged
petre-c merged 2 commits into
mainfrom
worktree-open-asleep-session-through-deskbar
Dec 1, 2026
Merged

petre-c merged 2 commits into
mainfrom
worktree-open-asleep-session-through-deskbar

Conversation

@petre-c

@petre-c petre-c commented Dec 1, 2026

Copy link
Copy Markdown

Deskbar task 7e59e27c

Clicking the Terminal button on a task whose Claude session had ended opened a window that printed "Couldn't wake 06834d9d, Can't open, this session is running in another terminal" and exited.

Why

Claude Code goes on listing an ended background session in claude agents --json, with no pid. Deskbar's resume code only asked whether the session was listed, so that row counted as running:

  • Comments and wakes for the session were refused as "running or being resumed already" and parked in an inbox nobody read. The session in the screenshot had ended at 01:10, and every wake for it was parked until 09:50.
  • A click on Open Claude attached a terminal straight to the row. claude attach then woke the session itself while Deskbar's own wake was compacting it, and the two collided.

There was a second cause too. A message wake of a big cold session compacts first, which takes about 35 seconds, but the click's search for the session gave up after about 10.

What changed

  • ClaudeAgents.Runs(listed, id) asks whether the session is listed with a process. The resume, wake, compact, open and reopen roads in ClaudeSessions, ClaudeTaskActions and ManagerActions, and ManagerSession.Next, use it or HasProcess in place of "is it listed?".
  • Open on a row with no process resumes the session first and attaches only once it runs again. While a wake of that session is under way, the search after a click waits for it rather than counting down.
  • The keeper's queue still counts any listed session as running, on purpose. Otherwise it would wake every task session that ended this way.

Tests: Release -warnaserror build is clean. Deskbar.Core.Tests passes 6051/6051, and the touched Windows test classes pass 231/231 on a hidden desktop. The full hidden-desktop run stopped with an out-of-memory crash in the test host after 2133 passes and no failures, so CI has the full suite.

Release notes

  • Opening a task's terminal when its Claude session has ended now brings the session back and then opens it, instead of failing with "this session is running in another terminal".
  • Comments sent to a task whose session had ended now wake it, instead of waiting unread.
  • The Manager button no longer attaches to a manager session that has ended. It resumes the session or starts a new one.

opus5.5

Petre Chitashvili added 2 commits December 1, 2026 13:13
Claude Code goes on listing a background session whose process has ended,
with no pid. Deskbar's resume roads only asked whether a session was listed,
so such a row counted as running. Comments and wakes for it were refused as
"running or being resumed already" and parked in an inbox nobody read (eight
hours on 2026-12-01). Open Claude attached a window straight to the row, and
`claude attach` then woke the session by itself while Deskbar was taking a
comment to it and compacting it first. The window printed "Couldn't wake ...
this session is running in another terminal".

Running now means listed with a process (ClaudeAgents.Runs). A click on such
a row resumes it through ClaudeSessions.ResumeNow, and the window opens on the
running session that comes back. A click during another wake, compaction
included, waits for that wake instead of giving up after ten seconds.

*opus5.5*
…no process

Review of the first commit found more places that took "listed" for "running": the manager's Next and Gone, the start and resume search (Found), CompactSession, the reopen after a stop, and CanOpen. Each now asks for a row with a process. The keeper's queue keeps counting any listed session on purpose, so it does not wake every task session that ended this way; the comment says so.

*opus5.5*
@petre-c
petre-c merged commit 468be1b into main Dec 1, 2026
1 of 3 checks passed
@petre-c
petre-c deleted the worktree-open-asleep-session-through-deskbar branch December 1, 2026 15:55
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