Skip to content

fix(tui): surface gateway stderr tail in start_timeout activity#17112

Merged
OutThisLife merged 2 commits into
mainfrom
bb/tui-startup-stderr
Apr 28, 2026
Merged

fix(tui): surface gateway stderr tail in start_timeout activity#17112
OutThisLife merged 2 commits into
mainfrom
bb/tui-startup-stderr

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

gateway.start_timeout previously carried only cwd + python. When the TUI gateway failed to start within HERMES_TUI_STARTUP_TIMEOUT_MS, users saw a generic banner with no clue whether the cause was a wrong Python interpreter, a missing dependency, or a config-parse failure — and had to leave the TUI to run `/logs`.

This appends the most recent gateway stderr lines to the timeout event and renders them inline in the activity feed.

Changes

  • gatewayClient.ts — capture getLogTail(20) when the readyTimer fires and attach it as payload.stderr_tail.
  • gatewayTypes.ts — extend the gateway.start_timeout event union with the new optional field.
  • createGatewayEventHandler.ts — emit the trimmed last 8 non-empty lines as error-toned activity entries, after the existing gateway startup timed out line.

Why this matters

Most TUI startup failures are recoverable once the user sees the actual exception. ~ZERO cost when startup succeeds; bounded to the existing 200-line CircularBuffer when it doesn't.

HERMES_TUI_STARTUP_TIMEOUT_MS was already configurable but undocumented — this fix doubles down on diagnostics so users rarely need to bump it.

Test plan

  • npm run type-check — clean
  • npm test -- --run390/390 pass
  • New regression test in createGatewayEventHandler.test.ts verifies ModuleNotFoundError / FileNotFoundError lines from the tail land in getTurnState().activity.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Apr 28, 2026
@OutThisLife OutThisLife requested a review from Copilot April 28, 2026 20:12

Copilot AI 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.

Pull request overview

Surfaces recent gateway stderr/log output in the TUI when gateway startup times out, so users can diagnose startup failures without leaving the UI to run /logs.

Changes:

  • Extend gateway.start_timeout event payload to optionally include stderr_tail.
  • Capture a log tail on startup timeout in GatewayClient and attach it to the timeout event.
  • Render the tail inline as additional error-toned activity entries; add a regression test.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
ui-tui/src/gatewayTypes.ts Extends GatewayEvent union for gateway.start_timeout to include optional stderr_tail.
ui-tui/src/gatewayClient.ts Captures getLogTail(20) on startup timeout and publishes it in the timeout event payload.
ui-tui/src/app/createGatewayEventHandler.ts Displays up to 8 lines from stderr_tail as error activity after the timeout banner.
ui-tui/src/tests/createGatewayEventHandler.test.ts Adds test asserting stderr tail lines appear in activity after gateway.start_timeout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/app/createGatewayEventHandler.ts Outdated
Comment thread ui-tui/src/app/createGatewayEventHandler.ts Outdated
`gateway.start_timeout` previously published only `cwd` + `python`,
which made TUI startup failures hard to disambiguate.  The user saw
`gateway startup timed out · /path/to/python /repo · /logs to inspect`
with no signal whether the actual cause was a wrong python interpreter,
a missing dependency, or a config parse failure.

Plumb a 20-line stderr tail through the event so the most useful lines
land directly in the TUI activity feed, capped to the last 8 non-empty
lines for readability:

* `gatewayClient.ts` — collect `getLogTail(20)` when the readyTimer
  fires and attach it as `payload.stderr_tail`.
* `gatewayTypes.ts`  — extend the `gateway.start_timeout` event union
  with the new optional field.
* `createGatewayEventHandler.ts` — emit the trimmed lines after the
  existing `gateway startup timed out` activity entry, classified
  `error`.

Tests: regression test in `createGatewayEventHandler.test.ts` checks
that `ModuleNotFoundError` / `FileNotFoundError` lines from the tail
land in `getTurnState().activity` so they show up in the UI immediately.

Validation: `npm run type-check` clean, `npm test --run` 390/390.

Copilot AI 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.

Pull request overview

Improves TUI startup-timeout diagnostics by attaching a tail of recent gateway stderr/log output to the gateway.start_timeout event and rendering the most relevant lines inline in the activity feed.

