Skip to content

Tests: poll pots commands without blocking the fake model - #131

Merged
Crokily merged 2 commits into
mainfrom
tests-faster
Dec 4, 2026
Merged

Crokily merged 2 commits into
mainfrom
tests-faster

Conversation

@Crokily

@Crokily Crokily commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

What was wrong. children, nesting and mcp polled pots children in waitFor with the synchronous gateway.pots (execFileSync). A pots command takes 1-2 s on this host. Each poll blocked the test process for that time, and the fake model, which runs in the test process, could not answer meanwhile.

What changed.

  • TestGateway.command(...): runs a pots command as gateway.run does (no block) and returns its output; throws when it fails, as pots() does. waitFor takes an async check.
  • children, nesting and mcp use it for every pots command, polled or not. What the tests check is the same.
  • isChild was copied in four test files; it is now in test/support/fake-model.ts (memory.test.ts uses it too).
  • docs/development.md: a short paragraph on waiting for the bot, and why a polled check must not block.

Left out, on purpose:

  • pi.test.ts's sleeps: they show that no warm comes. They are sized by pi's warm interval (2 s here) and Pots' 5 s re-read of pi's settings; shorter ones would check less, and a condition cannot show that nothing happens.
  • Shared gateways: in gateway.behavior, typing, memory and the others each case checks the whole log, the typing signs or the wake count from a fresh bot. Sharing a gateway would change what they check, so it is not in this PR. cli.test.ts already shares one.
  • No change to src/.

How it was tested. npm run check. Each file alone with npx vitest run test/<file>.test.ts, one at a time under a lock, before (on a copy of origin/main) and after. All pass. Vitest's Duration, in seconds; the host ran other test suites at the same time, so a few seconds either way is noise:

File Before After
children 242.8 204.5
nesting 224.8 160.7
gateway.behavior 276.0 264.4
cli 138.8 134.1
typing 108.3 104.8
memory 86.9 84.6
mcp 72.0 69.7
definition 75.4 75.5
terminal 66.8 68.0
pi 66.6 67.1

Only children and nesting changed in a way that shows; the rest are unchanged files or noise. The full npm test was not run here.

After the review (one Codex round). The count of child requests in nesting is taken right after the stop is confirmed; the two children tests that polled for a 4-second sleep hold the child (and the main agent) on workspace files instead; waitFor's time limit holds while an async check runs, and a cut-off check's pots processes are killed and awaited; run() rejects on the process's error event; command() passes on stderr of a command that worked. Times after it, each file alone (children ran while another suite ran on the host): children 224.0 s, nesting 167.1 s, mcp 73.8 s, memory 85.3 s, typing 105.5 s.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 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-12-04T02:39:14.690261Z 0608167 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.

… test support

children, nesting and mcp polled pots children with the synchronous gateway.pots.
Each poll blocked the test process for a second or more, and the fake model in
it could not answer meanwhile. They now use gateway.command, which runs the
command as gateway.run does, and waitFor takes an async check. The four copies
of isChild are one in test/support/fake-model.ts.
…files, not sleeps

waitFor holds its time limit also while an async check runs, and the pots
commands of a check that is cut off are killed before the wait ends. run()
rejects when its process cannot start, and command() passes on the stderr of
a command that worked, as pots() did. The two children tests that polled for a
four-second sleep hold the child, and the main agent, on files in the
workspace. nesting counts the child requests right after the stop.
@Crokily
Crokily merged commit c46d313 into main Dec 4, 2026
6 checks passed
@Crokily
Crokily deleted the tests-faster branch December 4, 2026 04:14
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