Repository navigation
π Sessions: delete runs in the background with visible progress, and can no longer leave a session listed whose files are gone - #18770
Merged
Conversation
β¦r leaves a record whose files are gone Deleting an ended session ran inside the request under the 10-second tmux command timeout. A sandbox with a CLI's caches outlasts it; the cancel ran 'su-exec root kill', which cannot work (the image has no kill binary), so rm finished by itself and the cancel's error was reported over a removal that had succeeded. The files were gone, the record was kept, and the dashboard said the files could not be removed, a minute later. - DELETE on an ended or failed session answers 202; the record is 'deleting' and one job per session id removes the files, then the record, last - removal has its own 15-minute ceiling; what is on disk decides the outcome - the cancel of a root child uses the shell's builtin kill - a failure puts the record back with delete_error; the UI shows it and offers Retry delete - the reconciler restarts an interrupted delete and drops an ended record whose sandbox and worktree are both gone - only a real failure to adopt a strictly newer usable login blocks a delete, with a clear reason; nothing to adopt is success - one log line with the duration and one session_closed audit per outcome Fixes #18767 Signed-off-by: Andy Anderson <andy@clubanderson.com>
This was referenced Nov 17, 2026
Contributor
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18767
What was wrong
Deleting an ended session from the Sessions section looked like it did nothing. The request stayed open for about a minute with no indicator, the dashboard then said "could not remove the session's files" although the files had been removed, and the session stayed listed.
The code path:
handleSessionDeletecalledUserSessionRuntime.Removeinside the request.Removedeleted the sandbox withprivRun, which is bound to the 10-seconduserSessionCmdTimeoutthat exists for tmux calls. A HOME with a CLI's caches takes longer.su-exec root kill -KILL -- -<pgid>.killis a shell builtin and the image has nokillbinary, so the cancel failed ("su-exec: kill: No such file or directory"). Go then waited forrmto finish by itself and returned the cancel's error.The pre-delete login check from #18728 was not the cause: it runs before anything is removed and returns success when there is nothing to adopt.
What changed
DELETE /api/sessions/{id}on an ended or failed session answers 202 at once; the record isdeleting. One job per session id removes the files and then the record, last. A second request, a list or a sweep never starts a second removal.kill(sh -c 'kill -s KILL -- -$1 ...'). That was the only user of the broken helper.delete_error. Only a real failure to adopt a strictly newer, usable login blocks a delete on the login side, and it says so: "this session holds the hive's current sign-in; adopting it failed: ...". Nothing is removed in that case.deletingrecord with no job (hive restarted mid-delete) gets its job restarted. Anendedrecord whose sandbox and worktree are both gone is dropped by the reconciler (boot sweep and every list), and a delete click on one completes at once with 200removed: true.dashboardSetIntervalpoll while a session is deleting, the tab disappears when the record is gone, and a failure brings it back with the reason, a toast and a Retry delete button. Closing a running session no longer drops the tab locally only for the next poll to bring it back.session_closedaudit entry per outcome, failures included.DELETE ...?remove=trueon a running session closes and deletes it. A record a restart leftpreparingcan be deleted.The start path already shows progress (
preparingwith a spinner and the server's message), so it is unchanged.Notes for review
hive-session/<id>branch, a resume gets it back), sandbox, then the record. A failure after the worktree step leaves a session that can still be resumed or deleted again.Removeinline; it was not part of this report.Tests
Removed; the kill script ends a real process group with an emptyPATH.Synthetic credentials only.
π€ Generated with Claude Code