You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tell a search wait's timeout by its held answer - #4546
TestStagehandSearchingWindowWaitEndsWithTimeout failed on Windows CI with "7.11s is not less than 6s". It bounded the whole replay by the search's timeout plus callTimeoutSlack, but the replay also checks the target, readies the document watch, and acts through the browser runtime. On a slow runner those round trips alone pass the bound, so the assertion measured the runner, not whether the wait ended at its timeout.
Changes
internal/runtime/builtin/browser/stagehand_test.go: the test asserts that the search returns while its answer is still held, which only the wait's timeout path allows. It then times the wait for the held window alone, which reads no page, so the browser's pace stays out of the bound. Its one-minute watchdog cancels the replay and waits for it before cleanup.
No production code changes.
Core change
The page's answer stays gated until the test releases it, so a replay that returns before the release stopped waiting at its timeout. The wait's own deadline is checked on settleDocument, while the window is still held. That check reads no page, so a slow runner can't push it over the bound. The replay's checks around the wait do read the page, and they made the old whole-replay bound flaky.
// internal/runtime/builtin/browser/stagehand_test.go, TestStagehandSearchingWindowWaitEndsWithTimeoutselect {
caseerr:=<-searched:
require.NoError(t, err)
case<-time.After(time.Minute):
cancelSearch()
<-searchedrequire.FailNow(t, "the search waited for the answer past its timeout")
}
stagehand:=eng.(*stagehandEngine)
waited:=time.Now()
stagehand.settleDocument(t.Context(), waited.Add(stagehand.settleWait), waited.Add(timeout))
assert.GreaterOrEqual(t, time.Since(waited), timeout, "the wait held for the window")
assert.Less(t, time.Since(waited), timeout+time.Second, "the wait ended at its time")
Testing
go test ./internal/runtime/builtin/browser/ -run TestStagehandSearchingWindowWaitEndsWithTimeout -count=3 passes locally.
Extending the held-window wait by seven seconds in settleDocument fails the test ("8.0s is not less than 2s"). -race passes.
The windows-ci label runs the test on Windows, where it failed.
The test no longer bounds how late a deadline Replay hands to the wait could be. Any such bound through Replay also counts its page reads, which is what made the old check fail on a slow runner.
[Low impact] This test-only change appears safe to merge.
Summary
Replaces a tight elapsed-time upper bound in TestStagehandSearchingWindowWaitEndsWithTimeout with a check that the search returns while its answer remains held.
The browser test checks when a search returns, not how long the whole click takes.
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 619b7042-d5b1-4999-a5c4-5a75dcceae00
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The test now runs the windowed search asynchronously and checks that it returns without error while the response remains gated. It asserts that the search takes at least the configured one-second timeout.
The test waits up to one minute for the asynchronous search to return while its response is gated. It checks for a nil error and an elapsed time of at least one second, replacing the prior upper-bound assertion.
dagucloud/dagu#3442: Defines the searching-window hold behavior that this test checks.
Merge Risk: Minimal · previous review 9c9c0
This change only makes a test less sensitive to timing on slow Windows CI runners and does not alter product behavior. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "Tell a search wait's timeout by its held answer" describes the main change: the test now uses the held answer to verify that the search wait ends at its timeout. It is specific to the chang…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template closely. It has Summary, Changes, Core change, Testing, and Performance sections, plus an Agent section. It explains the failure, the fix, and the reaso…
Full details: Title check
Explanation
The title "Tell a search wait's timeout by its held answer" describes the main change: the test now uses the held answer to verify that the search wait ends at its timeout. It is specific to the changeset, though the phrasing is somewhat unusual and not fully plain. The title is concise and on topic.
Full details: Description check
Explanation
The description follows the repository template closely. It has Summary, Changes, Core change, Testing, and Performance sections, plus an Agent section. It explains the failure, the fix, and the reason the old bound was flaky. It includes the CI failure link and local test results. Related Issues and the template checklist are not filled in. The Related Issues section is conditional, so its absence is minor. The Changes section does not show user-visible behavior before and after. That part is not applicable here because the change is test-only with no production code changes. The description is mostly complete, so the check passes.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
The test bounded the whole replay by its timeout plus the call slack,
but the replay also checks the target, readies the document watch, and
acts through the browser runtime, which together took over the bound
on a slow Windows runner. The answer stays held until the test releases
it, so a replay that returns before then ended its wait at the timeout;
the test now asserts that instead of a wall-clock bound.
The held answer showed only that the replay stopped waiting before the
answer came, so a wait that ran seconds past its time still passed. The
test now times the wait for the held window directly, which reads no
page, so the browser's pace stays out of the bound. Its watchdog also
cancels the replay and waits for it before the browser is cleaned up.
Timing the held-window wait on its own lost coverage of the deadline
the replay passes to it. The test now bounds the replay from when it
acted, as the old check did from its start, so the checks before the
action, which run at the browser's pace, stay out of the bound while a
late deadline still fails it.
Timing the replay from when it acted still counted the document watch,
which runs at the browser's pace, so a slow runner could still fail
the bound. The test goes back to timing the held-window wait alone,
which reads no page, and keeps the held answer as the proof that the
replay stopped waiting at its timeout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
windows-ciRun the Windows tests on this pull request, without conformance and E2E
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestStagehandSearchingWindowWaitEndsWithTimeoutfailed on Windows CI with "7.11s is not less than 6s". It bounded the whole replay by the search's timeout pluscallTimeoutSlack, but the replay also checks the target, readies the document watch, and acts through the browser runtime. On a slow runner those round trips alone pass the bound, so the assertion measured the runner, not whether the wait ended at its timeout.Changes
internal/runtime/builtin/browser/stagehand_test.go: the test asserts that the search returns while its answer is still held, which only the wait's timeout path allows. It then times the wait for the held window alone, which reads no page, so the browser's pace stays out of the bound. Its one-minute watchdog cancels the replay and waits for it before cleanup.Core change
The page's answer stays gated until the test releases it, so a replay that returns before the release stopped waiting at its timeout. The wait's own deadline is checked on
settleDocument, while the window is still held. That check reads no page, so a slow runner can't push it over the bound. The replay's checks around the wait do read the page, and they made the old whole-replay bound flaky.Testing
go test ./internal/runtime/builtin/browser/ -run TestStagehandSearchingWindowWaitEndsWithTimeout -count=3passes locally.settleDocumentfails the test ("8.0s is not less than 2s").-racepasses.windows-cilabel runs the test on Windows, where it failed.Performance
No performance risk: a test-only change.
Out of scope
Replayhands to the wait could be. Any such bound throughReplayalso counts its page reads, which is what made the old check fail on a slow runner.Agent
Claude Code, claude-opus-5-5, high