fix(agent-manager): prevent PTYs escaping worktree cleanup - #13221
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (7 files)
Previous Review Summaries (4 snapshots, latest commit b08c421)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit b08c421)Status: No Issues Found | Recommendation: Merge Files Reviewed (6 files)
Previous review (commit d3b5a27)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (39 files)
Fix these issues in Kilo Cloud Previous review (commit 9c77473)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (39 files)
Fix these issues in Kilo Cloud Previous review (commit c564e4a)Status: 8 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Files Reviewed (34 files)
Reviewed by grok-4.6 · Input: 56.5K · Output: 7.1K · Cached: 358.7K Review guidance: REVIEW.md from base branch |
marius-kilocode
force-pushed
the
make-pty-processes-durable-across-reloads
branch
from
August 19, 2026 13:03
c564e4a to
ac6ecc8
Compare
marius-kilocode
force-pushed
the
make-pty-processes-durable-across-reloads
branch
from
August 19, 2026 14:08
d3b5a27 to
8038220
Compare
marius-kilocode
enabled auto-merge
August 20, 2026 13:04
WebReflection
approved these changes
Aug 21, 2026
WebReflection
left a comment
There was a problem hiding this comment.
I think it needs a rebase (plus green "light" in CI after) but looks good to me, we can ignore my comment.
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.
Worktree deletion can race with Agent Manager terminal creation. A regular embedded terminal, Run script, or Setup script can finish creating after cleanup has listed existing PTYs, leaving a shell rooted in a deleted worktree.
This change keeps the fix limited to Agent Manager. Worktree deletion now blocks regular and script PTY creation, waits for in-flight creates, closes known terminals, and performs the existing backend PTY cleanup before deleting the worktree. The block remains active through disk deletion and is released in a finally path. Worktree state is removed only after disk cleanup succeeds, so cleanup failures remain retryable.
The CLI PTY registry, server shutdown behavior, public API, SDK, process-tree termination, and persisted session lifecycle are unchanged. Project catalog removal and backend session deletion remain separate follow-ups.