Skip to content

respawn closed startup terminals#106

Merged
forketyfork merged 3 commits intomainfrom
fix/terminal-respawn
Jan 14, 2026
Merged

respawn closed startup terminals#106
forketyfork merged 3 commits intomainfrom
fix/terminal-respawn

Conversation

@forketyfork
Copy link
Owner

Solution

  • Track process watcher generation/child PID in exit callback to ignore stale completions after Cmd+W despawn/restart, so grid tiles marked dead no longer block respawn.
  • Bump generation on spawn/teardown and kill running shells when despawning to ensure Cmd+↵ on startup terminals relaunches a fresh shell instead of showing '[Process completed]'.
  • Wire confirm dialog + SDL hint for Cmd+W handling and document the delete shortcut in README.

Testing

  • zig build
  • zig build test

Prompt: Please review the changes in the current working directory. They contain terminal close implementation. There's at least one bug: when I Cmd+W a terminal that was spawned at application start (either the terminal (0,0) or the terminal that was opened based on the persistence.toml settings) and then Cmd+Enter on that terminal, it shows "Process completed"; it should actually launch a new terminal in such case.

Solution: Added generation-tracked wait context so exit callbacks ignore stale processes after despawn/restart; bumped generation on spawn/teardown to avoid resurrecting dead state; documented Cmd+W delete shortcut; rebuilt and tests pass.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55addc1e12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@forketyfork forketyfork requested a review from Copilot January 14, 2026 08:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements the ability to respawn startup terminals that have been closed or have completed their processes. The main goal is to fix issues where grid tiles marked as dead would block respawn attempts, and to ensure that terminals can be properly restarted after being despawned.

Changes:

  • Added process generation tracking to detect and ignore stale process exit callbacks after terminal despawn/restart
  • Implemented Cmd+W shortcut to delete terminals with confirmation dialog when a foreground process is running
  • Updated terminal restart logic to kill running shells before despawning and properly respawn terminals when requested

Reviewed changes

Copilot reviewed 10 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/ui/types.zig Added DespawnSession action to UI action enum
src/ui/mod.zig Registered new confirm_dialog component module
src/ui/components/restart_buttons.zig Modified restart button logic to check both dead and spawned status
src/ui/components/help_overlay.zig Added Cmd+W shortcut documentation and increased help button size
src/ui/components/confirm_dialog.zig New confirmation dialog component for terminal deletion prompts
src/session/state.zig Implemented process generation tracking and shell termination on despawn
src/platform/sdl.zig Added SDL hint to prevent Cmd+W from generating SDL_QUIT
src/main.zig Wired up Cmd+W handling, despawn logic, and loop parameter threading
src/c.zig Exposed SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE constant
README.md Documented Cmd+W shortcut for deleting terminals
Files not reviewed (8)
  • .idea/.gitignore: Language not supported
  • .idea/architect.iml: Language not supported
  • .idea/copilot.data.migration.ask2agent.xml: Language not supported
  • .idea/go.imports.xml: Language not supported
  • .idea/inspectionProfiles/Project_Default.xml: Language not supported
  • .idea/modules.xml: Language not supported
  • .idea/vcs.xml: Language not supported
  • .idea/zigbrains.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@forketyfork forketyfork merged commit c3d8ab6 into main Jan 14, 2026
7 checks passed
@forketyfork forketyfork deleted the fix/terminal-respawn branch January 14, 2026 08:29
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.

2 participants