GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docs(gui): record why the pause path is not cross-gated with the pin … · lidge-jun/opencodex@2ebfe7f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • gui/src/hooks
    • useCodexAccountPool.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎gui/src/hooks/useCodexAccountPool.ts‎

Copy file name to clipboardExpand all lines: gui/src/hooks/useCodexAccountPool.ts
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,14 @@ export function useCodexAccountPool(apiBase: string, enabled = true): CodexAccou
301301
pendingActiveIdRef.current = { id: nextActiveId };
302302
setActiveId(nextActiveId);
303303
}
304+
// Deliberately NOT cross-gated against the switch and order writes, even though
305+
// pausing the pinned account also releases the pin. This edge is conditional on
306+
// the pin still naming `id`, which makes it order-robust: whichever response
307+
// lands last, the client agrees with the server. An unconditional edge is what
308+
// forced the gate between those two -- each states a pin outright, so the later
309+
// response wins regardless of which write the server applied last. Sharing a
310+
// mutation ref here would instead make a pause and an order change on two
311+
// unrelated accounts reject each other for no reason.
304312
if (paused) setActivePinnedId(current => current === id ? null : current);
305313
void load();
306314
return { ok: true } as const;
@@ -375,6 +383,9 @@ export function useCodexAccountPool(apiBase: string, enabled = true): CodexAccou
375383
pendingActiveIdRef.current = { id: nextActiveId };
376384
setActiveId(nextActiveId);
377385
}
386+
// Conditional for the same reason as the single-account pause above: clearing
387+
// outright would race the switch and order writes, which is why those two are
388+
// gated against each other and these two do not need to be.
378389
setActivePinnedId(current => current !== null && pausedIds.has(current) ? null : current);
379390
void load();
380391
return { ok: true, pausedCount: result.pausedCount ?? pausedIds.size } as const;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.