Skip to content

fix: reconnect dev terminals after backend reloads - #891

Merged
mariusvniekerk merged 2 commits into
mainfrom
t3code/fix-workspace-pane-persistence
Aug 13, 2026
Merged

fix: reconnect dev terminals after backend reloads#891
mariusvniekerk merged 2 commits into
mainfrom
t3code/fix-workspace-pane-persistence

Conversation

@mariusvniekerk

Copy link
Copy Markdown
Collaborator
  • Prevent workspace terminals from disappearing when the Air backend reloads during local development.
  • Let Firefox and other browsers reconnect to the surviving terminal session without reloading or restarting the browser.
  • Preserve real terminal exits and non-development behavior.

generated by a clanker

@roborev-ci

roborev-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown

roborev: Combined Review (ee5da7c)

Code behavior appears sound, but the restart-detach path lacks required end-to-end regression coverage.

High

  • internal/server/workspaceapi/workspace_runtime_terminal_test.go:220 — Existing tests stub the detach flag and inspect manager state separately, so they do not verify that an actual server restart preserves the durable session, omits the exited frame, restores state from SQLite, and permits reconnection. Add a real HTTP/SQLite full-stack test using tmux or ptyowner that launches a session, connects via WebSocket, shuts down with restart detachment enabled, starts a replacement server, and verifies reconnection and continued terminal I/O.

Reviewers: 2 done | Synthesis: codex, 11s | Total: 3m5s

@mariusvniekerk mariusvniekerk self-assigned this Aug 13, 2026
Air reloads detach recoverable tmux and ptyowner clients, but the terminal bridge mislabeled the resulting shutdown as a natural process exit. That caused browsers to discard the pooled terminal instead of reconnecting.

Opt development launchers into restart-detach classification so the WebSocket closes without an exited frame. Genuine process exits and non-development shutdown behavior remain unchanged.

Generated with Codex (gpt-5.6-sol)

Co-authored-by: Codex <noreply@openai.com>
@mariusvniekerk
mariusvniekerk force-pushed the t3code/fix-workspace-pane-persistence branch from ee5da7c to 48c9c1a Compare August 13, 2026 13:20
@roborev-ci

roborev-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown

roborev: Combined Review (48c9c1a)

High-severity coverage gap and a medium-severity workflow omission remain.

High

  • internal/server/workspaceapi/workspace_runtime_terminal_test.go:220 — The regression test injects already-detached callbacks, bypassing the environment-to-server-to-manager wiring, real shutdown, persistent runtime, and reconnect flow. Existing restart E2E coverage closes the WebSocket before shutdown, so the user-visible fix lacks full-stack coverage.
    • Fix: Add an E2E test that keeps a real runtime WebSocket connected, shuts down a server with restart-detach enabled, starts a replacement using the same SQLite and tmux/ptyowner state, and verifies reconnection to the surviving session without an exited frame.

Medium

  • Makefile:267 — The documented make dev workflow, including make dev-clone-db, does not set KENN_FORGE_DEV_RESTART=1. Restart-aware behavior therefore remains disabled, and terminal tabs can still receive false exit events after backend reloads.
    • Fix: Export or pass KENN_FORGE_DEV_RESTART=1 from the dev target in both configuration branches.

Reviewers: 2 done | Synthesis: codex, 11s | Total: 3m56s

The documented make dev path launched Air without restart classification, so backend reloads could still make browser terminal tabs look exited. The cloned-database workflow inherited the same gap through its recursive make dev call.

Validation: Captured both make dev configuration branches with a fake Air executable and confirmed each receives KENN_FORGE_DEV_RESTART=1.

Generated with Pi
Co-authored-by: Pi <noreply@openai.com>
@roborev-ci

roborev-ci Bot commented Aug 13, 2026

Copy link
Copy Markdown

roborev: Combined Review (079adb8)

High-severity gap: the terminal-reload fix lacks end-to-end coverage.

High

  • internal/server/workspaceapi/workspace_runtime_terminal_test.go:220 — The tests do not verify the complete restart flow for a real active tmux/ptyowner attachment. Add an API/SQLite E2E that keeps the runtime WebSocket open during shutdown with restart-detach enabled, confirms it closes without an exited frame, starts a replacement server, reconnects to the persisted session, and verifies terminal continuity.

Reviewers: 2 done | Synthesis: codex, 11s | Total: 4m1s

@mariusvniekerk
mariusvniekerk merged commit 32d6a9a into main Aug 13, 2026
32 of 33 checks passed
@mariusvniekerk
mariusvniekerk deleted the t3code/fix-workspace-pane-persistence branch August 13, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant