Skip to content

fix(tui): preserve drafts and input across resize and auth handoffs - #410

Merged
srothgan merged 3 commits into
mainfrom
fix/tui-input-preservation
Oct 2, 2026
Merged

srothgan merged 3 commits into
mainfrom
fix/tui-input-preservation

Conversation

@srothgan

@srothgan srothgan commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Summary

Preserve unsent drafts and exact Unicode input through terminal resize, paste boundaries, turn failures, and authentication handoffs.

  • Retain the complete composer and attachments when prompt dispatch fails, and retain the next unsent draft when the active turn fails.
  • Flush buffered typing before non-character keys and terminal paste payloads; preserve Windows combining-character input and simultaneous Unix resize/input readiness.
  • Stop and join the terminal reader before an auth child inherits stdin, suspend TUI output during child ownership, restore usable input after success or failure, and stop the owned child during shutdown.
  • Expand the real PTY suite to 14 tests covering rendering, drafts, paste thresholds, queued turns, cancellation, dialogs, auth, and protocol failures; require Ubuntu, Windows, and macOS terminal-test jobs.

Why

The composer could be cleared before bridge queue admission or by an unrelated active-turn error. Buffered typing could also be discarded or reordered around control keys and paste events. Auth children shared stdin with a background reader while the TUI continued writing terminal output.

These changes move input consumption and terminal handoff to explicit commit points and verify the resulting workflows using the actual binary in a PTY. The auth ownership regression also fails against the previous committed implementation.

Related to #407 and #408.

Validation

  • Automated: cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --all-features, and cargo fetch --locked passed on Windows.
  • Automated: All 14 real PTY tests passed on Windows and in an isolated Linux Docker container with networking disabled; node --check tests/fixtures/fake-bridge.js passed.
  • Automated: cargo deny check bans licenses sources advisories and npm run quality:duplicates passed. macOS verification remains for the required CI matrix job.
  • Manual: No manual terminal, browser OAuth, or live SDK/model verification performed; fixture limitations are documented.
  • Screenshot/video (if UI changed): N/A; regression coverage checks terminal contents and exact submitted payloads.

Notes

  • Breaking changes: None; the Rust/bridge wire contract is unchanged.
  • Docs updated: tests/fixtures/README.md documents scenarios, isolation, test requirements, and coverage limits. The fixtures exercise checked-in contracts and deliberate failure paths; they are not an independent SDK conformance oracle.
  • Governance/release impact: No release or publishing changes. The PR gate requires the three-platform PTY matrix.

- preserve drafts and attachments until prompt queue admission succeeds
- retain and display unsent drafts after turn errors
- repaint buffered input and preserve Windows combining accents
- add scripted PTY fixtures with exact prompt and paste verification
- require terminal regression tests on Windows, Linux, and macOS
- stop and join terminal input before handing control to auth children
- restore input after auth and stop owned children during shutdown
- preserve input during simultaneous Unix resize and typing
- flush buffered typing before terminal paste payloads
- extend real PTY coverage for queues, cancellation, dialogs, auth, and bridge failures
@srothgan srothgan added area: ci CI/CD pipeline and GitHub Actions type: fix Fixes a bug or regression area: tui Terminal UI, rendering, input, and keymap area: core App lifecycle, runtime, agent, and session core labels Oct 2, 2026
- use a missing Unix interpreter to trigger an actual auth spawn error
- retain Windows invalid executable coverage and input restoration checks
- document macOS shell fallback and platform-specific fixture behavior
@srothgan
srothgan merged commit f30a69c into main Oct 2, 2026
18 checks passed
@srothgan
srothgan deleted the fix/tui-input-preservation branch October 2, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI/CD pipeline and GitHub Actions area: core App lifecycle, runtime, agent, and session core area: tui Terminal UI, rendering, input, and keymap type: fix Fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant