Skip to content

Add Gemini CLI provider#1983

Open
Marve10s wants to merge 6 commits intopingdotgg:mainfrom
Marve10s:codex/add-gemini-cli-provider
Open

Add Gemini CLI provider#1983
Marve10s wants to merge 6 commits intopingdotgg:mainfrom
Marve10s:codex/add-gemini-cli-provider

Conversation

@Marve10s
Copy link
Copy Markdown
Contributor

@Marve10s Marve10s commented Apr 13, 2026

Gemini CLI PR. I can provide account for testing if you need so. I have a student one year sub

Summary

  • add Gemini CLI as a first-class provider across server, contracts, shared model capability logic, and the web composer/model picker flow
  • probe Gemini CLI install/auth/model capabilities, route Gemini text generation through the git runtime, and persist Gemini-specific model options for dispatch
  • expose Gemini thinking controls for Gemini 2.5 and Gemini 3 model families, fix Gemini output whitespace handling, and fix the optimistic "working" indicator so send progress appears immediately

Why

Users wanted Gemini CLI support in T3 Code, but the repo only supported Codex and Claude. The integration also needed model-family-aware thinking controls and a few follow-up fixes discovered during live testing.

Impact

  • Gemini CLI can now be configured, discovered, selected, and used from the T3 Code UI
  • Gemini 2.5 models expose thinking budgets and Gemini 3 models expose thinking levels without hardcoded per-model UI branches
  • follow-up UX regressions found during testing are covered by targeted tests

Validation

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run --filter @t3tools/web test src/components/ChatView.logic.test.ts src/components/chat/composerProviderRegistry.test.tsx src/components/chat/TraitsPicker.browser.tsx src/composerDraftStore.test.ts src/providerModels.test.ts
  • bun run --filter t3 test src/provider/Layers/GeminiAdapter.test.ts src/provider/Layers/GeminiProvider.test.ts src/provider/Layers/ProviderAdapterRegistry.test.ts src/provider/Layers/ProviderService.test.ts

Note

Add Gemini CLI as a full provider with chat, text generation, and settings support

  • Introduces a complete Gemini provider across the stack: contracts, server adapter/provider layers, composer UI, settings, and draft store.
  • The server adapter (GeminiAdapter.ts) manages Gemini CLI ACP sessions via child processes and JSON-RPC, handling turns, tool approvals, and runtime event emission.
  • Provider status is probed by spawning gemini --version and an ACP capability discovery session (geminiAcpProbe.ts), refreshing every 2 minutes.
  • Text generation (commit messages, PR content, branch names, thread titles) is routed to a new GeminiTextGeneration implementation that shells out to the Gemini CLI with a 180s timeout and validates JSON output.
  • The composer UI gains a Gemini model picker, thinking-level/budget traits controls (labeled 'Thinking'), and draft store persistence for Gemini model options.
  • Risk: extractBalancedJsonSubstring in Utils.ts contains stray + tokens that may cause a compilation error.

Macroscope summarized 708e1f5.


Note

High Risk
Large, cross-cutting change that introduces a new Gemini CLI/ACP runtime adapter and provider discovery, plus routes text-generation and UI model/trait selection; failures could impact provider session lifecycle, persistence, or git text-generation flows.

Overview
Adds Gemini as a full provider option end-to-end: server-side ACP session adapter (GeminiAdapter) with event emission, approvals, turn lifecycle, snapshot/rollback via session file cloning, and integration into the provider registry/service wiring and persisted session directory.

Introduces Gemini provider health/model discovery (GeminiProvider, geminiAcpProbe) that checks gemini --version, probes ACP for authentication and available models, infers model capabilities by family (Gemini 3 thinking levels vs Gemini 2.5 thinking budgets), and includes Gemini in provider caching/order.

Extends git text generation to route provider: "gemini" through a new GeminiTextGenerationLive layer that shells out to the Gemini CLI with JSON envelope decoding, a 180s timeout, and stronger structured-output extraction via extractJsonValueFromText (handles code fences and embedded/balanced JSON).

Updates the web app to surface Gemini in provider/model pickers and settings, persist Gemini model options (thinking controls) in composer drafts, and gate/render traits controls consistently; adds targeted tests for Gemini adapter behavior, provider probing, registry wiring, rollback persistence, and UI traits/model-option handling.

Reviewed by Cursor Bugbot for commit 708e1f5. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions bot added size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 13, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0160b9fc-01b8-4c7b-908c-806dce3b1607

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Comment thread apps/server/src/provider/Layers/GeminiProvider.test.ts
@Marve10s Marve10s changed the title [codex] Add Gemini CLI provider Add Gemini CLI provider Apr 13, 2026
@Marve10s Marve10s marked this pull request as ready for review April 13, 2026 13:54
Comment thread apps/web/src/components/ChatView.logic.ts
Comment thread apps/server/src/provider/geminiAcpProbe.ts Outdated
@Marve10s
Copy link
Copy Markdown
Contributor Author

5 minute showcase, nothing fancy, just Gemini being Gemini. If you wonder - all models eventually responded, gemini 2.5 was just indexing the codebase for 5 minutes.

https://drive.google.com/file/d/1rCZZDvFE1WHKBIQxtC2nuX7uI5bOEAtI/view?usp=sharing

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 13, 2026

Approvability

Verdict: Needs human review

This PR introduces a complete new Gemini CLI provider integration across server and web components, including session management, text generation, UI controls, and settings. As a significant new feature with substantial new runtime behavior, plus an unresolved high-severity bug comment about potentially empty prompts being sent to the CLI, this requires human review.

You can customize Macroscope's approvability policy. Learn more.

Comment thread apps/web/src/components/chat/TraitsPicker.tsx
Comment thread apps/server/src/provider/Layers/GeminiAdapter.ts
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0baacdd. Configure here.

Comment thread apps/server/src/git/Layers/GeminiTextGeneration.ts
Comment thread apps/web/src/components/chat/composerProviderRegistry.tsx Outdated
Pipyakas added a commit to Pipyakas/t3code that referenced this pull request Apr 15, 2026
- VSCode launch.json and tasks.json
- Windows-only release workflow (release-fork.yml)
- Android Capacitor build setup
- Standalone Linux server build with systemd service install
- VCS mode setting (git/disabled)

Deferred: OpenCode and Gemini-cli implementation (PR pingdotgg#1758, pingdotgg#1983)
Pipyakas added a commit to Pipyakas/t3code that referenced this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant