Skip to content

test: give the delivery queue test a budget that covers its wait in the queue - #202

Open
BIackFIame wants to merge 1 commit into
howdeploy:mainfrom
BIackFIame:pr/prompt-delivery-queue-deadline
Open

BIackFIame wants to merge 1 commit into
howdeploy:mainfrom
BIackFIame:pr/prompt-delivery-queue-deadline

Conversation

@BIackFIame

@BIackFIame BIackFIame commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Follows up on the Windows failure in tests/prompt-delivery.test.mjs you asked about on #201. Test-only, one file; no product change.

What fails

"the queue retains the entire paste/observe/Enter transaction and supports owned paste-only drafts" fails on windows-pipe-host at the until(() => f.writes.length === 4) wait (line 179; line 167 is the test's declaration). The second receipt is always stage: "pasted", "The delivery deadline expired after the paste; Enter was not sent.", at elapsedMs 151–153, after a first delivery of 72–74 ms:

Across the last 60 CI runs it caused 3 failures, all in the Windows job (about 5–6% of Windows runs since the test landed in 5c9771b), never on Ubuntu or macOS.

Cause

The product behaves as designed; the test's budget is too small for it on Windows.

  • TerminalManager.deliverInput sets a task's deadline when the task is queued, and execute passes only what is left to deliverInputNow. The test queues "one" and "two" at the same time with the fixture's default waitMs of 150, so "two" shares one 150 ms window with the whole "one" transaction. (That is intended: there is a separate "timed out while waiting in the delivery queue" reason.)
  • The paste-observe and acceptance loops poll with a 25 ms setTimeout, and the test's until() with 2 ms. Windows rounds timers up to about 15.6 ms steps, so 25 ms becomes about 31 ms and 2 ms about 15 ms. Two transactions need about five such ticks, which is more than 150 ms. On macOS the same run takes 72 ms and 131 ms.
  • 6e36e98 already gave the first test in this file a 5 s budget for the same reason ("This checks acknowledgement ordering, not the short-deadline failure path"); this test was not covered.

Fix

  • The queue test uses fixture(t, "codex", 5_000), as the first test does. What it checks (ordering, nothing lost, Enter for each paste) is unchanged.
  • With a 5 s budget the last draft would otherwise wait in the acceptance loop for its full 1 s cap, so the test sends UserPromptSubmit once that draft is written and asserts it is confirmed.

Verification

  • With a preload that rounds every setTimeout up to a 15.625 ms step (a stand-in for Windows timers), the test on c5731f4 fails every run with the CI signature (pasted, "deadline expired after the paste"). With this change the file passes 13/13 every run, also with 31.25 ms steps.
  • Without the preload: 13/13.
  • Full suite: 2699 tests, 2693 pass, 0 fail, 6 skipped (same as main at c5731f4).

Not changed here: at an exaggerated 50 ms step two other tests that rely on the 150 ms default also fail ("Claude's unstyled hint…" and "a staged prompt clears the previous answer…"). They have not failed on real Windows timers. If you want, they can get the same 5 s budget in this PR.

Summary by CodeRabbit

  • Tests
    • Updated automated checks to allow a longer wait while verifying prompt ordering, delivery, and confirmed acceptance after submission. These changes affect test coverage only; no user-facing functionality has changed.

…he queue

The second task's deadline is set when it is queued, so it also covers
the whole first transaction. With the fixture's 150 ms default, a few
25 ms polling ticks on a coarse Windows timer (about 15.6 ms steps)
spend it, and the second Enter is not sent. This test checks ordering,
not the short-deadline path, so it gets the 5 s budget the first test
in this file already uses (6e36e98). The last draft is confirmed by a
UserPromptSubmit so it does not sit in the acceptance loop.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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-11-02T19:06:16.780042Z 05c6a3f 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.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c5731f4 and 05c6a3f.

Files selected for processing: 1
  • tests/prompt-delivery.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Prompt delivery tests now use a 5,000 ms fixture wait budget for the queue ordering check. The extension test waits for the Enter write and UserPromptSubmit signal before asserting that the receipt is confirmed.

Changes: Prompt delivery test updates

Layer / File(s) Summary
Queue timing and extension acceptance
tests/prompt-delivery.test.mjs
The queue test uses a 5,000 ms fixture wait budget for its ordering check. The extension test waits for the Enter write and UserPromptSubmit signal, then asserts that the receipt is confirmed.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Suggested reviewers: howdeploy

Merge Risk: Minimal · up to 05c6a

The changes improve prompt-delivery test stability and confirmation coverage without introducing a merge-blocking risk.

Architecture risk: Low · up to 05c6a

The change affects 1 system.

Changed systems: tests

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — tests (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in tests/prompt-delivery.test.mjs: The queue test now uses a 5,000 ms fixture wait budget instead of the default and documents that its ordering check should not depend on the second task’s shorter deadline.
  • observed — Modified behavior in tests/prompt-delivery.test.mjs: The extension test now waits for the Enter write and a UserPromptSubmit lifecycle signal, then asserts that the extension receipt is confirmed; previously it only awaited completion.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: increasing the delivery queue test budget to cover its wait time.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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