Skip to content

fix(run): quote a long app log's first lines in APP_UNREACHABLE - #1577

Merged
kdy1 merged 1 commit into
e2e-inc:mainfrom
DeryFerd:fix/app-unreachable-first-lines
Nov 9, 2026
Merged

kdy1 merged 1 commit into
e2e-inc:mainfrom
DeryFerd:fix/app-unreachable-first-lines

Conversation

@DeryFerd

@DeryFerd DeryFerd commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What and why

  • When an app.command dies during startup, the APP_UNREACHABLE message is often the only diagnostic a run leaves. With a command.log, it quotes what the process appended since it started, command.env and inheritEnv values redacted.
  • That quote was a tail: the last 20 lines of the last 4 KiB. A process that prints its fatal error early and keeps logging (file watchers, bundlers, half-started dev servers) buried the one line that explains the failure. APP_UNREACHABLE drops the first startup lines when an app keeps logging #1527 hit this: the cause was in the first lines, the message showed only the end.
  • outputSince(offset) read a single window at the end of the file, so nothing before it could be recovered downstream. It now reads the other end too.

What changed

  • packages/e2e/src/run/managed-process.ts: outputSince reads two windows of OUTPUT_WINDOW_BYTES (4 KiB), one from the command's own log offset and one ending at the end of the file.
    • Windows that meet (the log since the command started fits in 8 KiB): quoted whole up to 40 lines, otherwise the first 20, [startup output omitted], the last 20.
    • Windows that do not meet: always the first 20, the marker, the last 20. The marker stays even when one huge first line leaves nothing above it.
    • The head starts at the command's own offset without clipping, so a first line written after a previous run's unfinished line survives.
    • A clipped edge drops its fragment before empty lines are filtered, so a whitespace-only fragment cannot take the complete line above it.
    • Every quoted line goes through the same this.redact pass as before.
  • packages/e2e/src/run/managed-process.ts: the inline read became a module-level readLines(fd, from, to, { start, end }) helper that both windows share.
  • packages/e2e/tests/unit/managed-process.test.ts: keeps the last 20 lines only became a whole-log test, since a 25-line log has nothing omitted now. New exact-equality tests cover the line cap on both branches, both byte thresholds of the overlap check, cuts inside a line and exactly between lines, the whitespace fragment, an offset > 0 log with and without a final newline, and the marker after a huge first line.
  • docs/web.mdx, docs/reference/config.mdx, docs/reference/errors.mdx: the quote is described as whole for a short log, otherwise the first and last lines with the marker between them. The config page names the byte bound.
  • .changeset/app-unreachable-first-lines.md: e2e patch.
flowchart TD
  A[app.command fails at startup] --> B[read the log since the command started]
  B --> C{do the head and tail windows meet?}
  C -- yes --> L{more than 40 lines?}
  L -- no --> D[quote every line]
  L -- yes --> E
  C -- no --> E[first 20 lines]
  E --> F[startup output omitted]
  F --> G[last 20 lines]
  D --> H[redact command.env and inheritEnv values]
  G --> H
  H --> I[APP_UNREACHABLE message]
Loading

Issue

Fixes #1527

Verified

Ran it locally: yes

Surface: the APP_UNREACHABLE message the built CLI prints when app.command exits before the app is ready, on a scratch project whose command writes one fatal line, one line naming DATABASE_URL, then 40 watcher lines, and exits 1. The main side below is the dist built before this change, the branch side is the same command after rebuilding packages/e2e.

main:        output in .e2e\app.log since target "web" command started:
               watcher: rebuilt module 21
               ...
               watcher: rebuilt module 40

this branch: output in .e2e\app.log since target "web" command started:
               fatal: ENOENT: no such file or directory, open .env.local
               hint: DATABASE_URL=<secret:DATABASE_URL>
               watcher: rebuilt module 1
               ...
               watcher: rebuilt module 19
               [startup output omitted]
               watcher: rebuilt module 21
               ...
               watcher: rebuilt module 40
