End a dashboard run whose process exits before reporting by vishnuv688 · Pull Request #443 · webdriverio/devtools · GitHub
Skip to content

End a dashboard run whose process exits before reporting - #443

Merged
vishnuv688 merged 2 commits into
mainfrom
fix/rerun-early-exit
Oct 22, 2026
Merged

vishnuv688 merged 2 commits into
mainfrom
fix/rerun-early-exit

Conversation

@vishnuv688

Copy link
Copy Markdown
Member

Problem

A run started from the dashboard leaves its "Running" state only when the worker streams its final suites, or when the backend broadcasts testStopped. If the spawned process exits before any worker connects, neither arrives. A config preflight that refuses to start, a missing driver, or an unreachable Appium server all do this. The row then shows only a Stop button, so the test cannot be rerun from the dashboard.

Found while rerunning a native Appium example whose server had gone down: the backend log showed the child refusing to start, and the dashboard kept spinning.

Change

  • backend (runner.ts): the child's close handler now:
    • reports an exit that happened while the rerun-child flag was still unconsumed, meaning no worker ever connected, through onEarlyExit, with the exit code or signal;
    • clears that flag, so the next unrelated worker is no longer taken for a rerun child;
    • ignores a child that stop() already detached, so a late close of a stopped run no longer clears the run that replaced it.
  • backend (index.ts): an early exit broadcasts testStopped with a reason. The Stop route uses the same helper.
  • shared: new TestStoppedWsPayload (stopped, timestamp, optional reason) wired into SocketMessage. wire-schema.json and the Python generated types are regenerated.
  • app: markRunningAsStopped takes the error message as a parameter. A stopped run still reads "Test execution stopped"; a run that exited early shows its reason, e.g. Run exited before reporting (exit code 1).

Tests

  • backend/tests/runner.test.ts: an early exit is reported with its exit code or signal. A run whose worker connected stays silent. A stopped child closing after its replacement started is ignored, and the replacement's own early exit is still reported.
  • backend/tests/run-early-exit-broadcast.test.ts: end to end. It spawns a real child that exits with code 3 through POST /api/tests/run, and asserts the testStopped frame a real dashboard client receives.
  • app/tests/data-manager.test.ts: a testStopped carrying a reason fails the in-flight test with that message, and the existing stop test now checks the default message.
  • All six new tests fail without the source change. pnpm test: 2734 passed. pnpm lint: 0 errors.

Not verified by hand in the dashboard: the stuck state was reproduced before the fix, but the fixed build has only been exercised by the tests above.

🤖 Generated with Claude Code

A run started from the dashboard leaves its "Running" state only when the
worker streams its final suites or when the backend sends testStopped. A
child that exits before a worker connects, such as a config preflight
refusing to start or a missing driver, sends neither. The row then showed
only a Stop button, so the test could not be rerun.

The backend now sends testStopped with a reason when a spawned run closes
before any worker connected. The app marks the tests the run never reached
as failed, with that reason as their error.

The same close handler also cleared the rerun-child flag only on stop(), so
the next unrelated worker after an early exit was taken for a rerun child,
and it ran for a stopped child after its replacement had started, clearing
the new run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Comment thread packages/app/src/controller/mark-running.ts Outdated
A suite rerun or Run All clears each suite's tests before the child starts,
so when that child exits before reporting, the stop reason landed on no
test: the suites turned failed and the Errors tab stayed empty.

The reason now goes on the topmost suite the stop alone failed, which the
Errors tab lists, and is cleared when the suite runs again. A test-level
rerun still carries it on the test, so the suite does not repeat it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vishnuv688
vishnuv688 merged commit 49fd6f4 into main Oct 22, 2026
13 checks passed
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