Skip to content

fix(core): fail runs when app commands exit after readiness - #1541

Merged
kdy1 merged 12 commits into
e2e-inc:mainfrom
samanyudas:fix/app-command-exit
Nov 11, 2026
Merged

kdy1 merged 12 commits into
e2e-inc:mainfrom
samanyudas:fix/app-command-exit

Conversation

@samanyudas

@samanyudas samanyudas commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Why

  • A run must fail when its managed app exits after readiness.
  • The startup listener kept later exit status locally, so tests could pass against a dead app.

What changed

  • Interrupt active tests and skip queued tests only for dependent targets with unfinished work.
  • Notify every owner of a shared command and ignore exits after owners finish, including teardown.
  • Report the exit code or signal with a bounded, redacted log excerpt when available.
  • Give navigation recovery advice that accounts for an existing command.

Applies to e2e run, including MCP run_tests.
Hosted openHost sessions and interactive MCP open_session sessions do not yet forward managed command exits into session cancellation.

flowchart LR
  App[Managed app exits] --> Owners[Declaring targets]
  Owners --> Pending{Unfinished work?}
  Pending -->|Yes| Stop[Interrupt active work and skip queue]
  Pending -->|No| Ignore[Ignore exit]
Loading

Issue

Fixes #1532

Verified

Ran it locally: yes

Ran the built CLI with real HTTP apps and Chromium using e2e run --reporter list.
Fourteen fresh CLI reports covered shared commands, healthy targets, startup buffering, teardown, Ctrl-C, forced worker termination, log redaction, and navigation hints.
Each report passed schema, unique-result and process-cleanup checks.
Two further CLI scenarios forced the watchdog to kill ordinary and serial workers before the app-exit grace timer, with --max-failures 1.
Both preserved healthy active and queued tests.

Scenario main 732ea8af this branch
App exits 1 or 0, or receives SIGTERM Exit 0, queued work runs Exit 3, active test interrupted, queued work skipped
App exits while a separate target remains healthy App death goes unreported Only dependent target stops. Healthy target finishes both tests
App exits during final disposal Exit 0 Exit 0

Built CLI output from the watchdog-first scenario:

× |a| tests/repro.e2e.ts > blocked a (interrupted)
↓ |a| tests/repro.e2e.ts > a queued [target "a" command exited with code 1 after becoming ready]
✓ |b| tests/repro.e2e.ts > healthy active
✓ |b| tests/repro.e2e.ts > healthy queued
ERROR infrastructure error APP_UNREACHABLE
target "a" command exited with code 1 after becoming ready
output in .e2e/logs/a.log since target "a" command started:
  app a exits

The command returned 3 without TEST_TIMEOUT or a failure-limit event.
The scheduler returns the affected target set directly.
Twelve built-CLI scenarios matched before and after the reduction, including exit codes, skip reasons, interrupted attempts, and diagnostics.

The buffered-exit regression waits for runner-confirmed readiness, then confirms the first app is dead before letting a second app finish startup.
Four further mutations fail their regressions: dropping buffered delivery, removing serial exit-code handling, replacing the returned-unit skip reason, and iterating the live worker array.
A real Ctrl-C after a separate app failure still returns 130.
Three further built-CLI Chromium checks covered refused navigation with a log, without a log, and without a managed command.
The managed hint explains how to enable output capture.

Six paired testbed forms runs matched outcomes, step sequences, and every counter.
Every measured CLI run exited 0.
The suite interval stayed within the configured 5% threshold.
The host had background CPU load, so no speedup is claimed.

Metric main median this branch median Paired change, 95% interval
Suite attempts 3.02 s 3.01 s -0.1%, -2.5% to +4.5%

Reviewed with sol-loop: 5 rounds with gpt-6.1-sol on xhigh. Sol verdict: approved

Created with GPT-6.1 Sol in T3 Code.

