Skip to content

Commit 69f304a

Browse files
Copilotlpcox
andauthored
fix(api-proxy): mention COPILOT_API_KEY in OpenCode unconfigured error messages
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/c897ec94-027b-4ce5-8d61-e9c34d171ed9 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent b2f07a1 commit 69f304a

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

containers/api-proxy/providers/opencode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function createOpenCodeAdapter(env, { candidateAdapters = [] } = {}) {
185185
statusCode: 503,
186186
body: {
187187
error: {
188-
message: 'OpenCode proxy (port 10004) is not enabled. Set AWF_ENABLE_OPENCODE=true and configure at least one of OPENAI_API_KEY, ANTHROPIC_API_KEY, or COPILOT_GITHUB_TOKEN.',
188+
message: 'OpenCode proxy (port 10004) is not enabled. Set AWF_ENABLE_OPENCODE=true and configure at least one of OPENAI_API_KEY, ANTHROPIC_API_KEY, COPILOT_GITHUB_TOKEN, or COPILOT_API_KEY.',
189189
type: 'provider_not_configured',
190190
provider: 'opencode',
191191
port: 10004,
@@ -197,7 +197,7 @@ function createOpenCodeAdapter(env, { candidateAdapters = [] } = {}) {
197197
statusCode: 503,
198198
body: {
199199
error: {
200-
message: 'Credentials for OpenCode (port 10004) are not configured. Set at least one of OPENAI_API_KEY, ANTHROPIC_API_KEY, or COPILOT_GITHUB_TOKEN.',
200+
message: 'Credentials for OpenCode (port 10004) are not configured. Set at least one of OPENAI_API_KEY, ANTHROPIC_API_KEY, COPILOT_GITHUB_TOKEN, or COPILOT_API_KEY.',
201201
type: 'provider_not_configured',
202202
provider: 'opencode',
203203
port: 10004,

containers/api-proxy/server.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2515,6 +2515,13 @@ describe('provider adapter alwaysBind', () => {
25152515
expect(statusCode).toBe(503);
25162516
expect(body.error.type).toBe('provider_not_configured');
25172517
expect(body.error.message).toMatch(/OPENAI_API_KEY/);
2518+
expect(body.error.message).toMatch(/COPILOT_API_KEY/);
2519+
});
2520+
2521+
it('opencode getUnconfiguredResponse mentions COPILOT_API_KEY when not enabled', () => {
2522+
const adapter = createOpenCodeAdapter({});
2523+
const { body } = adapter.getUnconfiguredResponse();
2524+
expect(body.error.message).toMatch(/COPILOT_API_KEY/);
25182525
});
25192526

25202527
it('opencode getUnconfiguredHealthResponse returns 503 with not_configured status (disabled)', () => {

0 commit comments

Comments
 (0)