fix(tui): treat global events as default location for integration refresh

The v2 integration refresh converted event metadata directly into a
Location.Ref, so the global routing sentinel (directory "global") was
sent to the server as a real filesystem location. LocationServiceMap
built the full project graph for it, and Fff.create({ basePath: "global" })
failed on every refresh after OAuth callback disposal. Map global events
back to the current default location instead.
This commit is contained in:
marius-kilocode
2026-07-21 15:23:25 +02:00
parent d9cf6ebaa3
commit d054f394e4
2 changed files with 22 additions and 1 deletions
+7 -1
View File
@@ -56,6 +56,12 @@ function locationQuery(ref?: LocationRef) {
return ref ? { directory: ref.directory, workspace: ref.workspaceID } : undefined
}
export function eventLocation(metadata: { directory: string; workspace?: string }): LocationRef | undefined {
// kilocode_change - "global" is an event-routing sentinel, not a filesystem location.
if (metadata.directory === "global") return
return { directory: metadata.directory, workspaceID: metadata.workspace }
}
export const { use: useData, provider: DataProvider } = createSimpleContext({
name: "Data",
init: () => {
@@ -439,7 +445,7 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
void result.location.reference.refresh()
break
case "integration.updated":
void result.location.integration.refresh({ directory: metadata.directory, workspaceID: metadata.workspace })
void result.location.integration.refresh(eventLocation(metadata)) // kilocode_change
break
}
} // kilocode_change
+15
View File
@@ -0,0 +1,15 @@
import { describe, expect, test } from "bun:test"
import { eventLocation } from "../../src/context/data"
describe("eventLocation", () => {
test("uses the default location for global events", () => {
expect(eventLocation({ directory: "global" })).toBeUndefined()
})
test("preserves project event locations", () => {
expect(eventLocation({ directory: "/repo", workspace: "wsp_test" })).toEqual({
directory: "/repo",
workspaceID: "wsp_test",
})
})
})