Repository navigation
Description
Agent Diagnostic
- Skills loaded:
tui-development,create-github-issue - OpenShell version tested:
0.0.82-dev.10+g40194f93from currentmain(40194f93) - Latest release checked:
v0.0.80(published 2026-07-09) - Known fixes reviewed: reviewed recent TUI history, including
fix(tui): route warning logs to status bar instead of stderr (#2210); the shell restoration sequence has been unchanged since the shell feature landed - Possible duplicates reviewed: searched all issues for TUI black screens, shell exit, alternate-screen restoration, and post-shell refresh behavior. Closed fix(tui): shell connect broken — wrong ssh-proxy CLI arguments after #175 rename #188 concerns incorrect SSH proxy arguments and is not a duplicate
- Findings: reproduced on this Ubuntu host. After the remote
exit, OpenShell re-enters and clears the alternate screen, then synchronously runsrefresh_data()before the event loop can draw another frame. The refresh consists of several sequential gRPC calls with individual five-second timeouts, leaving an entirely black screen for approximately 20–30 seconds. Once the refresh finishes, the TUI redraws and responds normally - Remaining reason for filing: the blank screen looks like a terminal deadlock, accepts no visible interaction while refresh is running, and can cause users to kill the TTY even though the process eventually recovers
Description
Actual behavior: After opening a sandbox from openshell term, pressing s for a shell, and running exit, OpenShell switches back to an empty alternate screen. The screen remains black for roughly 20–30 seconds before the TUI eventually reappears. Users can reasonably interpret this as a hung terminal and kill the TTY.
Expected behavior: Exiting the sandbox shell should restore and draw the TUI immediately. Any gateway refresh should happen after a visible frame is rendered, preferably asynchronously without blocking input or rendering.
The current flow handles pending_shell_connect in crates/openshell-tui/src/lib.rs by awaiting handle_shell_connect(), then awaiting refresh_data(). handle_shell_connect() re-enters and clears the alternate screen before it returns. The event loop cannot draw until the synchronous refresh chain completes.
The terminal restoration operations (enable_raw_mode, EnterAlternateScreen, mouse capture, and terminal.clear) also discard errors with let _ = ..., which makes a genuine restoration failure indistinguishable from the refresh delay.
Reproduction Steps
- Run
openshell term. - Select a ready sandbox.
- Press
sto open its interactive shell. - Run
exit. - Observe that OpenShell enters a black alternate screen with no visible TUI or feedback.
- Wait approximately 20–30 seconds; the TUI eventually redraws and is responsive again.
Environment
- OS: Ubuntu 24.04, Linux
6.17.0-1026-nvidia - Architecture: arm64/aarch64
- Terminal:
TERM=xterm-256color - Docker:
29.2.1 - OpenShell:
0.0.82-dev.10+g40194f93, currentmainat40194f93 - Latest release checked: yes,
v0.0.80 - Possible duplicates checked: yes; fix(tui): shell connect broken — wrong ssh-proxy CLI arguments after #175 rename #188 is related to shell connect but addresses a different failure
Logs
The PTY output after exit stops immediately after alternate-screen entry and clear, with no frame content until the refresh completes:
exit
<leave bracketed paste mode>
exit
<enter alternate screen>
<enable mouse capture>
<clear screen>
... approximately 20–30 seconds with no output ...
<TUI frame is finally drawn>
Activity
johntmyers commentedon Jul 11, 2026
Implementation Plan
Issue type:
fixComplexity: Low
Confidence: High — reproduced cause and control flow are explicit
Summary
Restore and paint the TUI synchronously when the SSH child exits, before any gateway RPC refresh can run. Make terminal suspend/resume failures observable instead of silently continuing with a potentially unusable terminal, while retaining the existing post-shell refresh for fresh data after a visible frame exists.
Scope
crates/openshell-tui/src/lib.rs: make the interactive shell handoff fallible, propagate terminal lifecycle failures, and draw the current UI immediately after terminal restoration and before returning to the caller's synchronous refresh.crates/openshell-tui/src/lib.rs: apply equivalent terminal suspend/resume error handling to the create-sandbox exec-command path so both SSH handoffs use consistent lifecycle behavior.crates/openshell-tui/src/app.rs: no changes expected.crates/openshell-tui/src/event.rs: no changes expected.Implementation Steps
fix/2229-restore-tui-after-shell/johntmyersbranch, refactor the two SSH suspend/resume paths to returnmiette::Result<()>and propagate raw-mode, alternate-screen, mouse-capture, clear, and draw failures instead of discarding them.ui::drawbefore resuming event polling and returning to the caller; keeprefresh_data()after the handoff so the first visible frame is not delayed by RPC timeouts.Test Plan
openshell-tuitests to cover App/UI regressions.openshell termin a PTY on Ubuntu: enter a ready sandbox withs, runexit, verify an immediate nonblank frame, then verify keyboard navigation. Repeat several times and with gateway RPC latency/timeouts. Smoke the create-sandbox exec-command restoration path because it shares the lifecycle handling.mise run pre-commitas required.Risks & Open Questions
Documentation Impact
/proc, execution semantics, or inter-process visibility changes.Revision 1 — initial plan
johntmyers commentedon Jul 11, 2026
Implementation Complete
PR: #2230
What was built
The TUI now paints a complete frame immediately after a sandbox shell exits, before post-shell gateway refresh calls can block the event loop. Terminal lifecycle failures are propagated consistently from both SSH handoff paths.
Tests
openshell-tuisuite, 24 passedmise run pre-commitDocs updated
The issue will auto-close when the PR is merged.
johntmyers commentedon Jul 11, 2026
Follow-up testing found and fixed a second Linux-specific symptom: after the screen returned, stale refresh ticks could starve keyboard events. PR #2230 now clears suspended-state events before resuming input and omits the redundant immediate refresh. Two consecutive Ubuntu shell/exit cycles remained navigable. The reporter confirmed this behavior does not reproduce on macOS.
fix(tui): redraw after sandbox shell exits (#2230)
Chore/resync 20260820 (#4)