Changes:

  • Extend gateway.start_timeout event payload with optional stderr_tail.
  • Capture getLogTail(20) on startup timeout and include it in the published event.
  • Render the last 8 non-empty stderr tail lines (trimmed, capped to 120 chars) as error activity entries, and add a regression test.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
ui-tui/src/gatewayTypes.ts Extends the GatewayEvent union to include optional stderr_tail for gateway.start_timeout.
ui-tui/src/gatewayClient.ts Captures recent log tail on startup timeout and publishes it as part of the timeout event payload.
ui-tui/src/app/createGatewayEventHandler.ts Displays trimmed, non-empty tail lines (max 8, 120-char cap) as inline error activity entries on startup timeout.
ui-tui/src/tests/createGatewayEventHandler.test.ts Adds a regression test ensuring stderr tail lines are surfaced into activity on gateway.start_timeout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OutThisLife OutThisLife merged commit a830f25 into main Apr 28, 2026
10 of 14 checks passed
@OutThisLife OutThisLife deleted the bb/tui-startup-stderr branch April 28, 2026 20:56
cluricaun28 referenced this pull request in cluricaun28/Logos Apr 28, 2026
* fix(tui): append gateway stderr tail to start_timeout activity

`gateway.start_timeout` previously published only `cwd` + `python`,
which made TUI startup failures hard to disambiguate.  The user saw
`gateway startup timed out · /path/to/python /repo · /logs to inspect`
with no signal whether the actual cause was a wrong python interpreter,
a missing dependency, or a config parse failure.

Plumb a 20-line stderr tail through the event so the most useful lines
land directly in the TUI activity feed, capped to the last 8 non-empty
lines for readability:

* `gatewayClient.ts` — collect `getLogTail(20)` when the readyTimer
  fires and attach it as `payload.stderr_tail`.
* `gatewayTypes.ts`  — extend the `gateway.start_timeout` event union
  with the new optional field.
* `createGatewayEventHandler.ts` — emit the trimmed lines after the
  existing `gateway startup timed out` activity entry, classified
  `error`.

Tests: regression test in `createGatewayEventHandler.test.ts` checks
that `ModuleNotFoundError` / `FileNotFoundError` lines from the tail
land in `getTurnState().activity` so they show up in the UI immediately.

Validation: `npm run type-check` clean, `npm test --run` 390/390.

* review(copilot): filter blanks before slice and cap stderr tail at 120 chars
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…Research#17112)

* fix(tui): append gateway stderr tail to start_timeout activity

`gateway.start_timeout` previously published only `cwd` + `python`,
which made TUI startup failures hard to disambiguate.  The user saw
`gateway startup timed out · /path/to/python /repo · /logs to inspect`
with no signal whether the actual cause was a wrong python interpreter,
a missing dependency, or a config parse failure.

Plumb a 20-line stderr tail through the event so the most useful lines
land directly in the TUI activity feed, capped to the last 8 non-empty
lines for readability:

* `gatewayClient.ts` — collect `getLogTail(20)` when the readyTimer
  fires and attach it as `payload.stderr_tail`.
* `gatewayTypes.ts`  — extend the `gateway.start_timeout` event union
  with the new optional field.
* `createGatewayEventHandler.ts` — emit the trimmed lines after the
  existing `gateway startup timed out` activity entry, classified
  `error`.

Tests: regression test in `createGatewayEventHandler.test.ts` checks
that `ModuleNotFoundError` / `FileNotFoundError` lines from the tail
land in `getTurnState().activity` so they show up in the UI immediately.

Validation: `npm run type-check` clean, `npm test --run` 390/390.

* review(copilot): filter blanks before slice and cap stderr tail at 120 chars
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…Research#17112)

* fix(tui): append gateway stderr tail to start_timeout activity

`gateway.start_timeout` previously published only `cwd` + `python`,
which made TUI startup failures hard to disambiguate.  The user saw
`gateway startup timed out · /path/to/python /repo · /logs to inspect`
with no signal whether the actual cause was a wrong python interpreter,
a missing dependency, or a config parse failure.

Plumb a 20-line stderr tail through the event so the most useful lines
land directly in the TUI activity feed, capped to the last 8 non-empty
lines for readability:

* `gatewayClient.ts` — collect `getLogTail(20)` when the readyTimer
  fires and attach it as `payload.stderr_tail`.
* `gatewayTypes.ts`  — extend the `gateway.start_timeout` event union
  with the new optional field.
