[PR #8075] fix: await auth.set to prevent race condition when setting API key #12611

Closed
opened 2026-02-16 18:17:30 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8075

State: closed
Merged: Yes


Summary

Fixes #8073

  • Added await to the auth.set() call in the /model dialog to ensure the API key is persisted before instance.dispose() and sync.bootstrap() run

Root Cause

The auth.set() call was not being awaited, causing a race condition where the bootstrap would happen before the auth data was written to disk. This resulted in the API key not being loaded after entry, requiring a restart.

Reproduction of the bug

https://github.com/user-attachments/assets/e2285eca-bb87-4590-bcce-67c21ae00b96

Bug fix

https://github.com/user-attachments/assets/7ced70c2-6723-4fb9-a849-23829adcf720

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8075 **State:** closed **Merged:** Yes --- ## Summary Fixes #8073 - Added `await` to the `auth.set()` call in the `/model` dialog to ensure the API key is persisted before `instance.dispose()` and `sync.bootstrap()` run ## Root Cause The `auth.set()` call was not being awaited, causing a race condition where the bootstrap would happen before the auth data was written to disk. This resulted in the API key not being loaded after entry, requiring a restart. ## Reproduction of the bug https://github.com/user-attachments/assets/e2285eca-bb87-4590-bcce-67c21ae00b96 ## Bug fix https://github.com/user-attachments/assets/7ced70c2-6723-4fb9-a849-23829adcf720
yindo added the pull-request label 2026-02-16 18:17:30 -05:00
yindo closed this issue 2026-02-16 18:17:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12611