Skip to content

Commit c16e521

Browse files
fix: snapshot the reload count after the pre-registration read
A reload finishing while the read was in flight counted as covering it, which could skip a reload a later rejection made necessary. Taking the snapshot after the read errs toward one extra reload instead. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm
1 parent c64a48c commit c16e521

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎packages/opencode/src/server/server.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,10 @@ export namespace Server {
787787

788788
// Read before registering: a credential that was rejected, expired or logged out and is
789789
// now reissued with identical fields still has to reload, and only this read sees that.
790-
const generationAtStart = baseReloadGeneration
791790
const before = await FreeTier.credentials().catch(() => undefined)
791+
// Snapshot after the read: a reload that finished during it must not count as covering
792+
// it. Erring this way costs at most one extra reload, never a stale directory.
793+
const generationAtStart = baseReloadGeneration
792794
const gate = FreeTierConsent.createRegistrationGate({
793795
register: () => FreeTier.register({ origin: "server" }),
794796
onUnexpectedError: (error) => log.error("Altimate Base registration failed", { error }),

0 commit comments

Comments
 (0)