This repository was archived by the owner on Feb 14, 2026. It is now read-only.
refactor(gemini): Improve ACP architecture, session stability and history deduplication#132
Merged
bra1nDump merged 3 commits intoslopus:mainfrom Jan 16, 2026
Merged
Conversation
- Extract session update handlers into separate module (sessionUpdateHandlers.ts) - handleAgentMessageChunk, handleToolCallUpdate, handleToolCall, etc. - Reduces AcpBackend.ts from ~1350 to ~900 lines - Add retry logic for ACP init/newSession operations - 3 attempts with exponential backoff (1s, 2s, 4s) - Improves reliability on slow starts - Move timeouts to configurable constants - Add getIdleTimeout() to TransportHandler interface - Export GEMINI_TIMEOUTS from GeminiTransport - DEFAULT_IDLE_TIMEOUT_MS, DEFAULT_TOOL_CALL_TIMEOUT_MS - Improve tool name detection in GeminiTransport - ExtendedToolPattern with inputFields and emptyInputDefault - Remove fragile context-based heuristics - Cleaner, more declarative pattern matching Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
…y, unify model resolution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the Gemini/ACP backend architecture with better code organization, session stability fixes, and conversation history deduplication.
Changes
ACP Architecture Refactoring
sessionUpdateHandlers.ts)AcpBackend.tsfrom ~1350 to ~900 linesGEMINI_TIMEOUTS)Session Stability
Model Resolution
createGeminiBackendto returnGeminiBackendResultrunGemini.tsHistory Deduplication
ConversationHistoryTool Detection Improvements
GeminiTransportExtendedToolPatternwithinputFieldsandemptyInputDefault