Skip to content

test(global-workspace): wait for startup recovery before seeding in_progress tasks - #146

Merged
Lexus2016 merged 1 commit into
mainfrom
test/global-workspace-startup-race
Nov 16, 2026
Merged

Lexus2016 merged 1 commit into
mainfrom
test/global-workspace-startup-race

Conversation

@Lexus2016

Copy link
Copy Markdown
Owner

Problem

test/global-workspace.test.js failed in roughly 1 of 7 runs:

  • totals count every task in every project — expected [8,4,1,2,1], got [8,4,2,1,1]
  • Beta rolls up its own tasks only — expected [4,1,1,1,1], got [4,1,2,0,1]

server.js runs a startup recovery in setTimeout(..., 3000) ("Kick off on startup — smart recovery for in_progress tasks") that moves every in_progress task with no live worker to todo, then calls processQueue(). The suite seeds its in_progress fixtures as soon as setup completes (~1 s after boot). When the overview was read after the 3 s mark, both fixtures had been flipped to todo, and processQueue() then picked the past-due "alpha overdue run" back up — leaving exactly todo=2 / in_progress=1 with Beta's task in todo.

Change

  • server.js: one unconditional console.log('[startup] in_progress recovery complete') at the end of that callback, after processQueue(), with a comment saying why it exists. console, not log, because the suite boots with LOG_LEVEL=error.
  • test/global-workspace.test.js: before creating fixtures, wait (polling, 30 s bound) for that line in the server output the suite already captures. No fixed sleep; assertions unchanged.

Proof

  • Throwaway local edit (not committed) adding a 4 s pause after the fixtures are created: 3/3 fail on main with the exact signature above, 3/3 pass with this change.
  • Real test file, 5 consecutive runs with this change: 5/5 PASS, 48 passed, 0 failed.
  • Cost: overview is now read at ~4.6 s instead of ~2.1 s after start (+~2.5–3.5 s per run).

…rogress tasks

server.js re-arms every in_progress task with no live worker in a
setTimeout(..., 3000) after boot. The suite seeds in_progress fixtures as
soon as setup completes, so on a slow run the recovery pass flipped them to
todo before the overview was read (1 in ~7 runs failed the totals and Beta
rollup checks).

The recovery callback now prints an unconditional
'[startup] in_progress recovery complete' line after processQueue(), and the
test waits for it in the captured server output before creating fixtures,
instead of relying on a fixed sleep.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T08:30:48.740967Z 624c2c7 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.

@Lexus2016
Lexus2016 merged commit b40b0a2 into main Nov 16, 2026
3 checks passed
@Lexus2016
Lexus2016 deleted the test/global-workspace-startup-race branch November 16, 2026 08:44
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