Skip to content

Conversation

@forketyfork
Copy link
Owner

Avoid freeing process wait contexts while their completions are still active; clean them up in the exit callback instead.

Avoid freeing process wait contexts while their completions are still active; clean them up in the exit callback instead.
@forketyfork forketyfork requested a review from Copilot January 23, 2026 15:44
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 fixes a use-after-free bug where process wait contexts were being freed prematurely while their completions were still active. The fix defers cleanup to the exit callback after the completion has been properly disarmed.

Changes:

  • Removed premature process_wait_ctx destruction from initialization and cleanup paths
  • Added context cleanup logic in the exit callback after verifying completions are disarmed
  • Updated documentation with troubleshooting entry about crashes after terminal close events

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/session/state.zig Deferred process wait context cleanup to exit callback to prevent use-after-free
README.md Added troubleshooting entry for crash after terminal close events

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

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: a5a6a55917

ℹ️ 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".

Addresses review comments 2721769248, 2721774894.
@forketyfork forketyfork merged commit 2222c06 into main Jan 23, 2026
4 checks passed
@forketyfork forketyfork deleted the fix/cmdw-close-request branch January 23, 2026 15:56
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