Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/update-from-base-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"kilo-code": patch
---

Allow Update from base to dismiss unanswered questions without bypassing permission approvals.
Allow Update from base to dismiss unanswered questions and preserve local work with recovery data isolated per worktree, without asking how to save it or bypassing permission approvals.
3 changes: 2 additions & 1 deletion packages/kilo-vscode/src/agent-manager/base-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function baseUpdatePrompt(worktree: Worktree): string {
: `Resolve the upstream of the saved base branch ${JSON.stringify(worktree.parentBranch)} to its remote and exact branch ref. If the base is local-only or cannot be resolved, stop and ask me which source to use. Do not guess a remote or silently use a local branch.`,
"Check the worktree's current branch and Git status first. Do not switch branches. If HEAD is detached or a merge or rebase is already in progress, stop and ask rather than starting a competing operation.",
"Fetch the exact remote base, then resolve FETCH_HEAD^{commit} and merge that freshly fetched commit ID. If fetch or ref resolution fails, stop. Never merge a stale tracking ref, switch sources silently, or use git pull.",
"Never use git stash, --autostash, or automatic stashing. Disable merge.autoStash for the merge. Do not discard, overwrite, stage, or commit pre-existing edits. If uncommitted changes in this worktree block the merge, stop and ask how to preserve them.",
"Do not use the shared stash stack or --autostash to preserve edits. Disable merge.autoStash for the merge. Git's internal temporary merge state is allowed if it does not change the shared stash stack.",
"Preserve all staged, unstaged, and untracked changes in a verified recovery copy unique to this worktree and this update before changing them. Never restore or remove another worktree's recovery data. If preservation cannot be verified, stop and ask before clearing any edits. You may temporarily clear backed-up edits to merge the base. Resolve conflicts, restore local changes and their staging state, and leave unfinished work uncommitted. Keep pre-existing edits out of the merge commit. Keep the recovery copy until restoration is verified. Do not ask me to choose a preservation method.",
"Resolve conflicts while preserving both branches' intent. If the intended resolution is unclear, stop and ask. Then run relevant tests, lint, and type checks. Keep normal tool permissions and approvals. Do not push, merge a PR, or apply this worktree into the base.",
].join("\n\n")
}
Expand Down
25 changes: 21 additions & 4 deletions packages/kilo-vscode/tests/unit/base-update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,8 @@ it("asks the agent to resolve the saved base upstream and stop for local-only or
expect(text).toContain("Never merge a stale tracking ref")
for (const safeguard of [
"FETCH_HEAD^{commit}",
"git stash, --autostash",
"Do not use the shared stash stack or --autostash",
"merge.autoStash",
"Do not discard",
"stage, or commit pre-existing edits",
"uncommitted changes in this worktree block",
"intended resolution is unclear, stop and ask",
"merge or rebase is already in progress",
"HEAD is detached",
Expand All @@ -127,6 +124,26 @@ it("asks the agent to resolve the saved base upstream and stop for local-only or
expect(text).toContain(safeguard)
})

it("asks the agent to preserve local work without asking the user to choose a method", () => {
const text = baseUpdatePrompt(wt)
for (const safeguard of [
"Preserve all staged, unstaged, and untracked changes",
"verified recovery copy unique to this worktree and this update before changing them",
"Never restore or remove another worktree's recovery data",
"Git's internal temporary merge state is allowed if it does not change the shared stash stack",
"If preservation cannot be verified, stop and ask before clearing any edits",
"You may temporarily clear backed-up edits to merge the base",
"restore local changes and their staging state",
"leave unfinished work uncommitted",
"Keep pre-existing edits out of the merge commit",
"Keep the recovery copy until restoration is verified",
"Do not ask me to choose a preservation method",
])
expect(text).toContain(safeguard)
expect(text).not.toContain("stop and ask how to preserve them")
expect(text).not.toContain("Do not discard, overwrite, stage, or commit pre-existing edits")
})

it("sends one prompt to the owning worktree, queues on its busy session, and leaves drafts alone", async () => {
const api = backend()
ctx.stateManager().addSession("ses_target", wt.id)
Expand Down
Loading