Skip to content

fix(scenarios): second server startup failure no longer hangs - #37847

Merged
juliusmarminge merged 4 commits into
pingdotgg:mainfrom
StiensWout:t3/1045-multi-environment-scenarios-hang-when-th
Nov 17, 2026
Merged

juliusmarminge merged 4 commits into
pingdotgg:mainfrom
StiensWout:t3/1045-multi-environment-scenarios-hang-when-th

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

When the second scenario server exited before printing a pairing token, startSecondServer kept waiting and multi-environment scenarios hung until they timed out. Startup now races the token against process exit and rejects ready with the original failure, including the exit code, so callers receive an actionable error immediately.

Fixes #37846

Reproduction on main

Commit 6e650b3849 (main). The scenario stays waiting for pairing details from a server that has already exited, until the outer scenario timeout expires. The cause is at scripts/scenarios/second-server.ts:53. Ran cd scripts && pnpm exec vp test run --config ../vite.config.ts --dir . scenarios/second-server.test.ts with the repro test added: it failed in 2 of 2 runs on a clean checkout, with expect startup failure to reject readiness after the server exits in the output.

Evidence

Environment: Linux x64, the repository's own tests

Proven: the test fails on base b4e47a5a62 and passes on head 772605c1ee.

Before After
Commit b4e47a5a62 772605c1ee
Result Fails, with expect startup failure to reject readiness after the server exits in the output Passes

Tests

  • ff1c1516d0 adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed passed on head.

Not in this change

  • A second server that exits after pairing still leaves its fiber waiting until stop is called.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Review findings fixed by GPT 6.1 Sol, in Codex
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.1 Sol, in Codex, each on its own
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by Claude Opus 5.5 and GPT 6.1 Sol

Wout Stiens and others added 3 commits November 17, 2026 02:18
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 17, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 17, 2026
@macroscopeapp

ghost commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 9b5ca0d

Macroscope's review found this PR approvable — The scenario helper now reports early second-server exits instead of hanging while awaiting a pairing token. Its effects are limited to scenario startup and error reporting, with existing process isolation and cleanup unchanged.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 17, 2026
Drop the start-app mock and fake timers: awaiting the readiness rejection
covers the same regression, which hangs on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review November 17, 2026 01:29

Dismissing prior approval to re-evaluate 9b5ca0d

@coderabbitai

ghost commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The second-server scenario now detects when the server exits before printing its pairing token. It reports the startup exit code instead of waiting for pairing details. A test checks that readiness rejects after the server exits.

Changes: Second-server startup failure

Layer / File(s) Summary
Detect startup exits and reject readiness
scripts/scenarios/second-server.ts, scripts/scenarios/second-server.test.ts
runSecondServer races token acquisition against the server exit code and reports the startup exit code if the server exits first. Fiber failures propagate their squashed cause. The test checks that readiness rejects after the server exits before printing a token.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: bugfix

Merge Risk: Minimal · up to 9b5ca

This fixes a hang in the scenario tooling when the second server exits during startup, and the failure is now reported with its exit code. It affects only test and scenario tooling, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(scenarios): second server startup failure no longer hangs" matches the main change. The raw summary and objectives show that startup now races the pairing token against process exit and…
Description check Passed The description follows the template's main sections. The Problem section states the hang when the second server exits before printing a pairing token, and the Change section explains the race between…
Linked Issues check Passed Issue #37846 requires that a second server that exits during startup, before it prints its pairing token, is reported immediately. The reviewed head (9b5ca0d) shows this in scripts/scenarios/second-s…
Out of Scope Changes check Passed The PR changes two files: scripts/scenarios/second-server.ts and scripts/scenarios/second-server.test.ts. The source change adds the startup exit race, its ScenarioError message, and the observer ch…
Full details: Title check

Explanation

The title "fix(scenarios): second server startup failure no longer hangs" matches the main change. The raw summary and objectives show that startup now races the pairing token against process exit and rejects ready with the exit failure, so the server no longer waits indefinitely. The title is a conventional commit that names the scope and the fixed behavior.

Full details: Description check

Explanation

The description follows the template's main sections. The Problem section states the hang when the second server exits before printing a pairing token, and the Change section explains the race between the token and process exit. The Scope section links issue #37846 but does not say why the fix is a bug fix, though the issue shows the bug. The Verification section gives a repro on main, base and head results, and the commands run. It names the environment and states what is excluded. The template asks for the model and harness used, and the description includes that. The Verification section also describes the repro test results in detail. The description is mostly complete. The Scope section could state more clearly that the linked issue is the bug report.

Full details: Linked Issues check

Explanation

Issue #37846 requires that a second server that exits during startup, before it prints its pairing token, is reported immediately. The reviewed head (9b5ca0d) shows this in scripts/scenarios/second-server.ts. runSecondServer builds an exited effect from server.exitCode that fails with ScenarioError (The second server exited with code ${code} at startup.). It races Deferred.await(token) against exited through Effect.raceFirst. startSecondServer adds an observer that rejects ready with Cause.squash(exit.cause) on failure. The head test in scripts/scenarios/second-server.test.ts runs a fixture that calls process.exit(1) and asserts that ready rejects with the startup-exit message. The base failure (test fails on b4e47a5) is taken from the PR description. I could not read the base diff in this review, so that claim is not independently confirmed. The head behavior is confirmed from source. Post-pairing exit handling is out of scope for this issue and remains unchanged, as the PR states. The incremental change since the prior head (772605c) could not be compared through a diff, because the changed blobs were unavailable. I read the current head file blobs directly and they match the described behavior.

Full details: Out of Scope Changes check

Explanation

The PR changes two files: scripts/scenarios/second-server.ts and scripts/scenarios/second-server.test.ts. The source change adds the startup exit race, its ScenarioError message, and the observer change that rejects ready with the squashed cause. On successful termination before pairing, the observer rejects with The second server stopped.. This follows the same readiness-rejection path and supports the issue. The test file is new and covers only the startup-exit path. It mocks the e2e config and removes its temporary directory in finally. Both files connect directly to #37846. No unrelated file or behavior change appears in the reviewed evidence. The incremental diff since the prior head could not be read, so the check relies on the current head file contents and the PR summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 772605c and 9b5ca0d.

Files selected for processing: 1

  • scripts/scenarios/second-server.test.ts

Limit details: You’ve used all 10 included reviews currently available.

@juliusmarminge

ghost commented Nov 17, 2026

Copy link
Copy Markdown
Member

Evidence

Run real primary and secondary T3 servers on Linux x64 with isolated data. Have a separate process occupy the secondary server's reserved port before startup. Both secondary servers exit with code 1 before pairing. Observe readiness using the same driver on both commits.

Before After
b4e47a5a62 9b5ca0dddc
Before: readiness still pending 15 seconds after server exit After: readiness rejects immediately with startup exit code 1
Timestamped output replay · Raw transcript Timestamped output replay · Raw transcript

Reproduction driver. Captures render actual timestamped CLI output, rather than a browser or desktop recording. Base remained pending until explicit cleanup; head reported The second server exited with code 1 at startup. in the same timestamp as process exit.

Not shown:

  • The complete removed-environment-closes-its-toasts browser scenario and its eventual outer timeout were not run. This proof directly exercised its real secondary-server startup path and observed the base hang for 15 seconds after process exit.
  • Other startup exit codes and failure causes were not exercised; the occupied-port reproduction produced exit code 1.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 17, 2026
@juliusmarminge
juliusmarminge merged commit 88fc9ac into pingdotgg:main Nov 17, 2026
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Multi-environment scenarios hang when the second server fails to start

2 participants