Skip to content

fix(patch): cherry-pick 1611364 to release/v0.13.0-preview.1-pr-12587 to patch version v0.13.0-preview.1 and create version 0.13.0-preview.2#12601

Merged
skeshive merged 1 commit into
release/v0.13.0-preview.1-pr-12587from
hotfix/v0.13.0-preview.1/0.13.0-preview.2/preview/cherry-pick-1611364/pr-12587
Nov 5, 2025
Merged

fix(patch): cherry-pick 1611364 to release/v0.13.0-preview.1-pr-12587 to patch version v0.13.0-preview.1 and create version 0.13.0-preview.2#12601
skeshive merged 1 commit into
release/v0.13.0-preview.1-pr-12587from
hotfix/v0.13.0-preview.1/0.13.0-preview.2/preview/cherry-pick-1611364/pr-12587

Conversation

@gemini-cli-robot

Copy link
Copy Markdown
Collaborator

This PR automatically cherry-picks commit 1611364 to patch version v0.13.0-preview.1 in the preview release to create version 0.13.0-preview.2.

Co-authored-by: LayorX <yor31117@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@gemini-cli-robot gemini-cli-robot requested a review from a team as a code owner November 5, 2025 17:43
@github-actions github-actions Bot mentioned this pull request Nov 5, 2025
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @gemini-cli-robot, 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 focuses on enhancing the stability and reliability of the application, particularly concerning pseudo-terminal (PTY) interactions and the test suite. It introduces more resilient error handling for PTY resizing to prevent crashes, especially in race conditions where a PTY might exit unexpectedly. Additionally, it refines the testing environment by adjusting timeouts and conditionally skipping platform-specific tests, ensuring a more robust and consistent testing experience across different operating systems. This is an automated patch to update the preview release version.

Highlights

  • Robust PTY Resizing: Implemented enhanced error handling for pseudo-terminal (PTY) resizing operations in AppContainer.tsx and shellExecutionService.ts. This prevents application crashes when attempting to resize a PTY that has already exited, specifically addressing different error messages on Unix (ESRCH) and Windows.
  • Test Suite Stability: Improved the stability of the test suite by adding a new test case for PTY resize error handling, increasing timeouts for several potentially long-running tests (e.g., in coreToolScheduler.test.ts, shellExecutionService.test.ts, shell.test.ts), and conditionally skipping symbolic link tests on Windows in workspaceContext.test.ts due to platform-specific behavior.
  • Global Test Timeout: A global test timeout of 30 seconds has been configured in vitest.config.ts for the packages/core module to prevent tests from hanging indefinitely.
  • Automated Patch Release: This pull request is an automated cherry-pick of commit 16113647de09b49297eee1206460b2247d6a38a4 to create a new preview version 0.13.0-preview.2 from v0.13.0-preview.1.
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.

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

Copy link
Copy Markdown
Contributor

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 cherry-picks a fix for a crash that can occur when resizing a pseudo-terminal (pty) that has already exited. The fix involves adding error handling to gracefully manage this race condition. While the intention is correct, the implementation introduces redundant error handling in the AppContainer component, which is already handled within the ShellExecutionService. My review focuses on removing this duplication to improve code encapsulation and maintainability. Other changes include increasing test timeouts to address flakiness and skipping some platform-specific tests, which are reasonable.

Comment on lines +808 to +828
try {
ShellExecutionService.resizePty(
activePtyId,
Math.floor(terminalWidth * SHELL_WIDTH_FRACTION),
Math.max(
Math.floor(availableTerminalHeight - SHELL_HEIGHT_PADDING),
1,
),
);
} catch (e) {
// This can happen in a race condition where the pty exits
// right before we try to resize it.
if (
!(
e instanceof Error &&
e.message.includes('Cannot resize a pty that has already exited')
)
) {
throw e;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This try...catch block appears to be redundant. The ShellExecutionService.resizePty method already contains logic to catch and handle this specific error, as shown in packages/core/src/services/shellExecutionService.ts. Adding another layer of error handling here couples the UI component to the implementation details of the service and duplicates the logic. The service should be responsible for handling its own internal race conditions. I recommend removing this try...catch and letting resizePty handle the error gracefully.

      ShellExecutionService.resizePty(
        activePtyId,
        Math.floor(terminalWidth * SHELL_WIDTH_FRACTION),
        Math.max(
          Math.floor(availableTerminalHeight - SHELL_HEIGHT_PADDING),
          1,
        ),
      );

Comment on lines +1713 to +1748
describe('Shell Interaction', () => {
it('should not crash if resizing the pty fails', async () => {
const resizePtySpy = vi
.spyOn(ShellExecutionService, 'resizePty')
.mockImplementation(() => {
throw new Error('Cannot resize a pty that has already exited');
});

mockedUseGeminiStream.mockReturnValue({
streamingState: 'idle',
submitQuery: vi.fn(),
initError: null,
pendingHistoryItems: [],
thought: null,
cancelOngoingRequest: vi.fn(),
activePtyId: 'some-pty-id', // Make sure activePtyId is set
});

// The main assertion is that the render does not throw.
const { unmount } = render(
<AppContainer
config={mockConfig}
settings={mockSettings}
version="1.0.0"
initializationResult={mockInitResult}
/>,
);

await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0));
});

expect(resizePtySpy).toHaveBeenCalled();
unmount();
});
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This test suite should be removed. It validates that AppContainer doesn't crash when resizePty throws, but it does so by mocking resizePty itself. This forces the redundant try...catch block in AppContainer.tsx. The correct behavior (handling the resize error within the service) is already tested at the service level in packages/core/src/services/shellExecutionService.test.ts. By removing this test, we can also remove the duplicated error-handling logic from the AppContainer component, leading to cleaner and more maintainable code.

@github-actions

github-actions Bot commented Nov 5, 2025

Copy link
Copy Markdown

Size Change: +229 B (0%)

Total Size: 20.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 20.4 MB +229 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@skeshive skeshive enabled auto-merge (squash) November 5, 2025 17:49
@skeshive skeshive merged commit ece0615 into release/v0.13.0-preview.1-pr-12587 Nov 5, 2025
21 checks passed
@skeshive skeshive deleted the hotfix/v0.13.0-preview.1/0.13.0-preview.2/preview/cherry-pick-1611364/pr-12587 branch November 5, 2025 17:54
@sripasg sripasg added the size/m A medium sized PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants