fix(ui): keep suspended jobs alive upon fg - #996
Open
HackAttack wants to merge 1 commit into
Open
Conversation
|
@HackAttack is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
PR author is not in the allowed authors list. |
HackAttack
force-pushed
the
fix/suspend
branch
2 times, most recently
from
September 6, 2026 01:24
5f77cb4 to
6b1914c
Compare
When backgrounding with Ctrl-Z in the shell, fg can kill the process instead of bringing it back to the foreground. Before stopping Hunk, OpenTUI prepares the terminal for the shell: it leaves raw mode, stops reading stdin, and removes its keep-alive timer. The stopped process remains alive, but after fg wakes it, the runtime could exit before Hunk's SIGCONT callback restarted the renderer. The stop actually takes effect before kill returns, since POSIX delivers a signal sent to the caller's own process group before the call completes. So suspend and resume become one straight line, and staying on that call stack is what keeps the job alive: the event loop never gets a chance to go idle and exit. That retires the SIGCONT listener along with the per-suspend state tracking it needed. It also closes a hang. The old fallback only ran when kill threw, so a SIGTSTP that was delivered and discarded — as POSIX requires for an orphaned process group — left the app suspended forever, waiting for a SIGCONT nobody would send. Both cases now reach the same restore. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
HackAttack
force-pushed
the
fix/suspend
branch
from
September 6, 2026 03:36
6b1914c to
4291c17
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When backgrounding with Ctrl-Z in the shell,
fgcan kill the process instead of bringing it back to the foreground.Before stopping Hunk, OpenTUI prepares the terminal for the shell: it leaves raw mode, stops reading stdin, and removes its keep-alive timer. The stopped process remains alive, but after
fgwakes it, the runtimecould exit before Hunk's SIGCONT callback restarted the renderer.
The stop actually takes effect before kill returns, since POSIX delivers a signal sent to the caller's own process group before the call completes. So suspend and resume become one straight line, and staying on that call stack is what keeps the job alive: the event loop never gets a chance to go idle and exit. That retires the SIGCONT listener along with the per-suspend state tracking it needed.
It also closes a hang. The old fallback only ran when kill threw, so a SIGTSTP that was delivered and discarded — as POSIX requires for an orphaned process group — left the app suspended forever, waiting for a SIGCONT nobody would send. Both cases now reach the same restore.