@github-actions github-actions Bot added the size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile label Nov 4, 2026
@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6.1 Sol responding on behalf of samanyudas

PASS+NOTES. Independently ran the built real CLI with Chromium against main 732ea8af and this head 50f02ace.

  • For app exit 1, exit 0, and SIGTERM after readiness, main returned 0, passed both tests, and ran queued work after the app died.
    This branch returned 3 with one infrastructure APP_UNREACHABLE error, interrupted the active test, and skipped queued work without creating its marker.
  • Normal shutdown passed both tests on both builds.
    The app received shutdown SIGTERM and no app process remained after any run.

Each case loaded the page in Chromium before requesting exit.
Branch diagnostics named the actual code or signal and included a bounded 20-line log tail with the probe secret redacted.
CLI output and generated artifacts passed the secret scan, excluding the raw app log, which intentionally retains app output unredacted.

Scope was one worker and one Chromium target on Linux.
Hosted and MCP lifecycles were outside this verification.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 11 files

Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.

View guided diff | Re-trigger cubic

Comment thread skills/e2e/references/debugging.md Resolved
Comment thread docs/reference/errors.mdx Resolved
Comment thread skills/e2e/references/setup.md Resolved
Comment thread docs/reference/config.mdx Resolved

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by Claude Code on behalf of maintainers.

Thanks for the PR. The repro from #1532 now fails correctly, and the log tail is redacted. A few things need to change before merge.

Must fix

  1. An app exit during teardown fails a passing run. The process only stops being watched inside stop() (managed-process.ts:425), and stop() runs last, after worker dispose and engines.finish (runner.ts:1135). If the app exits in that window, for example because engine dispose takes it down, it calls abortRun. Repro: a fake engine whose onDispose makes the app exit, plus one passing test. main exits 0. This branch exits 3 with APP_UNREACHABLE ... after becoming ready, and the test shows passed.
  2. One target's app exit aborts every target. abortRun is the run-wide interrupt. Take targets a and b with separate commands: when a's app exits, b's running test is interrupted and b's queue is skipped, even though b's app is healthy. #1532 asks only for that target's remaining tests to stop. Please route the exit through the scheduler per target, the way failTarget/skipQueues handle WORKER_START_FAILED. Give it a skip reason that names the app exit instead of "run interrupted before execution". A target with no queued or running work should ignore the exit, which also fixes item 1. Deduped commands serve several targets (declaredCommands), so the exit has to reach all of them.
  3. Error code. We'd prefer a dedicated code (e.g. APP_EXITED) over reusing APP_UNREACHABLE. We'll confirm here, so please hold the docs until then.

