GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — fix(core): resolve coherent state before OAuth refresh by kitlangton · Pull Request #45810 · anomalyco/opencode Conversation
|
| Operation | Contract |
|---|---|
state.get() |
Return the last published value immediately, without rebuilding or waiting. Unchanged. |
state.resolve() |
Materialize completed registration/disposal changes or join an in-progress rebuild, then return the published value. |
state.reload() |
Keep the existing debounced replay behavior. Resolution does not wait out a scheduled reload's debounce. |
Integration.connection.resolve uses the returned value to find its OAuth refresh implementation:
const current = yield* state.resolve() const implementation = current.integrations .get(credential.integrationID) ?.implementations.get(credential.value.methodID)
Other State reads remain unchanged. There is no caller-visible State.flush() or plugin-activation wait on this path.
The existing State semaphore owns the pending-work decision, rebuild, and returned value. Pending registrations become clean only when the replacement value is published, so a failed replay remains resolvable. Successful resolution absorbs the current batch's queued rebuild.
Waiting for the semaphore remains interruptible. Once resolution starts rebuilding, publication and notification finish together before interruption propagates. OAuth network refresh runs after State resolution has released the semaphore.
sequenceDiagram
participant P as Plugin setup
participant I as Integration resolver
participant S as State
participant O as OAuth provider
P->>S: Register refresh implementation inside batch
P->>I: Resolve stored connection
I->>S: resolve()
S->>S: Join or rebuild under semaphore
S-->>I: Published registry; semaphore released
I->>O: Refresh expired credential
O-->>I: Fresh credential
I-->>P: Persisted fresh credential
This owns State registration visibility and the OAuth refresh-handler lookup, not plugin installation, cross-registry transactions, or Console inventory recovery. It retains nonblocking discovery reads and does not change the broader activation policy. #45759 can remove its plugin-side registration-visibility workaround after this lands.
Run with Bun 1.4.0 from packages/core:
bun run test test/state.test.ts test/integration.test.ts bun run test test/state.test.ts \ --test-name-pattern 'concurrent resolution|queued resolution|replay fails' \ --rerun-each 100 bun typecheck bun run test
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9545bb3 to
911a399
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.