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
5 changes: 5 additions & 0 deletions .changeset/fast-agent-manager-diffs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

Load Agent Manager worktree diffs faster and keep warmed reviews visible when switching worktrees.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class AgentManagerProvider implements Disposable {
log: (msg) => this.log(msg),
})
const local = createLocalDiff(this.gitOps, (...args) => this.log(...args))
this.diffCatalog = new DiffSourceCatalog(this.connectionService)
this.diffCatalog = new DiffSourceCatalog(this.connectionService, local)
this.diffs = new WorktreeDiffController({
getState: () => this.getStateManager(),
getRoot: () => this.getRoot(),
Expand Down
13 changes: 8 additions & 5 deletions packages/kilo-vscode/src/agent-manager/GitOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ interface ExecOptions {
env?: NodeJS.ProcessEnv
stdin?: string
timeout?: number
signal?: AbortSignal
}

export interface ExecResult {
Expand Down Expand Up @@ -594,12 +595,12 @@ export class GitOps {
* suitable for callers that need to tolerate legitimate failures (e.g.
* `merge-base` on an orphan branch, `ls-files --error-unmatch`).
*/
execGit(args: string[], cwd: string, options?: { stdin?: string }): Promise<ExecResult> {
execGit(args: string[], cwd: string, options?: { stdin?: string; signal?: AbortSignal }): Promise<ExecResult> {
return this.exec(args, cwd, options)
}

execGitBuffer(args: string[], cwd: string): Promise<ExecBufferResult> {
return this.execBuffer(args, cwd)
execGitBuffer(args: string[], cwd: string, options?: { signal?: AbortSignal }): Promise<ExecBufferResult> {
return this.execBuffer(args, cwd, options)
}

private async exec(args: string[], cwd: string, options?: ExecOptions): Promise<ExecResult> {
Expand All @@ -616,7 +617,7 @@ export class GitOps {
return { code: 1, stdout: Buffer.alloc(0), stderr: "GitOps disposed" }
}
const invoke = () => this.invoke(cmd, args, cwd, options)
return this.semaphore ? this.semaphore.run(invoke) : invoke()
return this.semaphore ? this.semaphore.run(invoke, options?.signal) : invoke()
}

private executable(): Promise<string> {
Expand All @@ -642,7 +643,7 @@ export class GitOps {
}

private invoke(cmd: string, args: string[], cwd: string, options?: ExecOptions): Promise<ExecBufferResult> {
if (this.controller.signal.aborted) {
if (this.controller.signal.aborted || options?.signal?.aborted) {
return Promise.resolve({ code: 1, stdout: Buffer.alloc(0), stderr: "GitOps disposed" })
}

Expand All @@ -664,6 +665,7 @@ export class GitOps {
: undefined

this.controller.signal.addEventListener("abort", abort, { once: true })
options?.signal?.addEventListener("abort", abort, { once: true })
child.stdout?.on("data", (chunk: Buffer) => out.push(chunk))
child.stderr?.on("data", (chunk: Buffer) => err.push(chunk))

Expand All @@ -673,6 +675,7 @@ export class GitOps {
child.on("close", (code) => {
if (timeout) clearTimeout(timeout)
this.controller.signal.removeEventListener("abort", abort)
options?.signal?.removeEventListener("abort", abort)
resolve({
code: code ?? 1,
stdout: Buffer.concat(out),
Expand Down
Loading
Loading