Skip to content

Fix same-command buttons sharing terminal#61

Merged
kubrickcode merged 1 commit intomainfrom
develop/shlee/56
Oct 30, 2025
Merged

Fix same-command buttons sharing terminal#61
kubrickcode merged 1 commit intomainfrom
develop/shlee/56

Conversation

@kubrickcode
Copy link
Owner

Buttons with identical settings shared terminals due to incomplete uniqueness

  • Track button object references with WeakMap and auto-incrementing IDs
  • Generate terminal keys from JSON-serialized config including unique button ID
  • Maintain index-based IDs for executeAll group commands
  • Enable terminal reuse only for exact same button instance re-clicks

fix #56

@github-actions github-actions bot added the bug Something isn't working label Oct 30, 2025
@kubrickcode
Copy link
Owner Author

/gemini review

@gemini-code-assist
Copy link

Summary of Changes

Hello @kubrickcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where buttons with identical command configurations would incorrectly share the same terminal. The changes introduce a robust mechanism to uniquely identify each button instance and its specific execution context. This ensures that terminals are reused only for the exact same button when it is re-clicked, significantly improving the predictability and isolation of command executions, particularly for grouped commands, by preventing unintended terminal sharing.

Highlights

  • Unique Button Identification: Implemented a system to uniquely identify button instances using a WeakMap and auto-incrementing IDs, preventing different buttons with identical configurations from inadvertently sharing terminals.
  • Granular Terminal Reuse Logic: Modified terminal management to reuse a terminal only when the exact same button instance is re-clicked. This is achieved by generating a comprehensive terminal key from the command, unique button ID, and terminal settings.
  • Enhanced Group Command Uniqueness: Introduced index-based identifiers for commands within 'executeAll' groups. This ensures that each command in a group gets its own unique execution context, preventing unintended terminal sharing even if their configurations are otherwise identical.
  • Extended Terminal Executor API: The TerminalExecutor interface and related functions were extended to accept buttonName and buttonRef parameters, providing richer context during command execution.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively resolves the issue of buttons with identical settings sharing terminals by implementing a more robust terminal identification strategy. The use of WeakMap to track button object instances is a particularly clever approach for enabling terminal reuse only upon re-clicking the exact same button. The introduction of unique IDs for commands within executeAll groups and for tree view items is also well-executed. My review includes a few suggestions aimed at enhancing the robustness of the solution and addressing some potential edge cases where the new function parameters are not fully utilized across all call sites, which could reintroduce the terminal sharing issue in specific scenarios.

Buttons with identical settings shared terminals due to incomplete uniqueness

- Track button object references with WeakMap and auto-incrementing IDs
- Generate terminal keys from JSON-serialized config including unique button ID
- Maintain index-based IDs for executeAll group commands
- Enable terminal reuse only for exact same button instance re-clicks

fix #56
@kubrickcode
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue where terminals were being shared incorrectly for buttons with identical configurations. The solution introduces a more robust method for identifying unique button clicks, utilizing object references for single buttons and generated path-based IDs for commands within executeAll groups. The logic appears sound and effectively resolves the problem. My review includes a few suggestions for improvement, primarily concerning adherence to the repository's coding style guide for function signatures with numerous arguments, and identifying a gap in test coverage for the new buttonRef-based logic.

@kubrickcode kubrickcode merged commit d291698 into main Oct 30, 2025
5 checks passed
@kubrickcode kubrickcode deleted the develop/shlee/56 branch October 30, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The problem of group command batch execution not working occasionally

1 participant