fix(agent-manager): resolve live managed worktree sessions - #13422
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (10 files)
Previous Review Summaries (2 snapshots, latest commit fc10629)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit fc10629)Status: No Issues Found | Recommendation: Merge Files Reviewed (7 files)
Previous review (commit e45b944)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (22 files)
Reviewed by grok-4.6 · Input: 149.5K · Output: 23.2K · Cached: 1.2M Review guidance: REVIEW.md from base branch |
marius-kilocode
force-pushed
the
fix-agent-manager-worktree-ownership
branch
from
August 25, 2026 19:55
e45b944 to
fc10629
Compare
marius-kilocode
force-pushed
the
fix-agent-manager-worktree-ownership
branch
from
August 26, 2026 12:25
fc10629 to
83e2772
Compare
marius-kilocode
enabled auto-merge
August 26, 2026 12:51
marius-kilocode
disabled auto-merge
August 26, 2026 12:52
iscekic
approved these changes
Aug 26, 2026
This was referenced Aug 28, 2026
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.
What Problem This Solves
Agent Manager can display a session inside a managed worktree even though the session exists only in the live project listing and has not been recorded in persisted worktree state. Prompt, answer, and move actions previously checked only persisted state, then incorrectly failed with "The session is not managed by this Agent Manager workspace". Stop also needed the exact worktree directory, and a stopped live-only session could become authorized again after restarting VS Code.
Why This Change Was Made
Resolve live-only sessions strictly from the project context that owns the request directory, and accept them only when their worktree is already present in that project's managed state. Persisted state remains authoritative, backend directory verification remains unchanged, and unrelated roots are never searched. Stop registers the verified worktree route and persists a bounded, project-scoped closed-session record. Explicitly attaching the session again clears that record, while deleted worktrees remove their associated records.
User Impact
Prompt, answer, move, and stop work for sessions shown in managed worktrees, including secondary projects and sessions discovered through another Agent Manager surface. Unknown sessions, foreign worktrees, cross-project requests, and stopped sessions remain rejected, including after a full VS Code restart. Existing session history is not deleted or automatically persisted as managed state.
Evidence
kilo servebackend, real SSE orchestration, and a deterministic local OpenAI-compatible provider with no paid credentials..kilo/agent-manager.json.agent_managertool calls for move, prompt, answer to an actual pending question, and stop.bun run test:unit: 4,191 passed, 0 failed across 353 files.bun run typecheck,bun run lint,bun run format:check, andbun run compile: passed.