Skip to content

Conversation

@hiroTamada
Copy link
Contributor

@hiroTamada hiroTamada commented Sep 19, 2025

TL;DR

Handles Control+C during an invoke command to gracefully terminate the remote session by updating its status to failed.

Why we made these changes

Previously, interrupting an invoke command with Control+C would only terminate the local CLI process, leaving the remote session running. This could lead to orphaned resources and unexpected behavior. This change ensures that when a user cancels an operation, the remote session is properly cleaned up.

What changed?

  • cmd/invoke.go:
    • Implemented a signal handler to catch SIGINT (Control+C).
    • On cancellation, the CLI now sends a patch request to mark the remote invocation as 'failed' with a user-cancelled message.
    • Reordered the invocation creation process to ensure the invocationID is available immediately for the cancellation handler.

Description generated by Mesa. Update settings

@hiroTamada hiroTamada marked this pull request as ready for review September 19, 2025 20:51
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of 000a938...1f86286

Analysis

  1. Moving from side-effect based cleanup to explicit state management could introduce transition issues if not all code paths are updated to recognize the new "failed" state marker.
  2. The PR may not address potential race conditions between the cancellation signal handling and the normal operation flow.
  3. Changing the cancellation semantics could affect downstream components that may have been relying on the previous browser deletion behavior.

Tip

⚡ Quick Actions

This review was generated by Mesa.

Actions:

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

1 files reviewed | 0 comments | Review on Mesa | Edit Reviewer Settings

@hiroTamada hiroTamada merged commit fa40463 into main Sep 22, 2025
2 checks passed
@hiroTamada hiroTamada deleted the feat/patch_invoke_on_control_c branch September 22, 2025 16:11
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.

3 participants