fix(patch): cherry-pick 0ded546 to release/v0.10.0-preview.1-pr-11225 to patch version v0.10.0-preview.1 and create version 0.10.0-preview.2#11415
Conversation
Summary of ChangesHello @skeshive, 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 enhances the application's ability to handle interactive shell commands by integrating pseudo-terminal (PTY) information into its configuration. This allows for more adaptive user guidance regarding interactive commands, ensuring that users receive appropriate instructions for input in interactive environments or are reminded to avoid such commands when not supported. The changes are part of a routine patch release to improve the overall user experience with shell interactions. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request is a cherry-pick that introduces support for interactive shell commands by detecting PTY capabilities and adjusting the system prompt accordingly. The core logic seems sound, introducing a new isInteractiveShellEnabled method in the Config class and dynamically generating the prompt for interactive commands. However, I've found a significant issue in a new test case meant to verify the behavior for non-interactive shells. The test is not correctly mocking the conditions, leading it to test the wrong logic branch and pass incorrectly. My review comment provides a fix for this test.
| it('should return the interactive avoidance prompt when in non-interactive mode', () => { | ||
| vi.stubEnv('SANDBOX', undefined); | ||
| mockConfig.isInteractive = vi.fn().mockReturnValue(false); | ||
| const prompt = getCoreSystemPrompt(mockConfig, ''); | ||
| expect(prompt).toContain('**Interactive Commands:**'); // Check for interactive prompt | ||
| expect(prompt).toMatchSnapshot(); // Use snapshot for base prompt structure | ||
| }); |
There was a problem hiding this comment.
The test case should return the interactive avoidance prompt when in non-interactive mode has a flaw in its setup. It mocks isInteractive to false, but the logic in getCoreSystemPrompt depends on config.isInteractiveShellEnabled(). Since the beforeEach block mocks isInteractiveShellEnabled to always return true, changing isInteractive has no effect on the test's outcome.
To correctly test the 'avoidance' prompt, you should mock isInteractiveShellEnabled to return false. This will ensure you are testing the correct branch of the conditional logic in prompts.ts. After applying this change, the snapshot for this test will need to be updated.
| it('should return the interactive avoidance prompt when in non-interactive mode', () => { | |
| vi.stubEnv('SANDBOX', undefined); | |
| mockConfig.isInteractive = vi.fn().mockReturnValue(false); | |
| const prompt = getCoreSystemPrompt(mockConfig, ''); | |
| expect(prompt).toContain('**Interactive Commands:**'); // Check for interactive prompt | |
| expect(prompt).toMatchSnapshot(); // Use snapshot for base prompt structure | |
| }); | |
| it('should return the interactive avoidance prompt when interactive shell is disabled', () => { | |
| vi.stubEnv('SANDBOX', undefined); | |
| mockConfig.isInteractiveShellEnabled = vi.fn().mockReturnValue(false); | |
| const prompt = getCoreSystemPrompt(mockConfig, ''); | |
| expect(prompt).toContain('**Interactive Commands:**'); // Check for interactive prompt | |
| expect(prompt).toMatchSnapshot(); // Use snapshot for base prompt structure | |
| }); |
|
Size Change: +788 B (0%) Total Size: 17.8 MB ℹ️ View Unchanged
|
a186083
into
release/v0.10.0-preview.1-pr-11225
This PR automatically cherry-picks commit 0ded546 to patch version v0.10.0-preview.1 in the preview release to create version 0.10.0-preview.2.