main this branch
the fatal line and modules 1 to 20 are missing from the message the fatal line comes first, the gap is marked
the line naming DATABASE_URL is missing, so no value could leak the same line is quoted with the value masked as <secret:DATABASE_URL>
the log file keeps the raw value the log file keeps the raw value, the message does not
  • The first two new tests were written first and watched failing on the old code (expected [ ' line 41', ... ] to equal [ ' line 1', ... ]), then passing after the change. The whole file on the latest head: 34 passed, 1 failed, 1 skipped.
  • The one failure is fails with APP_UNREACHABLE when the log path cannot be opened, and it fails on this machine on main too, with the change stashed: opening a directory as an append log resolves here instead of throwing, so no InfrastructureError is raised. Windows-only, unrelated to this change.
  • tsc --noEmit on packages/e2e: exit 0. oxlint on both changed files: 0 warnings, 0 errors. check-changeset-bumps.ts and check-error-codes.ts: exit 0.
  • Not run locally: the full pnpm check chain and the browser-backed integration suites, which need a full build of every package (about twelve minutes here) and Chromium. CI ran them on the latest head and the spec, benchmark, mobile, and docs gates passed. The change touches no engine code, no wire format, and no exported type.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

View guided diff

@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 5, 2026

@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.

4 issues found across 6 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="packages/e2e/src/run/managed-process.ts">

<violation number="1" location="packages/e2e/src/run/managed-process.ts:376">
P2: The non-overlapping path returns every line in both 4 KiB windows, so a dense log can quote hundreds of lines instead of the promised first and last 20. Slice `head` to its first 20 lines and `tail` to its last 20 before adding the marker.</violation>
</file>

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

<violation number="1" location="docs/web.mdx:62">
P2: A 25-line log is quoted in full, without an omission marker; the marker is not added merely because output exceeds 20 lines. Clarify that overlapping windows include all lines and reserve the marker for non-overlapping windows.</violation>
</file>

<file name="docs/reference/config.mdx">

<violation number="1" location="docs/reference/config.mdx:524">
P2: A command that fails to spawn never reaches the log formatter, so this unconditional startup-failure claim is too broad. Limit it to failures after the command starts and when `log` is set.</violation>

<violation number="2" location="docs/reference/config.mdx:527">
P2: A 25-line log still fits the overlapping windows, so the runner includes every line without a marker. Say the marker appears only when the output windows do not overlap.</violation>
</file>

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

View guided diff | Re-trigger cubic

Comment thread packages/e2e/src/run/managed-process.ts Resolved
Comment thread docs/web.mdx Resolved
Comment thread docs/reference/config.mdx 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.

Thanks @DeryFerd, the direction is right. On the built CLI the #1527 case is fixed: the FATAL line now shows first, where main showed only ticks 21-40. The 3 new tests fail on main and pass here. A few things need fixing before this is ready.

