Skip to content

feat: Gemini Assistant and Code Execution Sandbox - #4

Merged
RickyDane merged 3 commits into
mainfrom
feature/gemini_assistant
Jun 20, 2026
Merged

feat: Gemini Assistant and Code Execution Sandbox#4
RickyDane merged 3 commits into
mainfrom
feature/gemini_assistant

Conversation

@RickyDane

Copy link
Copy Markdown
Owner

Description

This pull request brings several key enhancements and features to GQuick, advancing the version to v0.2.0:

  1. Interactive Code Execution Sandbox (codeExecution plugin):

    • Supports executing Python scripts in a sandboxed subprocess with a 15-second timeout and process tree cleanup.
    • Supports running SQL queries locally against an SQLite database (sandbox.db).
    • Implements an interactive code-editor view (CodeExecutionView) in the search preview.
  2. AI Chat & Model Integration Improvements:

    • Collapses tool call logs by default to keep chat threads clean.
    • Integrates Google Search Grounding metadata, presenting search queries and source citations below Gemini responses.
    • Adds model badges/logos for Gemini and GPT to message cards and the status pill.
    • Standardizes tool schemas and names across all models (strips functions. prefix, maps aliases).
  3. PDF Text Extraction:

    • Extends the read_file tool to support parsing text content from PDF documents up to 10MB using the pdf-extract and lopdf crates.
  4. UI/UX Polish:

    • Enhances window overlay behavior on macOS so GQuick renders on top of fullscreen windows instead of triggering workspace transitions.
    • Polishes ESC key logic to cancel active terminal/speedtest operations first, then clear active search queries before hiding.
    • Fixed search bar input flickers and updated screenshot capture directories.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@RickyDane, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 36 minutes and 36 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee0ef7a6-628d-4430-b038-dc8b0fa4f023

📥 Commits

Reviewing files that changed from the base of the PR and between 9be7913 and b0a3527.

⛔ Files ignored due to path filters (49)
  • src-tauri/icons/128x128.png is excluded by !**/*.png
  • src-tauri/icons/128x128@2x.png is excluded by !**/*.png
  • src-tauri/icons/32x32.png is excluded by !**/*.png
  • src-tauri/icons/64x64.png is excluded by !**/*.png
  • src-tauri/icons/Square107x107Logo.png is excluded by !**/*.png
  • src-tauri/icons/Square142x142Logo.png is excluded by !**/*.png
  • src-tauri/icons/Square150x150Logo.png is excluded by !**/*.png
  • src-tauri/icons/Square284x284Logo.png is excluded by !**/*.png
  • src-tauri/icons/Square30x30Logo.png is excluded by !**/*.png
  • src-tauri/icons/Square310x310Logo.png is excluded by !**/*.png
  • src-tauri/icons/Square44x44Logo.png is excluded by !**/*.png
  • src-tauri/icons/Square71x71Logo.png is excluded by !**/*.png
  • src-tauri/icons/Square89x89Logo.png is excluded by !**/*.png
  • src-tauri/icons/StoreLogo.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-hdpi/ic_launcher.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-mdpi/ic_launcher.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png is excluded by !**/*.png
  • src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png is excluded by !**/*.png
  • src-tauri/icons/icon.ico is excluded by !**/*.ico
  • src-tauri/icons/icon.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-20x20@1x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-20x20@2x-1.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-20x20@2x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-20x20@3x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-29x29@1x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-29x29@2x-1.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-29x29@2x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-29x29@3x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-40x40@1x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-40x40@2x-1.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-40x40@2x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-40x40@3x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-512@2x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-60x60@2x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-60x60@3x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-76x76@1x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-76x76@2x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • src-tauri/icons/icon.icns
  • src/App.tsx
  • src/Settings.tsx
  • src/utils/toolManager.ts
📝 Walkthrough

Walkthrough

The PR bumps the version to 0.2.0 and removes old draft docs. It adds PDF text extraction and Python/SQL sandbox execution commands to the Tauri Rust backend, introduces a frontend code-execution plugin, extends Gemini streaming with grounding metadata and thought-signature support, fixes tool-name normalization and Gemini message roles, and reworks the chat UI with provider logos, collapsible tool-call views, grounding source display, and a copy button.

Changes

v0.2.0: Code Execution, PDF Reading, Gemini Grounding, and Chat UI