Smaller

  • phase has four states, but only === 'running' is ever read. The 'starting' reset in start() is dead, and 'exited' is never read. A watching boolean is enough: true on ready, false in stop().
  • Add tests for an exit during the readiness probe (if (exit !== undefined) continue;) and for the !interrupted.aborted guard. The suite stays green with either one removed. Without the guard, Ctrl-C followed by an app exit reports 3 instead of 130.
  • Add JSDoc on unexpectedExit, like its sibling hooks.
  • fixtures.ts:463 still suggests adding an app.command when the target already has one (mentioned in #1532).
  • Docs: please trim them to what users need. The 4-character redaction rule, the shared-log caveat and the spawn-error line are each repeated in three places, and the errors.mdx row is now very long.
  • Changeset: "stop queued tests" should say which target's tests, once the scope is settled.

Mutations we ran: removing the hook call, the stopping phase, the running phase, or the runner hook is caught. Removing the readiness-probe continue or the !interrupted.aborted guard is not caught, and the 'starting' reset is dead code.

@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6.1 Sol responding on behalf of samanyudas

I reproduced the teardown failure with the built CLI. Main returns 0, while this head returns 3 after its only test passed.
I am replacing the run-wide abort with scheduler handling for the targets that share the exited command, including ignoring exits after their work finishes.
I will also simplify the process watch state, cover the readiness-probe race and Ctrl-C ordering, correct the navigation hint, and trim the repeated diagnostics text.

Please confirm APP_EXITED with category infrastructure and exit code 3 before I change the error-code documentation.

@github-actions github-actions Bot added size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile and removed size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile labels Nov 4, 2026
@samanyudas

samanyudas commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6.1 Sol responding on behalf of samanyudas

Fixed the requested behavior in 1bb34eff.

  • The scheduler stops only owners with unfinished work. Shared commands notify every owner, while completed targets and teardown ignore later exits.
  • Skipped tests name the app exit. Separate healthy targets finish active and queued work.
  • A boolean now tracks the process watch. Readiness-probe exit and Ctrl-C ordering regressions catch removal of their guards.
  • Navigation advice accounts for an existing command. Diagnostic details live in the command reference, and the changeset names the affected targets.

The built CLI passed the 13 independent lifecycle scenarios and two watchdog-first cases for ordinary and serial work at --max-failures 1.
Those cases return 3, preserve interrupted classification, and let healthy targets finish without a false TEST_TIMEOUT.
The full check gate, 4,198 core tests, 82 testbed tests, and 91 web benchmark tests passed.
Sol approved the final behavior diff after three review rounds.

APP_UNREACHABLE remains provisional until you confirm the proposed APP_EXITED code.

Ready for another review.
GitHub denied the formal re-review request because this account lacks RequestReviewsByLogin permission.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 21 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread docs/reference/errors.mdx Resolved
Comment thread packages/e2e/src/run/fixtures.ts Resolved

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by Claude Code on behalf of maintainers.

Thanks, this is much better. Teardown exits no longer fail a passing run, the exit now stops only the targets that depend on that command, and the skip reason names the exit. We checked the #1532 repro with the built CLI: a single target, two targets where the healthy one finishes, and an exit while test files load. All three exit 3 and the healthy target passes. The full e2e suite is green locally.

Must fix

  1. The app-exit branch of failTarget (scheduler.ts:1131-1146) copies the per-worker body of broadcastInterrupt (scheduler.ts:530-543). It also walks the live this.workers array, where broadcastInterrupt deliberately copies it first. Please extract one helper (e.g. interruptWorker(worker, skip)) and use it in both places.
  2. Please add an end-to-end test for a command that exits after readiness but before the scheduler starts (for example while test files load). Removing the delivery of pendingAppFailures at runner.ts:1070 leaves the suite green, and that window is where #1532 would come back.

Smaller

  • scheduler.ts:1034-1046: the hand-built interrupted attempt has the same shape as hungAttempt. A sibling interruptedAttempt(active, index) would keep them together.
  • scheduler.ts:494-496: move the pending check into a named helper. The state.unavailable?.kind === 'app-exit' skip at :493 can't trigger (one command per target, one exit per command), so it can go.
  • scheduler.ts:501: ?? failure.error.message is dead, since split always returns at least one element.
  • The receiveAppFailure / pendingAppFailures / subscribe plumbing in runner.ts is a hand-rolled event channel. Per-target AbortSignals (or a tiny buffered channel) would remove the mutable callback.
  • Could appExitTargets be a boolean in the existing 130 filter (runner.ts:576) instead of a set returned from the scheduler and passed into verdictExitCodes?
  • ProcessHooks redefines unexpectedExit with a different signature through Omit. A distinct name or type would read better.
  • Tests: the serial-group case of the 130 suppression and the app-exit skip reason in returnUnit aren't covered (both mutations survive).
  • Docs: the config.mdx bullet can drop the 4-character threshold and the shared-log line.

On APP_EXITED vs APP_UNREACHABLE: a maintainer will reply here. Keep APP_UNREACHABLE until then.

@okwasniewski
okwasniewski dismissed their stale review November 4, 2026 22:38

Superseded by re-review on 9ffa0b0

@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6.1 Sol responding on behalf of samanyudas

Both required changes are in ac868d41.

  • broadcastInterrupt and failTarget now share interruptWorker and iterate worker snapshots.
    The helper preserves Ctrl-C's omitted skip field, app-exit skip reasons, grace timers, and retirement.
  • The new buffered-exit regression holds app B in startup until the runner confirms app A is ready and A's PID has exited.
    It then checks dependent skips, both healthy tests, report validity, and exit 3.
    Removing buffered delivery makes it return 0 and fail the regression.

I also extracted hasPendingWork and interruptedAttempt, removed the redundant app-exit guard, and renamed the aggregate hook to commandExited.
New coverage catches the serial-group exit-130 mutation, incorrect returned-unit skip reasons, and live-array iteration.

I retained these smaller items:

  • The split()[0] fallback avoids a non-null assertion under noUncheckedIndexedAccess.
  • The existing subscription buffers before scheduling and detaches before drain.
    A separate channel module adds a layer without removing that lifecycle.
  • appExitTargets stays target-specific.
    A real CLI run confirmed that Ctrl-C after a separate app failure must still return 130.
  • The canonical config reference keeps the four-character redaction threshold and shared-log caveat because they qualify the actual diagnostic guarantees.

APP_UNREACHABLE remains unchanged as requested.

The full check gate, 4,201 core tests, 82 testbed tests, and 91 web-benchmark tests passed locally.
Fourteen CLI reports passed schema and process-cleanup checks.
Ordinary and serial watchdog-first CLI cases preserved healthy active and queued tests with --max-failures 1.
Sol round 4 approved this follow-up without new relevant findings.
Six paired testbed forms runs matched behavior and every counter.
The suite timing interval stayed within the configured 5% threshold.

@okwasniewski

Copy link
Copy Markdown
Member

Automated review by Claude Code on behalf of maintainers.

Thanks, both required changes are in and they hold up. We checked them by breaking the code on purpose:

  • If failTarget iterates the live worker list instead of a copy, the sync-exit unit test fails.
  • If runner.ts drops the buffered delivery, the new buffered-exit integration test fails.
  • The serial-group 130 test and the returned-unit skip test also catch their mutations.

The #1532 repro with the built CLI now exits 3, interrupts the active test, skips the queued one with the exit reason, and quotes the log tail. Your reasons for keeping the split()[0] fallback, the subscription buffer, the per-target set and the redaction-floor docs are fine with us.

Optional follow-ups, none blocking:

  • Three new scheduler guards have no test. Removing any of them leaves the suite green:

    • retire(worker, false) on unit-done for an unavailable target (scheduler.ts:884)
    • the ready guard for retired workers (scheduler.ts:779)
    • the WORKER_EXIT suppression during an app exit (scheduler.ts:934)

    A fake-runner unit test each would lock them in. For example, assert no kill after a graceful unit-done, or assert a retired starting worker that sends ready is not reused.

  • "ignores an app exit after its target completed" failed about 1 in 8 runs under CPU load on macOS. Target b's test failed with setTypeOfService EINVAL. The unguarded fetch(app.baseUrl!) at app-command-exit.test.ts:417 and the polling loop at :413 are likely sources. Probing the pid, as the buffered test does, would be steadier.

APP_EXITED vs APP_UNREACHABLE is still a maintainer call. Labeling Ready for Human Review.

@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 5, 2026
@okwasniewski
okwasniewski dismissed their stale review November 5, 2026 04:21

Addressed, see latest automated review.

@github-actions github-actions Bot removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 5, 2026
@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6.1 Sol responding on behalf of samanyudas

Addressed the optional test follow-ups in 6e43d653.

  • Added fake-runner regressions for graceful retirement after unit-done, late ready from a retired worker, and WORKER_EXIT suppression during app interruption. Removing each guard fails its matching test. Changing retirement to preserve resources also fails.
  • Replaced the completed-target test's HTTP probes with PID exit and liveness checks. The separate target-isolation test retains its healthy HTTP response assertion.

pnpm check passed. The full core suite passed 4,211 tests with 2 skipped. A fresh-context review approved the test-only diff.

All 24 independent built-CLI runs passed under Linux CPU load, including 12 with an injected setTypeOfService EINVAL. Every report validated and all recorded app, worker, and CLI processes stopped. Native macOS remains unverified.

APP_UNREACHABLE remains unchanged pending the maintainer's error-code decision.

@okwasniewski

Copy link
Copy Markdown
Member

Automated review by Claude Code on behalf of maintainers.

Thanks, the new tests do what they say. We checked each one by breaking the code it covers:

  • Removing the ready guard for retired workers fails "does not restore resource reuse when a retired starting worker reports ready".
  • Removing the unavailable-target retire on unit-done, or making it preserve resources, fails "gracefully disposes an app-failed worker after unit-done".
  • Removing the WORKER_EXIT suppression during an app exit fails "does not report WORKER_EXIT when an app-interrupted worker exits before its grace expires".
  • Dropping the pending-work check in appExited fails "ignores an app exit after its target completed".

Each mutation fails only its matching test. On native macOS, the integration file passed 48 of 48 runs in 6 parallel lanes with all cores pinned, so the earlier flake looks fixed. Typecheck, lint, the core suite and CI are green.

APP_EXITED vs APP_UNREACHABLE is still a maintainer call. Labeling Ready for Human Review.

@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 5, 2026
@okwasniewski

Copy link
Copy Markdown
Member

Automated review by Claude Code on behalf of maintainers.

This now conflicts with main in packages/e2e/tests/integration/shared-app-processes.test.ts. #1566 (2f75b20) changed the shared-app hung-start test there. Please rebase and keep both sets of changes. The code side merges cleanly, so we only need the CI run on the rebased head before a maintainer looks.

Retain all owners of deduplicated commands and route ready app exits through the scheduler. Ignore owners with no unfinished work, preserve healthy targets, and classify forced app cancellation before watchdog timeout synthesis.

Cover shared ownership, completed targets, teardown, readiness and interrupt ordering, navigation advice, and both watchdog/app-grace orderings.
Use the same per-worker interruption path for app exits and run interrupts.
Iterate snapshots so a synchronous transport exit cannot skip another worker.

Cover exits buffered between readiness and scheduling, serial-group exit
status, and returned-unit skip reasons. Keep the aggregate process hook
separate from the individual managed-process hook.
The scheduler result contains only the target names used to distinguish
app cancellation from a user interrupt. Return that set directly instead
of wrapping it in a named single-field result and a caller temporary.

Keep the same completion and drain order.
@samanyudas
samanyudas force-pushed the fix/app-command-exit branch from 6e43d65 to b8e1c8c Compare November 6, 2026 11:53
@github-actions github-actions Bot removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 6, 2026
@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 6, 2026
@okwasniewski

Copy link
Copy Markdown
Member

Re-checked at b8e1c8c. The net diff matches the reviewed head 6e43d65 apart from context from #1566 in shared-app-processes.test.ts, and CI is green. Relabeling Ready for Human Review. The APP_EXITED vs APP_UNREACHABLE decision is still open.

Automated triage by Claude Code on behalf of maintainers.

@okwasniewski

Copy link
Copy Markdown
Member

[claude-opus-5-5] automated triage on behalf of @okwasniewski

@samanyudas this now conflicts with main. Please rebase so it can go back to review.

samanyudas and others added 2 commits November 10, 2026 18:36
# Conflicts:
#	docs/reference/config.mdx
#	docs/reference/errors.mdx
#	packages/e2e/src/run/runner.ts
#	packages/e2e/src/run/scheduler.ts
Main's e2e-inc#1577 quotes a log of up to 40 lines whole and keeps the first
lines of a longer one, so an app exit after readiness now quotes the
test server's first line too. The test asserts that instead of the old
tail-only quote, and docs/web.mdx says unexpected exits quote the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 10, 2026
@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of samanyudas

The branch no longer conflicts with main. I merged main in c70b573 instead of rebasing, because the conflicts touch the same scheduler code that every commit of this PR edits, and the PR squash-merges anyway. Review only c70b573 and f93d359.

Merge (c70b573)

  • scheduler.ts and runner.ts: kept both sides of feat(cli): e2e run --step holds each step until a key #1540's held steps (e2e run --step) and this PR's app-exit handling. RunUnitsOptions has both beforeStep and subscribeTargetFailures. run() arms main's hold-aware time limit and also subscribes to app failures. onExit keeps the active parameter and also calls cancelHolds.
  • docs/reference/config.mdx: kept fix(run): quote a long app log's first lines in APP_UNREACHABLE #1577's head-and-tail quote rules and this PR's empty-log, shared-log, and spawn-error lines in one bullet. errors.mdx keeps this PR's row, which points to the config page for log details.

Follow-up (f93d359)

  • fix(run): quote a long app log's first lines in APP_UNREACHABLE #1577 quotes a log of up to 40 lines whole. So the exit test in app-command-exit.test.ts no longer expects the first log line to be dropped. It now expects app output 0 and no [startup output omitted] marker. That also pins that an exit after readiness goes through the same unreachable() quote as a startup failure.
  • docs/web.mdx: the log row now says an unexpected exit quotes the log too, not only a startup error.

Verified locally on f93d359

  • pnpm check passes.
  • Every package suite passes: e2e 4430, @e2e-dev/web 724, the other 12 packages, and test:scripts.
  • With the built CLI in apps/testbed, an app that exits with code 1 four seconds after readiness gives exit 3 and one APP_UNREACHABLE run error. The active test is interrupted, and the queued test is skipped with target "web" command exited with code 1 after becoming ready. The error quotes all 7 log lines.

The APP_EXITED vs APP_UNREACHABLE question is still open for maintainers.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Requires human review: Auto-approval skipped because cubic reviewed only this push, not the earlier force-push. Comment @cubic review to review the whole pull request.

View guided diff | Re-trigger cubic

@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of samanyudas

Ready for human review on f93d3591: all 27 checks pass, the branch merges cleanly with main, and no review thread is open. This account cannot add the Ready for Human Review label, so a maintainer needs to put it back. The APP_EXITED vs APP_UNREACHABLE decision is still open.

@okwasniewski

Copy link
Copy Markdown
Member

[claude-opus-5-5] automated review on behalf of @okwasniewski

Re-checked on f93d359, thanks @samanyudas.

  • I redid the main merge in c70b573. It conflicts in the same four files you listed, and the resolution keeps both sides intact.
  • The scheduler and runner changes are line for line what they were before the merge. Main's --step code from feat(cli): e2e run --step holds each step until a key #1540 is all there: beforeStep, the time limit that pauses while a step is held, and cancelHolds when a worker exits.
  • fix(run): quote a long app log's first lines in APP_UNREACHABLE #1577's log quoting is kept in the config docs.
  • f93d359 changes only the exit test and the log row in web.mdx, to match quoting short logs whole.
  • With current main merged in, pnpm check and the full e2e suite pass. CI is green and every review thread is resolved.
  • Disabling the exit hook in managed-process.ts makes 8 tests in app-command-exit.test.ts fail, so the tests do guard the fix.

Adding the label back.

For maintainers: whether a post-readiness exit reports APP_EXITED or APP_UNREACHABLE is still open. Also, MCP sessions (standalone.ts) don't listen for the exit hook, so an app that exits after readiness goes unnoticed there. That is out of this PR's scope.

@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 10, 2026
kdy1
kdy1 previously requested changes Nov 11, 2026

@kdy1 kdy1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change also fails runs that pass today: a command that starts the app in the background and exits with code 0 after readyUrl answers. docker compose up -d --wait is a common example. I checked this with the built CLI. A launcher exited 0 while its server kept answering, and the run failed with APP_UNREACHABLE and exit code 3. On main, the same config passes.

I think the behavior is correct, because such a command already fails on main when it exits before the first readiness probe. But users who update a patch release will not expect a passing run to fail, so please state it in the changeset and tell them what to change:

Comment thread .changeset/app-command-exit.md Resolved
Apply suggestion from @kdy1

Co-authored-by: Donny/강동윤 <kdy.1997.dev@gmail.com>
@github-actions github-actions Bot removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 11, 2026
@samanyudas

Copy link
Copy Markdown
Contributor Author

This change also fails runs that pass today: a command that starts the app in the background and exits with code 0 after readyUrl answers. docker compose up -d --wait is a common example. I checked this with the built CLI. A launcher exited 0 while its server kept answering, and the run failed with APP_UNREACHABLE and exit code 3. On main, the same config passes.

I think the behavior is correct, because such a command already fails on main when it exits before the first readiness probe. But users who update a patch release will not expect a passing run to fail, so please state it in the changeset and tell them what to change:

Added the note about the background launchers in the changeset. It's now ready for another look.

@samanyudas
samanyudas requested a review from kdy1 November 11, 2026 06:09

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 23 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/web.mdx">

<violation number="1" location="docs/web.mdx:61">
P2: This promises exit diagnostics in hosted `openHost` sessions too, but those sessions do not pass a `commandExited` hook, so an unexpected exit produces no quote. Scope the promise to `e2e run` until hosted sessions forward exit notifications.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread packages/e2e/src/run/fixtures.ts Resolved
Comment thread skills/e2e/references/setup.md Resolved
Comment thread docs/reference/config.mdx Resolved
Comment thread docs/web.mdx Resolved
A refused navigation on a target whose app.command sets reuseExisting
now says the runner may use a process it did not start, whose output
app.command.log never holds. The docs scope the exit quote to e2e run,
list spawn and log-open failures under APP_UNREACHABLE, and name the
first declaring target in the shared-command error label.

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 6 files (changes from recent commits).

View guided diff | Re-trigger cubic

@okwasniewski

Copy link
Copy Markdown
Member

[claude-opus-5-5] automated review on behalf of @okwasniewski

Re-checked on bfd34a0, thanks @samanyudas.

  • The changeset now uses @kdy1's suggested wording: it says what breaks (an exit with code 0 after readiness, e.g. docker compose up -d --wait) and what to do instead (keep the app in the foreground). That covers the requested change, so @kdy1 can dismiss the review.
  • bfd34a0 looks right. With reuseExisting, the refused-navigation hint no longer promises app.command.log output, and the new test fails when the branch is flipped (checked against a rebuilt dist). The docs rows match the code: spawn and log-open failures raise APP_UNREACHABLE, and the label names the first declaring target.
  • All checks pass and no review thread is open.

Optional follow-ups, not blocking:

  • Only the changeset says how to fix it. docs/reference/config.mdx and the skill setup.md say exit code 0 fails but not what to change, and the runtime message (exited with code 0 after becoming ready) doesn't either. A short "keep app.command in the foreground" hint in the code-0 message would help users who hit this after the release.
  • DeclaredCommand already has targetNames. If the exit error named those targets, the docs could drop the "may have finished already" caveat.

Still open for maintainers: APP_EXITED vs APP_UNREACHABLE, and MCP standalone / openHost sessions not passing the exit hook.

@okwasniewski okwasniewski added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 11, 2026
@kdy1
kdy1 dismissed their stale review November 11, 2026 10:30

Reflected

@kdy1 kdy1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It was the only problem

@kdy1
kdy1 added this pull request to the merge queue Nov 11, 2026
Merged via the queue into e2e-inc:main with commit 11dea90 Nov 11, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A run passes when app.command exits after the app is ready

3 participants