Skip to content

fix(terminal): release a session slot when its client disconnects mid-write - #258

Merged
zackees merged 1 commit into
mainfrom
fix/terminal-bounded-write
Sep 17, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/terminal-bounded-write

Conversation

@zackees

@zackees zackees commented Sep 17, 2026

Copy link
Copy Markdown
Member

Fixes #256.

Cascade

Tests

test_terminal_240_disconnect_with_blocked_stdin now:

  • runs on Chromium and WebKit (it was Chromium-only);
  • requires all four slots back within 5 s, not just one (the blocked program is sleep 30);
  • asserts no CLI descendant still holds /dev/ptmx or runs the blocked sleep.

Local results:

without terminal.rs change with it
blocked stdin, Chromium FAIL (slots leaked) PASS 1.9 s
blocked stdin, WebKit FAIL (slots leaked) PASS 2.2 s
interactive (incl. 120 KB paste), Chromium / WebKit — PASS / PASS
  • WebKit ran in mcr.microsoft.com/playwright:v1.62.0-noble via playwright run-server, because Playwright can't install WebKit on NixOS. The browser pointed at the host's loopback server.
  • bash test: 304 Rust + 45 Python passed.
  • fmt, clippy -D warnings, ruff, black, isort, pyright: clean. dylint could not run locally (no rustup); CI covers it.
  • No JSPI flags or code touched.

🤖 Generated with Claude Code

…-write

A client input write parked on a full PTY input queue held the worker, the
session and its semaphore permit until the foreground program exited; killing
the process tree does not release a blocked write. Follow kernal-api to
v0.1.11 and write client input through PtySession::write_available in 50 ms
slices, checking the disconnect flag between them.

The blocked-stdin regression now runs on Chromium and WebKit, requires all four
slots back within 5 s (the blocked program is `sleep 30`), and asserts no
descendant of the CLI still holds a PTY master or runs the blocked program.

Fixes #256

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zackees
zackees merged commit 39fa562 into main Sep 17, 2026
16 checks passed
@zackees
zackees deleted the fix/terminal-bounded-write branch September 17, 2026 02:46
zackees added a commit that referenced this pull request Sep 18, 2026
CLI:
- `fastled <sketch>` no longer crashes with "Cannot drop a runtime" after
  starting the server (#269).
- `--terminal-cmd` / FASTLED_TERMINAL_CMD runs an agent in the browser
  terminal, and a configured session survives a page reload through a
  single-use reattach token (#254, #267).

Terminal:
- The shell starts in the named directory and emits valid exit frames (#257).
- A client that disconnects mid-write releases its session slot (#256, #258).

Viewer:
- Screen maps registered after setup() now reach the renderer, so sketches
  like Blink no longer show an empty canvas (#250, #264).
- The page no longer overflows the window by 40 px, and the title scales
  with the window (#268, #270).

CI:
- Browser terminal suite on Linux, Windows and real Safari (#259, #260).
- Linux render smoke that fails on a blank canvas (#247, #266).
- Linux dependencies install before setup-soldr, so the dependency cook
  succeeds (#263); lint covers ci/ (#265); an Intel macOS guest WebKit
  probe (#251, #261).

Co-Authored-By: Claude Opus 5 (1M context) <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.

fix(terminal): a write parked on a full PTY input queue holds its slot until the foreground program exits

1 participant