Layer / File(s) Summary
Version bump and docs removal
package.json, src-tauri/Cargo.toml, src-tauri/tauri.conf.json
Version bumped from 0.1.9 to 0.2.0 across all manifest files; previously committed release notes and commit-message draft are removed.
PDF text extraction (Rust)
src-tauri/Cargo.toml, src-tauri/src/lib.rs
Adds pdf-extract, lopdf, and tokio dependencies; read_ai_file_content gains a .pdf branch that enforces a 10 MB limit, extracts text via pdf_extract, and applies byte-boundary truncation; covered by a new unit test.
Python and SQL sandbox execution (Rust)
src-tauri/src/lib.rs
Introduces ExecuteResult and two Tauri commands: execute_python (Docker-preferred with local fallback, 15 s timeout) and execute_sql (opens sandbox.db, splits on ; respecting quotes, returns JSON for queries and rows-affected for mutations); both registered in invoke_handler.
ToolCall types, tool-name normalization, and Gemini protocol fixes
src/plugins/types.ts, src/utils/toolManager.ts
ToolCall gains thought_signature/thoughtSignature fields; executeTool strips "functions." prefix and remaps legacy aliases; Gemini tool-result role corrected from "user" to "function"; assistant tool-call parts now carry thought_signature.
Gemini streaming: grounding, thought signature, multi-part text
src/utils/streaming.ts
StreamToolCallbacks adds optional onGrounding; streamGemini switches to all-parts text concatenation; streamGeminiTools extracts and forwards groundingMetadata, concatenates all text parts, and stamps thought_signature on tool-call objects.
Code execution frontend plugin
src/plugins/codeExecution.tsx, src/plugins/index.ts
Adds CodeExecutionView (Python/SQL toggle, Tauri invoke wiring, output/error display, Cmd/Ctrl+Enter shortcut), parseQuery prefix parser, and codeExecutionPlugin (metadata, shouldSearch, tool schemas, executeTool, getItems); registered in the plugin index.
Chat UI: provider logos, ToolCallsView, GroundingMetadataView, copy button
src/App.tsx, src/components/ToolCallsView.tsx, src/components/GroundingMetadataView.tsx
Message exported and extended with groundingMetadata/provider/model; App.tsx adds apiProvider state, getModelLogo, onGrounding wiring, Gemini googleSearch tool config, and provider/model stamping; ToolCallsView renders collapsible per-tool status with arguments and responses; GroundingMetadataView renders search queries and source links; hover copy-to-clipboard added for assistant messages.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.63% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: Gemini Assistant and Code Execution Sandbox' accurately reflects the main features added: Gemini integration and code execution capabilities. It is clear, concise, and directly summarizes the primary changes in the changeset.
Description check ✅ Passed The pull request description is well-related to the changeset. It provides a structured overview of the four main feature areas (Code Execution Sandbox, AI Chat improvements, PDF extraction, and UI/UX polish) that align with the actual changes in the code.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src-tauri/src/lib.rs`:
- Around line 3855-3951: The execute_sql_blocking function has no timeout
mechanism for SQL statement execution, which can cause indefinite blocking on
long-running queries. Add a timeout/cancellation path by implementing a time
limit (using a deadline or timer) around the loop that iterates through
statements, and either interrupt the connection or break execution if the
timeout is exceeded. Consider using Rusqlite's interrupt functionality or
wrapping the execution in a timeout wrapper to ensure queries cannot run longer
than a specified maximum duration.
- Around line 3855-3951: The execute_sql_blocking function does not validate
against sandbox-escape SQL commands, allowing dangerous operations like ATTACH,
DETACH, and VACUUM INTO to bypass the sandbox boundary. Add validation logic in
the statement processing loop to block these commands before execution. After
trimming the statement and checking for empty content, add a check that
identifies and rejects any statements that start with these dangerous SQL
keywords by converting to uppercase and comparing, then appending an appropriate
error message to stderr and setting success to false before continuing to the
next statement.
- Around line 3724-3734: The code currently has a fallback execution path that
runs Python directly on the host when Docker is not available, which bypasses
the sandbox protection. Remove the non-Docker fallback code that checks
python3_exists and creates Command::new("python3") or Command::new("python")
directly. Instead, ensure that Python code execution only proceeds when Docker
is available and properly sandboxed. If Docker is not available, the function
should return an error or refuse to execute rather than falling back to
unsandboxed host execution.

In `@src/App.tsx`:
- Around line 318-324: The handleCopyMessage function calls
navigator.clipboard.writeText which returns a Promise, but the function does not
handle potential rejections from permission or context issues. Convert
handleCopyMessage to an async function and wrap the
navigator.clipboard.writeText call in a try-catch block to gracefully handle
clipboard write failures. In the catch block, you can optionally set an error
state or display a user-friendly error message to inform the user that the copy
operation failed, then ensure the copied state is still cleared after 2 seconds
as intended.

In `@src/components/GroundingMetadataView.tsx`:
- Around line 58-63: The anchor tag in GroundingMetadataView is binding the
untrusted web.uri directly to the href attribute, which creates a security
vulnerability allowing malicious javascript: or data: URI schemes to execute
when clicked. Before binding web.uri to the href attribute, validate that it
uses an allowlisted scheme such as http or https, and either sanitize the URI or
conditionally set the href only if the validation passes to prevent execution of
harmful URI schemes.

In `@src/components/ToolCallsView.tsx`:
- Around line 48-55: The read_file case in the switch statement declares the
fileBasename variable directly without a block scope, which violates the
noSwitchDeclarations rule and can cause variable scope issues. Wrap the entire
read_file case body (from the Icon assignment through the description
assignment) in curly braces to create a proper block scope for the fileBasename
variable declaration. This ensures the variable is properly scoped to the case
block and prevents any potential scope leakage.

In `@src/plugins/codeExecution.tsx`:
- Around line 212-233: The code detects prefixes by checking the lowercased
trimmed version of the input, but extracts the code using substring operations
on the original query, which may contain leading spaces. This causes the
extracted code to include unwanted whitespace or be offset incorrectly. Replace
all occurrences of query.substring(...) in this block with substring operations
on the trimmed query to ensure the extraction indices match the prefix detection
logic. This applies to all the prefix handling cases including python:, python,
sql:, sql, code:, code, and /code prefixes.

In `@src/utils/toolManager.ts`:
- Line 194: In the toolManager.ts file around line 194 where the role is being
set to "function", change this value to "user" instead. Gemini's generateContent
API does not support the "function" role for function responses and requires the
"user" role to properly handle tool-result turns. Locate the object assignment
containing role: "function" and update it to role: "user" to ensure function
responses are correctly processed by Gemini.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a51bdc90-e2ba-404c-9573-05e8d0ff73aa

📥 Commits

Reviewing files that changed from the base of the PR and between 5e40ecf and 9be7913.

⛔ Files ignored due to path filters (12)
  • package-lock.json is excluded by !**/package-lock.json
  • src-tauri/Cargo.lock is excluded by !**/*.lock
  • src-tauri/icons/ios/AppIcon-20x20@2x-1.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-29x29@2x-1.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-40x40@1x.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-40x40@2x-1.png is excluded by !**/*.png
  • src-tauri/icons/ios/AppIcon-40x40@3x.png is excluded by !**/*.png
  • src/assets/gemini_logo.svg is excluded by !**/*.svg
  • src/assets/react.svg is excluded by !**/*.svg
  • website/images/gquick_logo_blue.png is excluded by !**/*.png
  • website/images/gquick_logo_red.png is excluded by !**/*.png
  • website/images/hero_screenshot.png is excluded by !**/*.png
📒 Files selected for processing (16)
  • docs/latest-updates/commit-message.md
  • docs/latest-updates/release-notes.md
  • package.json
  • src-tauri/Cargo.toml
  • src-tauri/icons/icon.icns
  • src-tauri/src/lib.rs
  • src-tauri/tauri.conf.json
  • src/App.tsx
  • src/assets/gpt-logo.webp
  • src/components/GroundingMetadataView.tsx
  • src/components/ToolCallsView.tsx
  • src/plugins/codeExecution.tsx
  • src/plugins/index.ts
  • src/plugins/types.ts
  • src/utils/streaming.ts
  • src/utils/toolManager.ts
💤 Files with no reviewable changes (2)
  • docs/latest-updates/commit-message.md
  • docs/latest-updates/release-notes.md

Comment thread src-tauri/src/lib.rs
Comment thread src-tauri/src/lib.rs
Comment thread src/App.tsx
Comment thread src/components/GroundingMetadataView.tsx
Comment thread src/components/ToolCallsView.tsx
Comment thread src/plugins/codeExecution.tsx
Comment thread src/utils/toolManager.ts
@RickyDane
RickyDane merged commit 442017d into main Jun 20, 2026
1 check passed
@RickyDane
RickyDane deleted the feature/gemini_assistant branch June 20, 2026 10:51
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.

1 participant