fix: always override directory query param when slug header is present

The TUI sends its local CWD as directory=... (e.g. /Users/chris) but the
managed opencode needs the repo's actual fullPath. Previously the proxy
only set directory if missing, so the TUI's local path leaked through.

Now when x-opencode-manager-project header is set, the repo's fullPath
always replaces any client-supplied directory value.
This commit is contained in:
Chris Scott committed 2026-04-20 23:34:43 -04:00
1 parent 4407ad15fb
commit 7870e97c38
2 files changed
+2 -6

No files matched your search

+1 -3
View File
@@ -117,9 +117,7 @@ export function attachWorkspacePluginWs(server: Server, options: WebSocketProxyO
return
}
const targetUrlObj = new URL(targetUrl)
if (!targetUrlObj.searchParams.has('directory')) {
targetUrlObj.searchParams.set('directory', project.directory)
}
targetUrlObj.searchParams.set('directory', project.directory)
targetUrl = targetUrlObj.toString()
}
+1 -3
View File
@@ -314,9 +314,7 @@ export async function proxyRequest(request: Request, projectService?: ProxyProje
return new Response('Unknown project', { status: 404 })
}
const targetUrlObj = new URL(targetUrl)
if (!targetUrlObj.searchParams.has('directory')) {
targetUrlObj.searchParams.set('directory', project.directory)
}
targetUrlObj.searchParams.set('directory', project.directory)
targetUrl = targetUrlObj.toString()
}