Must fix

  1. The line cap is lost when the windows don't meet (managed-process.ts, the head / tail branch of outputSince). Neither window gets cut to 20 lines, so a 4 KiB window of short lines quotes hundreds of them. 3000 lines like t123 gave 1524 lines from outputSince and 1131 in the real APP_UNREACHABLE message, while the docs and changeset promise first and last 20. Use head.slice(0, OUTPUT_TAIL_LINES) and tail.slice(-OUTPUT_TAIL_LINES).

  2. The fragment is dropped after empty lines are filtered (readLines). If the clipped end fragment is only whitespace or control codes (the head window cut inside a stack trace's indent, Error: x\n ), filter removes the fragment and pop() then drops the complete line before it. Reproduced: Error: complete line disappeared. That spot, the end of the head, is exactly where an early fatal error lands. Drop the fragment on the raw split, then filter. The start side has the same order on main, and this fixes both.

  3. Tests. The 300-line test only checks toContain and length < 9000, which is how bug 1 got past it. Please add exact-equality cases for:

    • non-overlapping windows with short lines (count and order)
    • a log that already had content before the command started (offset > 0)
    • a clipped fragment at the head's end (covers bug 2)

    9 of 13 mutations survive the unit file, among them: swapping head and tail order, removing the clipped-end pop, clippedEnd = false on the head, clippedStart = false on the tail, and always printing the marker even with an empty head.

  4. Docs.

    • errors.mdx:106 adds em dashes. The repo uses plain hyphens.
    • config.mdx:524 and web.mdx:62 say "up to 20 lines". The actual behavior is: up to 40 lines quoted whole, otherwise 20 + marker + 20.
    • web.mdx:62 changes "any process appended" to "the process appended". The old wording was right, because the log can be shared (see the comment above outputSince: an earlier service may still be writing to it).

Nits

  • readLines takes 6 positional args, two of them booleans. end only feeds the peek clamp, which is dead: clippedEnd is only true when headEnd < end. Drop end, or pass { clipStart, clipEnd }.
  • OUTPUT_TAIL_LINES / OUTPUT_TAIL_BYTES now size the head too. Rename them to OUTPUT_WINDOW_*.
  • The unreachable() JSDoc still says "the log's tail".
  • If the head window is a single huge line, head comes back empty and the tail is returned with no marker, so the output is cut without saying so. Consider always emitting the marker when the windows don't meet.
  • The changeset could be one plain user-facing sentence. "Message cap" is an internal detail.

Heads up: #1541 (fixes #1532) touches the same APP_UNREACHABLE paragraphs in config.mdx and errors.mdx and conflicts textually. Once it lands, unreachable() also quotes the log for exits after the app was ready, so [startup output omitted] would read better as [output omitted].

CI: the test (26) failure is packages/web/tests/integration/screenshot-navigation.test.ts, an unrelated web flake. spec gate only fails because of it.

Checked and fine: empty log, offset past end, a shrunk file, CRLF, a first line at offset kept, a multibyte character split only inside dropped fragments, redaction per line on both windows, and adjacent windows with no duplicated line.


This is an automated review.

@DeryFerd
DeryFerd force-pushed the fix/app-unreachable-first-lines branch from db26eba to 8ac60f1 Compare November 5, 2026 19:03
@DeryFerd

DeryFerd commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in 8ac60f1 (one commit, rebased on main).

1. Line cap. outputSince slices both sides of the branch where the windows do not meet: [...head.slice(0, OUTPUT_WINDOW_LINES), OUTPUT_OMITTED, ...tail.slice(-OUTPUT_WINDOW_LINES)]. Your 3,000-line t123 case now quotes 41 lines: fatal: ..., t1 up to t19, [startup output omitted], t2982 up to t3000, watcher: still watching for changes. It quoted 1,524 before.

2. Fragment order. readLines drops the cut fragment on the raw split, before trimEnd and the empty-line filter, so a whitespace-only fragment cannot take the complete line above it. The test cuts the head window 9 bytes into a stack trace's indent; before the change the fatal: line above it disappeared, which is now asserted.

3. Tests. The 300-line toContain test is gone. Three exact-equality cases replace it:

  • A 300-line log asserts 20 + marker + 20 and a length of 41. This is the case bug 1 walked past.
  • 60 long lines cut both window edges mid-line: every quoted line must be a whole log line, with the log's first and last present. Dropping either clip or swapping the sides fails it.
  • A log with 200 earlier lines and 40 appended asserts the earlier content stays out when the tail window reaches back into it.

The 25-line case still asserts the whole log when nothing is dropped.

4. Docs. errors.mdx uses plain hyphens again. config.mdx and web.mdx both say up to 40 lines whole, otherwise the first and last 20 with the marker between them, and config.mdx scopes the claim to a failure after the command started with a log set. web.mdx keeps "any process".

Nits. readLines takes { start, end } and dropped the end argument, which only fed the dead peek clamp. OUTPUT_TAIL_LINES / OUTPUT_TAIL_BYTES are OUTPUT_WINDOW_LINES / OUTPUT_WINDOW_BYTES. The unreachable() JSDoc says first and last lines. The marker is always emitted when the windows do not meet, so a single huge first line no longer produces an unmarked cut. The changeset is one sentence.

The marker stays [startup output omitted] while #1541 is open. If #1541 lands first, I will rename it to [output omitted] in the rebase.

Verified on this head. vitest run tests/unit/managed-process.test.ts: 28 passed, 1 failed, 1 skipped. The failure is fails with APP_UNREACHABLE when the log path cannot be opened, which fails on main in this checkout too with the change stashed (opening a directory as an append log resolves on Windows instead of throwing, so no InfrastructureError is raised). tsc --noEmit exit 0, oxlint on both changed files 0 warnings and 0 errors, check-changeset-bumps.ts and check-error-codes.ts exit 0. The built CLI evidence above comes from a scratch target whose command writes one fatal line, 3,000 short lines, one last line, then exits 1.

CI. test (26) fails in packages/web/tests/integration/screenshot-navigation.test.ts:78 with page.screenshot: Execution context was destroyed, most likely because of a navigation. Nothing in this change reaches the web engine. The push retriggers it.

@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 6 files (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

View guided diff | Re-trigger cubic

Comment thread packages/e2e/src/run/managed-process.ts Resolved
Comment thread docs/reference/config.mdx Resolved
Comment thread docs/reference/config.mdx Resolved
@DeryFerd
DeryFerd force-pushed the fix/app-unreachable-first-lines branch from 8ac60f1 to c40bbd1 Compare November 5, 2026 19:27
@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 5, 2026

@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 (agent-run triage).

Re-review of c40bbd1. Almost there: every prior ask is fixed and the code is right on every edge case I tried (3000 short lines -> 41 quoted, CRLF, no trailing newline, 8191-8194 bytes, offset after a previous run's unfinished line, multibyte splits, empty and 40/41-line logs). CI green.

Must fix

  1. The overlap branch (managed-process.ts:372-374) has no test with more than 40 lines. That is a log over 40 lines but at most 8 KiB, the most common shape. Removing the cap (return true), dropping the marker there, or changing * 2 to * 3 all pass. Add an exact-equality test, e.g. 100 lines of line N.
  2. The docs promise more than the code does (config.mdx:524-528, web.mdx:62, errors.mdx:106). "Up to 40 of them whole" and "first and last 20 lines" ignore the 4 KiB per-window byte cap. 10 lines of 1 KiB each quote 4 + marker + 4, and 60 lines of 290 bytes quote about 14 + 14. Say "up to" and mention the byte bound, or drop the exact counts.

Nits

  • errors.mdx:106: with the inserted clause, "command.env values redacted, or says there was none" no longer reads as one sentence.
  • managed-process.ts:366-367: Math.min(end, ...) / Math.max(offset, ...) are dead. end - offset <= 2 * OUTPUT_WINDOW_BYTES says the same thing more simply.
  • The "keeps the first line the command wrote" test can use toBe('fatal: EADDRINUSE') instead of toContain.
  • The changeset has no trailing newline.
  • Untested: exact line-boundary cuts (always-shift and always-pop mutations survive) and the marker after a huge first line.

Mutations: 33 run, 16 killed, 13 real survivors, 4 equivalent. Most survivors go away with must-fix 1 plus a boundary-cut test.

Still conflicts with #1541 in config.mdx/errors.mdx. Whichever merges second rebases.

@okwasniewski
okwasniewski dismissed their stale review November 5, 2026 22:14

Superseded by re-review of c40bbd1 (automated review).

@DeryFerd
DeryFerd force-pushed the fix/app-unreachable-first-lines branch from c40bbd1 to 559af44 Compare November 6, 2026 17:49
@github-actions github-actions Bot added size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile and removed size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile labels Nov 6, 2026
@DeryFerd

DeryFerd commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@okwasniewski addressed in 559af44 (one commit, rebased on main).

Must fix 1, the overlap branch had no test past 40 lines. Added quotes the first and last 20 lines of a log that fits the byte window but not the line budget: 50 short lines (about 400 bytes, so the windows overlap) asserting exact equality of 20 + marker + 20 and a length of 41. I used 50 rather than 100 because 100 does not kill every mutant: with the threshold at * 3 (60) a 100-line log still takes the marker path, while 50 lines does not. Ran the three mutants you listed against the file:

mutation result
lines.length <= OUTPUT_WINDOW_LINES * 2 replaced by true killed
* 2 changed to * 3 killed
marker dropped from the overlap branch killed

Must fix 2, docs promised more than the code does. All three pages now state the byte bound: a log of up to 40 lines inside 8 KiB is quoted whole, a longer one shows up to 20 lines from each end, taken from the 4 KiB at each end, with the marker between. That covers your 10 × 1 KiB case (4 + marker + 4) and the 60 × 290-byte case (about 14 + 14) instead of implying 20 and 20.

Nits.

  • errors.mdx:106 keeps the original sentence shape: "quotes the log's output since the command started, command.env values redacted, or says there was none", then a separate sentence for the cap.
  • outputSince drops both Math.min/Math.max: the overlap test is end - offset <= OUTPUT_WINDOW_BYTES * 2, and the window reads are offset + OUTPUT_WINDOW_BYTES and end - OUTPUT_WINDOW_BYTES.
  • The first-line test asserts toBe('fatal: EADDRINUSE') now.
  • The changeset ends with a newline (LF).
  • Added keeps the marker when the head window sits inside one huge first line: a 5 KB first line, 400 lines after it, asserting 21 quoted lines with the marker first.

Boundary cuts. Added keeps whole lines at both window edges when the cut lands exactly between two lines: 60 lines of exactly 256 bytes put both 4 KiB edges on line boundaries, and it asserts exact equality of 16 + marker + 16.

always-shift and always-pop still survive that test, and I think they are equivalent rather than untested. The guard only decides whether to drop parts[0] or parts[last] from the raw split, and that part is the empty string exactly when the text starts or ends with a line break, because the read peeks one byte past each clipped edge. Dropping an empty part changes nothing, and when the part is a real fragment the guard already drops it. I ran both mutations against the suite to confirm they survive, then tried to construct an input where they differ and could not. If you have one, I will add the test for it.

Verified on 559af44. vitest run tests/unit/managed-process.test.ts: 32 passed, 1 failed, 1 skipped. The failure is fails with APP_UNREACHABLE when the log path cannot be opened, which fails on main in this checkout too (opening a directory as an append log resolves on Windows instead of throwing). tsc --noEmit exit 0, oxlint 0 warnings and 0 errors, check-changeset-bumps.ts and check-error-codes.ts exit 0. Rebuilt the package and ran the scratch target again: 3,000 short lines after a log that a previous run left mid-line quote 41 lines, fatal: EADDRINUSE... first, t19 at 20, the marker at 21, t2981 after it, t3000 last.

The #1541 conflict in config.mdx and errors.mdx still stands; whichever merges second rebases.

@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 6 files (changes from recent commits).

Requires human review: Auto-approval blocked by 7 unresolved issues from previous reviews.

View guided diff | Re-trigger cubic

@okwasniewski
okwasniewski dismissed their stale review November 6, 2026 22:13

Superseded by re-review of 559af44

@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 (agent-run triage).

Re-review of 559af44. Close: the code is right, must-fix 1 is done (all 3 overlap mutations are killed), and every nit is taken. I accept your always-shift/always-pop equivalence argument. A 300k-input fuzz (CRLF split at the edge, ANSI, cut multibyte, tabs) found no difference. Two small things are left.

Must fix

  • docs/reference/errors.mdx:106 still has no byte bound, although config.mdx and web.mdx now do. "Up to 40 lines whole" is wrong for a short log of long lines: 10 lines of 1 KiB quote 3 + marker + 3. The inserted sentence also leaves "Without one" reading as if it means "a longer log". Simplest fix: drop the counts on this page, e.g. "The quote keeps the first and last lines of a long log, with [startup output omitted] between them."

Should fix

  • Nothing tests the byte threshold of the overlap branch (end - offset <= OUTPUT_WINDOW_BYTES * 2): *1 and *3 both pass the suite. Two tests that pass on this head close it:
    • 25 lines of 250 bytes (~6.3 KB) are quoted whole. This kills *1.
    • 10 lines of 1024 chars quote exactly lines 0-2, the marker, then 7-9. This kills *3, and it is also the case the docs describe.

Nit

  • config.mdx/web.mdx "taken from the 4 KiB at each end" isn't strictly true for a log under 8 KiB with more than 40 lines, where the head can reach past 4 KiB. Fine to ignore.

Ran

  • managed-process tests: 34/34 pass.
  • tsc, oxlint, check-changeset-bumps and check-error-codes: all clean.
  • The log-path-cannot-be-opened test passes on macOS on both main and this branch, which matches your Windows-only note.
  • It merges cleanly into main, but still conflicts with #1541 in config.mdx and errors.mdx. Whichever lands second rebases.

A process that fails early and then keeps logging - a file watcher, say -
buried the startup error under its own tail: the message quoted only the last
20 lines appended since the command started. It now quotes the first and last
20 lines with `[startup output omitted]` between them when the log is longer,
both windows still byte-bounded and passed through the same redactor, so the
error that explains the failure survives.

Fixes e2e-inc#1527
@DeryFerd
DeryFerd force-pushed the fix/app-unreachable-first-lines branch from 559af44 to 789a047 Compare November 7, 2026 14:58
@DeryFerd

DeryFerd commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

@okwasniewski both in 789a047 (one commit).

Must fix, errors.mdx:106. Counts dropped as you suggested: "The quote keeps the first and last lines of a long log, with [startup output omitted] between them." The next sentence names the option instead of a pronoun, so it reads "Without a log, the message says to set one", which the inserted sentence can no longer swallow. The page no longer claims a line count it cannot keep for a short log of long lines; the byte bound lives on config.mdx and web.mdx, where the option is described.

Should fix, the overlap byte threshold. Both tests are in, and they pass on this head:

test what it pins
25 lines of 250 bytes (~6.25 KB) quoted whole, no marker the threshold is not half of what it should be
10 lines of 1024 chars: lines 0-2, the marker, then 7-9 the threshold is not a third larger than it should be

Ran the mutations you named against the file:

mutation before now
end - offset <= OUTPUT_WINDOW_BYTES * 1 survived killed
end - offset <= OUTPUT_WINDOW_BYTES * 3 survived killed

The second test is also the shape the docs describe, so it doubles as documentation coverage.

Nit, the 4 KiB clause. Fixed in both pages rather than ignored: "A log of up to 40 lines inside 8 KiB is quoted whole. Otherwise the quote keeps up to 20 lines from each end, with [startup output omitted] between them, and for a log past 8 KiB those lines come from its first and last 4 KiB." That is true in the corner you flagged, where a log under 8 KiB with more than 40 lines reaches past 4 KiB for its head.

Verified on 789a047. vitest run tests/unit/managed-process.test.ts: 34 passed, 1 failed, 1 skipped. The failure is fails with APP_UNREACHABLE when the log path cannot be opened, the Windows-only one you confirmed passes on macOS on main and here. tsc --noEmit exit 0, oxlint 0 warnings and 0 errors, check-changeset-bumps.ts and check-error-codes.ts exit 0.

No source change this round, only the two tests and the three docs, so the built-CLI measurement from the previous head still describes this one: 3,000 short lines after a log a previous run left mid-line quote 41 lines, fatal: EADDRINUSE... first, t19 at 20, the marker at 21, t2981 after it, t3000 last.

The #1541 conflict in config.mdx and errors.mdx still stands; whichever merges second rebases.

@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 4 files (changes from recent commits).

Requires human review: Auto-approval blocked by 7 unresolved issues from previous reviews.

View guided diff | Re-trigger cubic

@okwasniewski

Copy link
Copy Markdown
Member

Automated re-review (agent-run triage) at 789a047bd.

Both CR 3 asks done:

  • errors.mdx:106 drops the counts: "keeps the first and last lines of a long log, with [startup output omitted] between them", and "Without a log" reads right.
  • Byte threshold now tested: 25x250 B quoted whole, 10x1 KiB gives lines 1-3, marker, 8-10. The *1/*3 mutations are killed.

managed-process tests 36/36, tsc and oxlint clean, CI green. 21/30 mutations killed; 6 survivors are equivalent (incl. always-pop, your argument holds). Labeling Ready for Human Review.

Optional

  • 3 real but untested edges (code is correct on each): a line ending exactly at the 4 KiB head edge, a log of exactly 8192 bytes (<= -> < survives), a log over 8 KiB without a trailing newline.
  • PR body is stale: still describes readLines(fd, end, from, to, clippedStart, clippedEnd) (now a { start, end } clip), "Two tests were added", "26 passed", and has 5 em dashes.

For maintainers: still conflicts with #1541 (Ready) in config.mdx/errors.mdx; whichever lands second resolves it. #1541 cuts the errors.mdx row to a link, so this PR's sentence likely moves to config.mdx. After #1541 a post-ready exit also quotes through unreachable(), so [startup output omitted] should probably become [output omitted].

@okwasniewski
okwasniewski dismissed their stale review November 7, 2026 16:21

Asks addressed, see re-review comment.

@kdy1 kdy1 self-assigned this Nov 9, 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.

I verified the before & after of the log messages

@kdy1
kdy1 added this pull request to the merge queue Nov 9, 2026
Merged via the queue into e2e-inc:main with commit 9289ff4 Nov 9, 2026
26 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 9, 2026
samanyudas added a commit to samanyudas/e2e that referenced this pull request Nov 10, 2026
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>
kblok added a commit to hardkoded/e2e-dotnet that referenced this pull request Nov 10, 2026
A process that fails early and then keeps logging (a file watcher, say)
buried the startup error under its own tail: the message quoted only the
last 20 lines appended since the command started. Now a log of up to 40
lines inside 8 KiB is quoted whole. A longer one quotes its first and last
20 lines with `[startup output omitted]` between them, both windows still
byte-bounded and passed through the same redactor.

Port of e2e-inc/e2e#1577 (9289ff4). Fixes #1505.

Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>
DeryFerd pushed a commit to DeryFerd/e2e that referenced this pull request Nov 11, 2026
…1541)

* test(core): reproduce app commands exiting after readiness

* fix(core): fail runs when app commands exit after readiness

* test(core): tighten app exit outcomes and diagnostic docs

* fix(core): scope app command exits to dependent targets

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.

* fix(core): clarify app readiness and output guidance

* fix(core): share app command interruption and cover buffered exits

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.

* refactor(core): return app-exit target set directly

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.

* test(core): cover app-exit guards and process liveness

* test(core): expect app exits to quote short logs whole

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>

* docs(changeset): note that background launchers now fail

Apply suggestion from @kdy1

Co-authored-by: Donny/강동윤 <kdy.1997.dev@gmail.com>

* fix(core): keep reused app hints from promising command output

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>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Donny/강동윤 <kdy.1997.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for Human Review size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

APP_UNREACHABLE drops the first startup lines when an app keeps logging

3 participants