Skip to content

fix(core): clarify expired API key responses - #56433

Open
thdxr wants to merge 1 commit into
devfrom
api-key-expired
Open

thdxr wants to merge 1 commit into
devfrom
api-key-expired

Conversation

@thdxr

@thdxr thdxr commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

Companion to the Console expired-key response change.

Type of change

  • Bug fix

What does this PR do?

Keep api_key_expired inference responses intact rather than replacing them with a reconnect instruction. Console config reports the server's key-replacement instructions. Saved keys are retained; OAuth refresh and session errors are unchanged.

How did you verify your code works?

Provider tests: 43 passing, including key persistence, config expiry, OpenAI-compatible and Google-compatible errors. bun run check passes (existing lint warnings).

Screenshots / recordings

Not a UI layout change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊


Added by the opencode bot (AI-generated).

Related: #55675

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The three new tests fail on the base and pass with this change (43/43 in provider-opencode.test.ts), and the packages/core type check passes. I didn't run it end to end, because that needs Console sending a real expired-key response.

Public API: unchanged. The new error tag stays inside the plugin, and the connection status shape is the same (needs_auth + message).

One small point inline: when inference returns an expired-key 401, the Console config isn't re-checked, so the connection status only picks up the key-replacement message on the next periodic check.

Related: #55675

Effect.flatMap(Schema.decodeUnknownEffect(ExpiredInference)),
Effect.option,
)
if (Option.isSome(expired)) return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This early return also skips check(). Before, the 401 re-fetched the Console config right away and updated the connection status. Now the status (with the key-replacement message from ApiKeyExpiredError) stays stale until the next 1-minute check. Could this be { yield* check(); return }? That keeps the upstream response and still updates the status straight away.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant