Leeroybrun/tmp/merge upstream 2026 01 16#11
Conversation
- Move AgentBackend, AgentRegistry to core/ - Create transport/ with TransportHandler abstraction - Move Gemini-specific logic to GeminiTransport - Create adapters/ for message transformation - Create factories/ for high-level agent creation - Rename AcpSdkBackend → AcpBackend - Remove acp/utils.ts (merged into transport handlers)
…proved UX ACP Integration: - Add sendAgentMessage() for unified Agent Communication Protocol format - Migrate all Gemini messages from sendCodexMessage to sendAgentMessage(gemini, ...) - Add ACP message types: task_started, task_complete, turn_aborted, permission-request Model Selection: - Support dynamic model selection from frontend via meta.model - Save selected model to ~/.gemini/config.json for persistence Permission Handling: - Integrate GeminiPermissionHandler with permission modes (default, read-only, safe-yolo, yolo) - Add permission ID to tool call ID mapping for proper UI tracking Message Flow Improvements: - Add waitForResponseComplete() to ensure all chunks received before task_complete - Accumulate response chunks and send complete message once (fixes fragmentation) - Fix status flickering by not resetting thinking on intermediate idle events Error Handling: - Add retry logic for empty response errors (up to 3 retries) - Improve quota error handling: no retry, show reset time, suggest alternative model - Better error messages for model not found, rate limits, quota exceeded Tool Handling: - Improve change_title detection from toolCallId pattern - Add tool-result emission after permission approval - Track hadToolCallInTurn for proper task_complete timing
- Add ConversationHistory class to track user/assistant messages - Inject previous conversation context into new session on model change - Allows seamless model switching without losing context
…ling - Add `happy gemini project set/get` commands for Workspace accounts - Store project ID per-account (linked to email) - Show helpful error message for "Authentication required" with guide link - Sync local ~/.gemini/oauth_creds.json on `happy connect gemini` - Add `happy connect status` command to show vendor auth status - Pass GOOGLE_CLOUD_PROJECT env var to Gemini SDK
codex: make abort graceful; force-close MCP on kill/exit
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request refactors the ACP agent backend architecture by introducing a transport abstraction layer, standardizing agent message types, and integrating Google Cloud Project configuration for Gemini. It renames AcpSdkBackend to AcpBackend, adds comprehensive message adapters for mobile clients, updates CLI commands for vendor connection status and project management, and enhances Gemini integration with conversation history and improved error handling. Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI User
participant Agent as Gemini Agent
participant Transport as Transport Handler
participant Backend as ACP Backend
participant LLM as Gemini LLM
CLI->>Agent: Send prompt via runGemini
Agent->>Backend: Initialize with transportHandler
Backend->>Transport: getInitTimeout()
Transport-->>Backend: timeout value
Agent->>Backend: sendPrompt(prompt)
Backend->>Agent: Emits status 'starting'
Backend->>LLM: Execute with stdout/stderr
LLM-->>Backend: tool-call response (JSON)
Backend->>Transport: filterStdoutLine(line)
Transport-->>Backend: filtered JSON or null
Backend->>Agent: Emits tool-call message
Agent->>Backend: handleToolResult(result)
Backend->>Agent: Emits tool-result message
Backend->>Transport: handleStderr(text, context)
Transport-->>Backend: possible error message
Backend->>Agent: Emits status 'idle'
Agent->>Backend: waitForResponseComplete()
Backend-->>Agent: Promise resolves when complete
Agent->>CLI: Display final response
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes The changes introduce a well-structured transport abstraction layer and comprehensive agent messaging system across multiple files. While individual new type definitions are straightforward, the refactoring involves significant logic migration in Possibly related PRs
Poem
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (29)
✏️ Tip: You can disable this entire section by setting 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. Comment |
Summary of ChangesHello @leeroybrun, 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 introduces significant architectural improvements to the agent backend, primarily by refactoring the ACP implementation to be more modular and extensible through the use of 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 is an impressive and substantial pull request that significantly refactors the agent backend architecture. The introduction of the TransportHandler abstraction is an excellent design choice that greatly improves modularity and maintainability by separating generic ACP logic from agent-specific implementations. The accompanying reorganization of the src/agent directory into core, factories, transport, and adapters brings a much clearer structure to the codebase.
Beyond the refactoring, this PR introduces several valuable features for the Gemini integration, including robust retry logic for API calls, context preservation across model changes, and support for Google Workspace accounts via project ID configuration. The CLI enhancements, such as happy connect status and happy gemini project, are also great additions for user experience.
I have one main piece of feedback regarding a type mismatch in the newly introduced ACPMessageData type, which could affect message payloads. Overall, this is a high-quality contribution that moves the project forward in a very positive direction.
| */ | ||
| export type ACPMessageData = | ||
| // Core message types | ||
| | { type: 'message'; message: string } |
There was a problem hiding this comment.
The message type in ACPMessageData appears to be missing the id and options properties. In src/gemini/runGemini.ts, a payload is constructed with these properties and passed to sendAgentMessage, which expects a body of type ACPMessageData. This creates a type mismatch.
Given that most other types within ACPMessageData include an id, its absence here seems like a potential oversight. The options property is also important for the mobile UI.
To ensure type safety and correct data transmission, please consider updating this type definition.
| | { type: 'message'; message: string } | |
| | { type: 'message'; message: string; id: string; options?: unknown } |
Summary by CodeRabbit
Documentation
New Features
happy connect statuscommand to display connection status for all vendors with user email information.happy gemini projectcommands to manage Google Cloud Project configuration and linking.Improvements
✏️ Tip: You can customize this high-level summary in your review settings.