Repository navigation
feat(agent-manager): allow sessions to move their worktree between sections or ungroup #12815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marius-kilocode
merged 4 commits into
main
from
allow-agent-manager-to-reassign-session-sections
Aug 3, 2026
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b836461
feat(agent-manager): allow sessions to move their worktree between se…
marius-kilocode 5d248d8
chore: remove local PR screenshot
marius-kilocode 2f03f2d
style(vscode): format agent manager orchestration
marius-kilocode 1310ba2
fix(agent-manager): protect state paths on Windows
marius-kilocode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "kilo-code": patch | ||
| --- | ||
|
|
||
| Allow Agent Manager sessions to move their worktree between sections or ungroup it through the `agent_manager` tool. |
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
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
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
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
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
11 changes: 11 additions & 0 deletions
11
packages/opencode/src/kilocode/agent-manager/protection.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import * as path from "path" | ||
|
|
||
| export function assertMutablePath(filepath: string) { | ||
| const parts = filepath.split(path.sep) | ||
| const file = parts.at(-1) | ||
| const dir = parts.at(-2) | ||
| if (file !== "agent-manager.json" || ![".kilo", ".kilocode"].includes(dir ?? "")) return | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SUGGESTION: This guard is global and unconditional, with no escape hatch Two things worth confirming are intended:
Reply with |
||
| throw new Error( | ||
| "Do not edit Agent Manager state directly. Use the agent_manager tool: call action=list to read section and session IDs, then call action=move with the returned IDs.", | ||
| ) | ||
| } | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Splitting on
path.sepwithout normalizing lets the guard be bypassededit.tsandwrite.tspassparams.filePaththrough verbatim when it is absolute (path.isAbsolute(params.filePath) ? params.filePath : path.join(...)), soassertMutablePathcan receive an unnormalized path:path.sepis\, but a model commonly emits forward slashes.C:/proj/.kilo/agent-manager.jsonsplits into a single element,filebecomes the whole string, and the guard returns early — the write goes through./proj/.kilo/./agent-manager.jsonyieldsdir === ".", and/proj/.kilo//agent-manager.jsonyieldsdir === "". Both bypass the check.(
apply_patch.tsis fine because it resolves the path first.) Normalizing fixes all three cases:Reply with
@kilocode-bot fix itto have Kilo Code address this issue.