fix: add a Default agent permission choice and stop forwarding cookies to OpenCode (OM-179)

Each agent permission select now offers Default, shown when the agent has no wildcard rule for the action. Choosing Allow, Ask or Deny writes an agent rule even when it matches the inherited effect; choosing Default removes the agent's wildcard rules so the global permission applies.

The local OpenCode proxy drops the browser's Cookie header, as the linked-server proxy already does.
This commit is contained in:
Chris Scott committed 2026-11-05 15:58:53 -05:00
1 parent 38d618be9b
commit 670c66f85b
4 files changed
+64 -24

No files matched your search

@@ -46,7 +46,7 @@ describe('OpenCodeClient', () => {
const basicAuth = 'Basic dXNlcjpwYXNz'
describe('forwardRaw', () => {
it('should strip /api/opencode prefix from path, preserve search string, and strip host/connection/authorization headers', async () => {
it('should strip /api/opencode prefix from path, preserve search string, and strip host/connection/authorization/cookie headers', async () => {
const mockResponse = new Response(JSON.stringify({}), { status: 200 })
let capturedUrl: URL | undefined
let capturedInit: RequestInit | undefined
@@ -63,6 +63,7 @@ describe('OpenCodeClient', () => {
'Host': 'localhost:5003',
'Connection': 'keep-alive',
'Authorization': 'Bearer token',
'Cookie': 'session=manager',
'X-Custom-Header': 'value',
},
})
@@ -78,6 +79,7 @@ describe('OpenCodeClient', () => {
expect((capturedInit?.headers as Record<string, string>)['host']).toBeUndefined()
expect((capturedInit?.headers as Record<string, string>)['connection']).toBeUndefined()
expect((capturedInit?.headers as Record<string, string>)['authorization']).toBeUndefined()
expect((capturedInit?.headers as Record<string, string>)['cookie']).toBeUndefined()
expect((capturedInit?.headers as Record<string, string>)['x-opencode-directory']).toBe(encodeURIComponent('/test/workspace'))
})