* `createGatewayEventHandler.ts` — emit the trimmed lines after the
  existing `gateway startup timed out` activity entry, classified
  `error`.

Tests: regression test in `createGatewayEventHandler.test.ts` checks
that `ModuleNotFoundError` / `FileNotFoundError` lines from the tail
land in `getTurnState().activity` so they show up in the UI immediately.

Validation: `npm run type-check` clean, `npm test --run` 390/390.

* review(copilot): filter blanks before slice and cap stderr tail at 120 chars
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…Research#17112)

* fix(tui): append gateway stderr tail to start_timeout activity

`gateway.start_timeout` previously published only `cwd` + `python`,
which made TUI startup failures hard to disambiguate.  The user saw
`gateway startup timed out · /path/to/python /repo · /logs to inspect`
with no signal whether the actual cause was a wrong python interpreter,
a missing dependency, or a config parse failure.

Plumb a 20-line stderr tail through the event so the most useful lines
land directly in the TUI activity feed, capped to the last 8 non-empty
lines for readability:

* `gatewayClient.ts` — collect `getLogTail(20)` when the readyTimer
  fires and attach it as `payload.stderr_tail`.
* `gatewayTypes.ts`  — extend the `gateway.start_timeout` event union
  with the new optional field.
* `createGatewayEventHandler.ts` — emit the trimmed lines after the
  existing `gateway startup timed out` activity entry, classified
  `error`.

Tests: regression test in `createGatewayEventHandler.test.ts` checks
that `ModuleNotFoundError` / `FileNotFoundError` lines from the tail
land in `getTurnState().activity` so they show up in the UI immediately.

Validation: `npm run type-check` clean, `npm test --run` 390/390.

* review(copilot): filter blanks before slice and cap stderr tail at 120 chars
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…Research#17112)

* fix(tui): append gateway stderr tail to start_timeout activity

`gateway.start_timeout` previously published only `cwd` + `python`,
which made TUI startup failures hard to disambiguate.  The user saw
`gateway startup timed out · /path/to/python /repo · /logs to inspect`
with no signal whether the actual cause was a wrong python interpreter,
a missing dependency, or a config parse failure.

Plumb a 20-line stderr tail through the event so the most useful lines
land directly in the TUI activity feed, capped to the last 8 non-empty
lines for readability:

* `gatewayClient.ts` — collect `getLogTail(20)` when the readyTimer
  fires and attach it as `payload.stderr_tail`.
* `gatewayTypes.ts`  — extend the `gateway.start_timeout` event union
  with the new optional field.
* `createGatewayEventHandler.ts` — emit the trimmed lines after the
  existing `gateway startup timed out` activity entry, classified
  `error`.

Tests: regression test in `createGatewayEventHandler.test.ts` checks
that `ModuleNotFoundError` / `FileNotFoundError` lines from the tail
land in `getTurnState().activity` so they show up in the UI immediately.

Validation: `npm run type-check` clean, `npm test --run` 390/390.

* review(copilot): filter blanks before slice and cap stderr tail at 120 chars
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…Research#17112)

* fix(tui): append gateway stderr tail to start_timeout activity

`gateway.start_timeout` previously published only `cwd` + `python`,
which made TUI startup failures hard to disambiguate.  The user saw
`gateway startup timed out · /path/to/python /repo · /logs to inspect`
with no signal whether the actual cause was a wrong python interpreter,
a missing dependency, or a config parse failure.

Plumb a 20-line stderr tail through the event so the most useful lines
land directly in the TUI activity feed, capped to the last 8 non-empty
lines for readability:

* `gatewayClient.ts` — collect `getLogTail(20)` when the readyTimer
  fires and attach it as `payload.stderr_tail`.
* `gatewayTypes.ts`  — extend the `gateway.start_timeout` event union
  with the new optional field.
* `createGatewayEventHandler.ts` — emit the trimmed lines after the
  existing `gateway startup timed out` activity entry, classified
  `error`.

Tests: regression test in `createGatewayEventHandler.test.ts` checks
that `ModuleNotFoundError` / `FileNotFoundError` lines from the tail
land in `getTurnState().activity` so they show up in the UI immediately.

Validation: `npm run type-check` clean, `npm test --run` 390/390.

* review(copilot): filter blanks before slice and cap stderr tail at 120 chars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants