Skip to content

docs: diagnose silent TUI exit after sending a message - #880

Merged
mdev34-lab merged 2 commits into
dev-vibecodedfrom
arena/0f857a0f-silvercode
Nov 30, 2026
Merged

mdev34-lab merged 2 commits into
dev-vibecodedfrom
arena/0f857a0f-silvercode

Conversation

@mdev34-lab

@mdev34-lab mdev34-lab commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Issue for this PR

Diagnostic follow-up to the report of Silvercode exiting after a message is sent without terminal output. No issue number was provided.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds silent-crash-diagnosis.md, documenting the investigation into the silent TUI exit.

The write-up identifies the renderer shutdown path, opentui's cached error handling, empty error messages, and worker-crash logging as concrete diagnostic gaps. The original crash trigger could not be reproduced, so the document distinguishes confirmed behavior from the likely native-session failure and includes a capture recipe for the next occurrence.

No runtime code is changed.

How did you verify your code works?

This is a documentation-only change. The investigation included a PTY reproduction matrix, the packages/tui test suite (953 tests), and bun typecheck; all reported green. The crash itself was not reproduced. Details and limitations are recorded in the added document.

Screenshots / recordings

Not applicable; this PR changes documentation only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Root-cause write-up for the no-output crash report:

- Part (b): the TUI only prints a failure when exit.reason is set
  (app.tsx:402-404); a renderer destroy without a reason resolves the
  shutdown deferred with Effect.void (app.tsx:277) and cli/cmd/tui.ts
  ends in an unconditional process.exit(0) - silent exit, code 0.
- opentui's nativeSession.closed.catch funnels errors through handleError
  (console.error into the cache with openConsoleOnError:false) and then
  destroys the renderer itself; exit.consoleLogs is only captured inside
  stopOnError, so the real error is never dumped.
- cliErrorMessage returns "" for some error types (util/error.ts), and
  "" ?? errorFormat(...) does not fall through - stderr gets just a newline.
- Worker-crash logs default to a console.error snapshot written into the
  active alternate screen and are discarded on restore; onExit's exitCode=1
  is overwritten by the trailing process.exit(0).
- Part (a): repro matrix (layouts, widths, tool calls, scroll, worker
  SIGSEGV restart, repo config) did not crash; evidence narrows the
  trigger to the silent failure classes above. Includes capture recipe
  (OPENCODE_PRINT_LOGS, OTUI_DUMP_CAPTURES) and recommended fixes.

Co-authored-by: arena-agent <[email protected]>
@github-actions

Copy link
Copy Markdown

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@kilo-code-bot

kilo-code-bot Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • silent-crash-diagnosis.md
Previous Review Summary (commit 297b629)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 297b629)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • silent-crash-diagnosis.md

Reviewed by free · Input: 72.1K · Output: 2.6K · Cached: 166.6K

@mdev34-lab mdev34-lab left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Review findings: the investigation is useful and the documented shutdown path is supported by the current source. I found two issues in the recommended fixes that should be corrected before treating this write-up as implementation guidance. GitHub does not allow a REQUEST_CHANGES review on the PR author’s own pull request, so I am leaving these as review comments.

Comment thread silent-crash-diagnosis.md Resolved
Comment thread silent-crash-diagnosis.md Resolved
- Fix 1: do not synthesize a crash reason for every reason-less destroy.
  SIGHUP and reason-less ExitProvider exits legitimately destroy the
  renderer without a reason; capture console cache on any destroy, but
  gate the synthesized reason on an explicit exit.intentional flag so
  normal exits do not print a false 'renderer destroyed unexpectedly'.
- Fix 3: a direct process.stderr.write callback does not help - writes
  still land inside the active alternate screen and are discarded on
  restore, and the default logger already writes directly to stderr.
  Buffer worker log messages instead and flush after run() completes
  (renderer destroyed, terminal restored).
- Part (a): rank the silent failure classes explicitly as candidates,
  not a confirmed root cause - the original failure was not reproduced.

Co-authored-by: arena-agent <[email protected]>
@mdev34-lab
mdev34-lab merged commit 82512f4 into dev-vibecoded Nov 30, 2026
8 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