Skip to content

fix: preserve terminal connections across consumer cancellation - #61

Merged
Blind-Striker merged 3 commits into
masterfrom
codex/d-terminal
Sep 8, 2026
Merged

Blind-Striker merged 3 commits into
masterfrom
codex/d-terminal

Conversation

@Blind-Striker

@Blind-Striker Blind-Striker commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Canceling a pending terminal read previously passed cancellation to the physical WebSocket and could abort the connection. Both terminal families now keep receiving independently, so a consumer can cancel and later read or write on the same healthy attachment. Queued output precedes the terminal outcome; explicit disposal abandons unread output and joins owned work.

Persistent input preserves locally requested viewport dimensions in send order. Both connection options add a finite SendTimeout (30 seconds by default), covering queue wait and physical send. Queued expiry affects that call; physical interruption ends the attachment without retry. Runtime/packaging canon and ADR-0023 document these contracts.

The first hosted Windows run exposed nested cancellation scheduling in existing net472 cleanup test helpers. The follow-up uses the already-owned worker directly and removes unrelated observation timers from teardown unit tests. An isolated actual-code probe changed from stuck cleanup to one completed callback; all 31 focused ownership tests and the full 5,134-test local gate passed.

Validation:

  • TDD red/green evidence for viewport ordering, send deadlines, pending-read reuse, stable outcomes, and shared disposal.
  • Windows Release solution build, Slopwatch, whitespace/style checks, and full suite: 5,134 passed, 0 failed, 0 skipped.
  • Linux real normal/persistent PTY tests on net8/net9/net10: 6 passed, 0 failed, 0 skipped; persistent daemon round trip and same-connection execution after normal PTY read cancellation verified.
  • Before/after allocation benchmarks: 14 matched cases across net10/net472. For 1,024 small frames on .NET 10, normal PTY rose from 205,600 to 240,464 B and persistent PTY from 197,624 to 232,288 B per connection lifetime. This is the measured cost of the new contract; no speed claim.

The consumer queue is unbounded and can grow for slow or absent consumers. Final three-platform CI passed on b231755: Windows 5,134, Linux 4,030, macOS 4,030; zero failures/skips. All 20 normal/persistent terminal live outcomes across ten platform/framework legs were verified from the original TRX reports. The separate upstream observer-input question is outside this change.

Final documentation follow-up 62970f8 corrects the receive-buffer lifetime in README and roadmap. Its only changes since tested b231755 are those two Markdown files; CI is skipped for that follow-up under the repository workflow rule.

@Blind-Striker
Blind-Striker marked this pull request as ready for review September 8, 2026 10:29
@Blind-Striker
Blind-Striker merged commit 1bce366 into master Sep 8, 2026
@Blind-Striker
Blind-Striker deleted the codex/d-terminal branch September 14, 2026 12:55
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.

1 participant