Skip to content

Write shutdown banner directly to browser terminal sockets#51

Merged
jancurn merged 2 commits into
version-1from
claude/amazing-clarke-oPtq4
May 31, 2026
Merged

Write shutdown banner directly to browser terminal sockets#51
jancurn merged 2 commits into
version-1from
claude/amazing-clarke-oPtq4

Conversation

@jancurn
Copy link
Copy Markdown
Member

@jancurn jancurn commented May 31, 2026

The terminal is proxied (browser ↔ Actor ↔ ttyd), so #40's approach — write the banner to the PTY and let ttyd relay it back — lost the race against process exit on platform-initiated stops (abort, migration, run timeout). Only the idle path's flush delay reliably worked, so in practice the banner rarely showed.

  • Write the banner straight to the browser WebSocket as a ttyd output frame, so the bytes reach the kernel before the proxy process dies; fall back to the old PTY broadcast only when no socket is tracked.
  • Route abort, migration, and (defensively, only if the SDK already handles them) SIGINT/SIGTERM through it, with a one-shot guard so the banner shows once.
  • Add unit tests that decode the frame the way ttyd's browser client does (incl. extended-length and multi-byte UTF-8).

A hard SIGKILL still shows nothing — no code runs at that point.

https://claude.ai/code/session_01KrCLcsSMPpsyWwuTyCzYv8

claude added 2 commits May 31, 2026 09:32
The terminal is proxied (browser <-> Actor <-> ttyd), so writing the banner
to the PTY and relaying it back through ttyd lost the race against process
exit on platform-initiated stops (abort, migration, run timeout) — only the
idle path's flush delay reliably worked. Write a ready-made ttyd output frame
straight to the browser socket instead, so the bytes reach the kernel before
the proxy dies; fall back to the PTY devices when no socket is tracked.

https://claude.ai/code/session_01KrCLcsSMPpsyWwuTyCzYv8
The shutdown banner writes ttyd's own WebSocket output frames directly to the
browser, so an unpinned ttyd could change its wire protocol and silently break
banner rendering. Pin it and document how to re-check on a future bump.

https://claude.ai/code/session_01KrCLcsSMPpsyWwuTyCzYv8
@jancurn jancurn merged commit e5d4b54 into version-1 May 31, 2026
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.

3 participants