Skip to content

Explain terminal disconnects via ttyd's reconnect overlay#59

Merged
jancurn merged 1 commit into
version-1from
claude/admiring-hypatia-i2qK9
Jun 6, 2026
Merged

Explain terminal disconnects via ttyd's reconnect overlay#59
jancurn merged 1 commit into
version-1from
claude/admiring-hypatia-i2qK9

Conversation

@jancurn
Copy link
Copy Markdown
Member

@jancurn jancurn commented Jun 6, 2026

  • The old server-side banner couldn't catch the common stops: the Apify SDK installs no SIGTERM/SIGINT handlers (it's driven by the platform events WebSocket), so the signal-guarded listener never attached — run timeouts, hard aborts and scale-downs showed nothing. A dying process can't reliably flush a banner either.
  • Replace it with a small script injected into ttyd's page that relabels ttyd's own reconnect overlay in the browser, where every disconnect is observable: "Connection lost — press ⏎ to reconnect", and "Actor probably finished" once a retry fails. Cosmetic only — ttyd's Enter-to-reconnect still works.
  • With the overlay covering every stop, remove the now-redundant server-side machinery (shutdown.ts, the direct-socket writes, the migrating/aborting/idle banners); the idle timeout just calls Actor.exit.

The server-side shutdown banner couldn't catch the common stops. The Apify
SDK installs no SIGTERM/SIGINT handlers (it's driven by the platform events
WebSocket), so the `listenerCount(signal) > 0` guard was always false and the
signal listener never attached — run timeouts, hard aborts and scale-downs
showed nothing. A dying process also can't reliably flush a banner.

Instead, inject a small script into ttyd's page that relabels its own
reconnect overlay in the browser, where every disconnect is observable:
"Connection lost — press ⏎ to reconnect", and "Actor probably finished" once a
retry fails. Drop the dead signal-handler block; keep the `migrating`/
`aborting` event banners, which do arrive in advance.

https://claude.ai/code/session_0127nqswxmANoa8VfkmRArmY
@jancurn jancurn changed the title Improve terminal disconnect messaging with client-side overlay relabeling Explain terminal disconnects via ttyd's reconnect overlay Jun 6, 2026
@jancurn jancurn merged commit 8ccf31f into version-1 Jun 6, 2026
jancurn added a commit that referenced this pull request Jun 7, 2026
The client-side reconnect overlay (added in #59) now covers every stop, so the
racy direct-socket banner, the migrating/aborting notices, and shutdown.ts are
redundant. Delete them — the idle timeout just calls Actor.exit. Repoint the
ttyd pin rationale at the overlay strings the injected client script matches.

https://claude.ai/code/session_0127nqswxmANoa8VfkmRArmY

Co-authored-by: Claude <noreply@anthropic.com>
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