Skip to content

fix(memory-core): a Windows sharing violation on the head wake ticket no longer rejects the waiter - #8970

Closed
code-yeongyu wants to merge 5 commits into
devfrom
fix/win-ci-kibitzer-wake-slot
Closed

code-yeongyu wants to merge 5 commits into
devfrom
fix/win-ci-kibitzer-wake-slot

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes the Windows-only red in createKibitzerWakeSlot "ten sessions contending for two slots ... admission is FIFO" (senpi-compatibility windows, runs 36312352680 and 36300728869), together with the palace test failures that cascaded from it in the same job.

Root cause (product)

reapDeadHead in packages/memory-core/src/locks/recall-wake-domain.ts reads the head wake ticket to prove its owner dead. On Windows, opening a ticket while its owner is publishing or withdrawing it can fail with a sharing violation (EPERM/EBUSY/EACCES). That error was rethrown, which rejected a queued waiter. The FIFO test saw that as the next waiter "already settled" (wake-slot.test.ts:90). The remaining waiters kept polling after the failed test and threw inside later palace tests ("expected an acquired admission, got busy", with the stack pointing into wake-slot.test.ts:72).

Fix

  • On win32, a sharing violation reading the head ticket keeps that ticket as the queue head until the next normal poll. ENOENT handling, dead-owner reclamation, FIFO order, and bounded waiting are unchanged.
  • Tests: a deterministic regression injects the sharing violation through a narrow ticket-fs seam and proves both waiters acquire in order with no ticket left. The FIFO stress tests (memory-core and the omo-senpi adapter) now abort and drain every waiter in finally, so a failure can no longer leak work into later tests. The old settledAlready race helper is replaced by asserting the admitted order and the live count after every release.
  • Bundles regenerated on linux/amd64 (node 24, bun 1.4.2, build-extension.mjs --check green in the container). The diff is limited to the three bundles that embed memory-core.

QA & Evidence

  • Focused memory-core plus adapter tests: green. Typecheck: tsgo -p packages/memory-core and -p packages/omo-senpi exit 0. Biome clean.
  • Local macOS stress (lane run): 750/750.
  • The 8 palace generator tests time out locally only under extreme host load, identically on base (0/8 on base with the same load), and are unrelated to this change.
  • Windows focused soaks (3 x 10 iterations) are listed in a comment.

Fixes #8953
Refs #8250, #8324


Summary by cubic

Fixes the Windows-only FIFO admission failures in createKibitzerWakeSlot caused by a sharing violation when reading the head wake ticket. On Windows, opening a ticket while its owner publishes or withdraws it can fail with EPERM/EBUSY/EACCES, which previously rejected a queued waiter and let remaining waiters poll into later tests. The unreadable head ticket now keeps its place until the next normal poll; dead-owner reclamation, FIFO order, and bounded waiting are unchanged. The omo-senpi extension bundles that embed memory-core were regenerated.

Tests

  • Adds a deterministic regression that injects the sharing violation and proves both waiters acquire in order with no ticket left.
  • The FIFO stress tests abort and drain every waiter in finally so failures can't leak into later tests.
  • Sharing-violation waiters use a 10 s circuit-breaker budget, and a rejected follower rethrows its own error.

Fixes #8953.

Written for commit 6d601f2. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added omo-senpi Changes under packages/omo-senpi memory-core Changes under packages/memory-core labels Sep 27, 2026
@code-yeongyu

Copy link
Copy Markdown
Owner Author

Focused Windows soaks of the final head (windows-latest, 50 iterations each, wake-slot + recall-wake-domain + palace tests): 36327253718 success, 36327255724 success, 36327257610 success. An earlier 10-iteration soak exposed a 400 ms waiter budget in the new sharing-violation test (the follower reported busy, product unaffected); the test now uses a 10 s circuit breaker, commit 741c06a.

… keeps its place instead of rejecting the waiter (#8953)

Windows can deny opening a wake ticket while its owner publishes or withdraws it (EPERM/EBUSY/EACCES). reapDeadHead threw on that, rejecting a queued waiter, which broke FIFO admission and left the stress test's remaining waiters running into later tests. The unreadable head now keeps its place until the next poll. Tests inject the sharing violation deterministically and abort and drain every waiter on teardown.
…er budget and surface their real error (#8953)

The 400 ms budget covered the whole hand-off (sharing violation, holder release, head acquire and release); a slow Windows runner exceeded it and the follower reported busy (seen 3 times in 150 iterations). The budget is now a 10 s circuit breaker like the FIFO test, and a rejected follower rethrows its own error.
@code-yeongyu
code-yeongyu force-pushed the fix/win-ci-kibitzer-wake-slot branch from 01b50bc to 6d601f2 Compare September 27, 2026 23:08
@code-yeongyu

Copy link
Copy Markdown
Owner Author

Superseded by #8961, which lands this fix together with the other win-ci fixes as one merge (all commits of this branch kept, bundles regenerated once over the merged sources). The evidence in this PR (RED/GREEN, focused Windows soaks) still applies; the issue is closed by #8961's Fixes line.

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

Labels

ci:full-matrix Force the full 3-OS CI matrix on this PR memory-core Changes under packages/memory-core omo-senpi Changes under packages/omo-senpi

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows ticket-sharing EPERM rejects Kibitzer wake waiters and leaks test work

1 participant