Skip to content

fix(gateway): say where and why the gateway panicked in the request's outcome - #332

Merged
fylorn merged 1 commit into
mainfrom
fix/panic-cause-in-request-log
Oct 12, 2026
Merged

fylorn merged 1 commit into
mainfrom
fix/panic-cause-in-request-log

Conversation

@fylorn

@fylorn fylorn commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

A request whose response stream panicked was recorded only as gw.internal ("The request was interrupted by an error inside the gateway."), with no hint of the cause: the panic message goes to stderr, which is not visible when the desktop app runs core.

  • tw_gateway::panic_note: a panic hook (installed by twcore at start) that keeps the panic's message and location on the current thread, logs them, and calls the previous hook.
  • Ending's drop during a panic reports the new gw.internal_panic (detail = message and file:line:col); without a hook it falls back to gw.internal.
  • Data the standard library prints into some panic messages (of `…` after a slicing error, value: … after unwrap) is dropped, and the note is cut to 200 characters, so request content does not end up in the request log.

New message code gw.internal_panic (manifest regenerated). Tests: cargo test -p tw-gateway -p twcore, clippy, fmt.

🤖 Generated with Claude Code

… outcome

When a request's stream panicked, the Ending dropped during unwinding could
only report `gw.internal` ("interrupted by an error inside the gateway"); the
panic message went to stderr, which nobody reads when the desktop app runs
core. twcore now installs a panic hook that notes the message and location on
the current thread (and logs them); the Ending dropped during that unwind
reports `gw.internal_panic` with them. Data that the standard library prints
into some panic messages (` of `...``, `value: ...`) is left out, and the
note is cut to 200 characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit c2b1fd6 into main Oct 12, 2026
6 checks passed
@fylorn
fylorn deleted the fix/panic-cause-in-request-log branch October 12, 2026 07:20
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant