Skip to content

Unit flakes in shard 2/4: the ipc artifactScope case's spawn order, the grid live-count case's shared arm - #368

Merged
SSFSKIM merged 2 commits into
masterfrom
fix/unit-shard2-flakes
Oct 30, 2026
Merged

SSFSKIM merged 2 commits into
masterfrom
fix/unit-shard2-flakes

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Two unit cases that failed intermittently in class 1a, always in unit shard 2/4 and on branches that don't touch either file. Both files sit in shard 2/4 because vitest assigns files to shards by the SHA-1 of their path, so the shard is where they land, not a shared cause. Load makes both races more likely, but the two causes are separate.

src/engine-host/ipc.test.ts: the artifactScope case

Cause. session.launch answers before its process spawns: EngineSession.run awaits loadState() (several fs reads) before opts.spawn(plan) (src/engine-host/session.ts). The case launched the parent and the thread back to back and gave out transports from a queue in spawn order. When the thread spawned first, parentT belonged to the thread and threadT to the parent. artifact_create then ran as the thread, and artifact_read ran as the parent, whose lineage has no "dash". The refusal artifact_read: no artifact "dash" in this session reached JSON.parse as Unexpected token 'a', "artifact_r"....

Fix. The case waits for the parent to be ready before it launches the thread, as the file's other multi-session cases already do.

Evidence.

  • With master's case, 150 repeats in one process on this Mac (load average about 15), run three times: 12, 17 and 21 of 150 failed, all 50 with the CI signature.
  • The fixed case passed 3 × 150 of 150.
  • A deterministic reproducer that holds the parent's loadKeep back by 50 ms fails master's case with the exact CI error and passes the fixed one.

apps/desk-hub/test/session-plane.test.ts: the grid's live count

Cause. The suites' Registry seam nextSummaryAsPrevious() set one org-wide in-memory flag, which the next summary report from any project consumed (test/support/worker-under-test.ts). Earlier cases' projects keep reporting during this case (a lease that lapses after its machine closed, an unacknowledged report's retry). When one of those reports reached the Registry first, it took the arm, and the case's own report was taken with live. The awaited working: 1, live: 0 frame never came. The CI failures show exactly this: the case's own project arrives as working: 1, live: 1 next to other projects' summaries.

Fix. The arm is kept per project in the Registry's kv (summary-as-previous:<project>, armed with nextSummaryAsPrevious(project)), and other projects' reports pass through unchanged.

Evidence. A reproducer reports another project to the Registry between the arm and the case's own report:

  • On master's seam it fails with the CI error, the case's project showing working: 1, live: 1.
  • With the per-project arm it passes.

Gate

Class 1a (static, unit, probes on the pool) was green on the first attempt for head a161480 (tree 2313b0af2): run 41011792774. An independent review (doperpowers:reviewer-medium) had no material findings.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)

… the parent is up, not on spawn order

session.launch answers before its process spawns (EngineSession.run loads the session's state first), so the parent's
and the thread's launches, both in flight, spawned in either order, and the case's queue handed the parent's transport to
whichever spawned first. When the thread won, the parent's artifact_create ran as the thread and the thread's
artifact_read ran as the parent, whose lineage holds no "dash": the refusal `artifact_read: no artifact "dash" in this
session` reached JSON.parse as `Unexpected token 'a', "artifact_r"...`. Under load the old order failed 50 of 450
repeats; the case now waits for the parent's ready before launching the thread, and passed 450 of 450.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…es its project

The suites' Registry armed one org-wide flag that the next summary report of any project consumed. Reports of earlier
cases' projects (a lease lapsing after its machine closed, a retry) keep reaching the Registry during the grid's
live-count case, so one of them could take the arm before the case's own report; that report was then taken with
`live`, the frame `working: 1, live: 0` never came, and the case failed listing other projects' summaries. The arm is
now kept per project (`nextSummaryAsPrevious(project)`), and other projects' reports pass as they are.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T06:09:06.892895Z a161480 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit ee9fd68 into master Oct 30, 2026
SSFSKIM added a commit that referenced this pull request Oct 30, 2026
…d live-count row closed, the IPC item of the 2026-10-28 unit-flakes row dropped

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 30, 2026
…les)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant