Skip to content

Commit 853164a

Browse files
Give V2 waitFor() helpers 30s budget so real-queue CI has room to settle
The #399 CI failure distribution includes ~18 tests in the bucket "V2 real-queue waitFor() timeouts" where workflow completion genuinely needs more than the per-file 5–20 second waitFor() budget once the projector repair pass adds latency and GitHub Actions runners are under load. Local focused runs finish well within the old budgets; the timeouts only bite in CI. A hard upper bound of 30 seconds still loud-fails a genuinely hung workflow — that's still an order of magnitude below what a real stall would need — but gives enough slack for the projector cycle + real queue worker pickup + activity round-trip on a contention-bound runner. Uniform 30s budget across V2WorkflowTest, V2UpdateWorkflowTest, V2WebhookWorkflowTest, V2HistoryTimelineTest, V2MessageCursorContinueAsNewTest, and V2RunDetailViewTest so the per-file helpers don't drift. Does not mask real engine hangs: those would still never settle. Only masks timing flakiness, which is the actual category showing up in #399's bucket A. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c3e4f3b commit 853164a

6 files changed

Lines changed: 17 additions & 8 deletions

tests/Feature/V2/V2HistoryTimelineTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ public function testTimelineIncludesTypedSideEffectEntriesForWaitingRun(): void
916916

917917
private function waitFor(callable $condition): void
918918
{
919-
$deadline = microtime(true) + 20;
919+
$deadline = microtime(true) + 30;
920920

921921
while (microtime(true) < $deadline) {
922922
if ($condition()) {

tests/Feature/V2/V2MessageCursorContinueAsNewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function testMultipleSignalsBeforeContinueAsNewTransferCursorCorrectly():
152152

153153
private function waitFor(callable $condition): void
154154
{
155-
$deadline = microtime(true) + 10;
155+
$deadline = microtime(true) + 30;
156156

157157
while (microtime(true) < $deadline) {
158158
if ($condition()) {

tests/Feature/V2/V2RunDetailViewTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3784,15 +3784,15 @@ private function waitFor(callable $condition): void
37843784
{
37853785
$startedAt = microtime(true);
37863786

3787-
while ((microtime(true) - $startedAt) < 5) {
3787+
while ((microtime(true) - $startedAt) < 30) {
37883788
if ($condition()) {
37893789
return;
37903790
}
37913791

37923792
usleep(100000);
37933793
}
37943794

3795-
$this->fail('Condition was not met within 5 seconds.');
3795+
$this->fail('Condition was not met within 30 seconds.');
37963796
}
37973797

37983798
private function drainReadyTasks(): void

tests/Feature/V2/V2UpdateWorkflowTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,17 +1653,20 @@ private function wakeTaskWatchdog(): void
16531653

16541654
private function waitFor(callable $condition): void
16551655
{
1656+
// CI runners occasionally need more than 5s for real-queue v2
1657+
// update tests to settle — projector repair pass latency plus
1658+
// GitHub Actions load. 30s stays a hard upper bound.
16561659
$startedAt = microtime(true);
16571660

1658-
while ((microtime(true) - $startedAt) < 5) {
1661+
while ((microtime(true) - $startedAt) < 30) {
16591662
if ($condition()) {
16601663
return;
16611664
}
16621665

16631666
usleep(100000);
16641667
}
16651668

1666-
$this->fail('Condition was not met within 5 seconds.');
1669+
$this->fail('Condition was not met within 30 seconds.');
16671670
}
16681671

16691672
/**

tests/Feature/V2/V2WebhookWorkflowTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3036,7 +3036,7 @@ private function runReadyWorkflowTask(string $runId): void
30363036

30373037
private function waitFor(callable $condition): void
30383038
{
3039-
$deadline = microtime(true) + 10;
3039+
$deadline = microtime(true) + 30;
30403040

30413041
while (microtime(true) < $deadline) {
30423042
if ($condition()) {

tests/Feature/V2/V2WorkflowTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7971,7 +7971,13 @@ public function testCancelFailureRowAppearsInFailureSnapshots(): void
79717971

79727972
private function waitFor(callable $condition): void
79737973
{
7974-
$deadline = microtime(true) + 10;
7974+
// Real-queue V2 tests in CI occasionally need more than 10s to
7975+
// settle: the projector repair pass adds latency when the workflow
7976+
// task dequeues just after a projection cycle, and overloaded
7977+
// GitHub Actions runners compound that. 30s is still a hard
7978+
// upper bound — a genuinely hung workflow fails as loudly as
7979+
// before.
7980+
$deadline = microtime(true) + 30;
79757981

79767982
while (microtime(true) < $deadline) {
79777983
if ($condition()) {

0 commit comments

Comments
 (0)