#1668

Resume a running turn when its window closes before SIGHUP

Draftfazxeswants to merge intofrom

Summary

  • Closing the terminal window while fx is working on a request no longer saves the turn as cancelled, so fx --resume last and fx -c send the request again on their own.
  • When fx sees the window close before SIGHUP arrives, it saves the request as a clean close, the same as when SIGHUP arrives first.
  • Closing the window while fx is idle still shuts fx down normally.
  • Esc, Ctrl+C twice, and /quit still cancel the running request, and reopening does not send it again.

Activity

1
fazxes7d ago

The first CI attempt failed E2E shard 3/4 in tui-full-transcript-brutal.test.ts ("Ctrl-O repeatedly survives mixed long chats, dense tool batches, live output, resize storms, and resume"), on both its run and its retry: line 973 counted CTRL_O_BRUTAL_HISTORY_DONE twice in the first session's scrollback. That check runs before the test closes any window, and this change only acts after the terminal hangs up. The same failure at the same line happened in an unrelated PR's run (fazxes/test-pgso-transformed-code, run 42073250969) and passed on retry there. A rerun of the failed jobs on this commit passed with no retry warnings.

This pull request is a draft

Merging is unavailable until it is marked ready for review.