fix(acp): Gemini ACP protocol fixes and multi-session architecture#901
Open
codebit0 wants to merge 4 commits intonextlevelbuilder:devfrom
Open
fix(acp): Gemini ACP protocol fixes and multi-session architecture#901codebit0 wants to merge 4 commits intonextlevelbuilder:devfrom
codebit0 wants to merge 4 commits intonextlevelbuilder:devfrom
Conversation
- Support nested JSON-RPC notification structures - Add robust streaming text collection and mapping - Increase handshake timeout to 60s for heavy model initialization - Fix WebSocket user_id authentication and schema v47 compatibility - Allow Google/GCP environment variables for ACP subprocesses
…mp session cleanup - One shared Gemini process, multiple ACP sessions per process (one per goclaw conversation) - resolveSession: per-key mutex prevents TOCTOU race on concurrent session creation - Respawn detection via proc pointer comparison; session/load fallback after crash - sessionReaper: purges ACP sessions idle >30min; temp- sessions purged immediately on completion - WithGoclawSession context propagation: goclaw session key appears alongside ACP sid in all logs - dispatchUpdate: Gemini agent_message_chunk protocol mapping normalized here - session_test.go: full coverage of multi-session API (Initialize, NewSession, Prompt, Cancel, dispatch) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- InitializeRequest: "capabilities" → "clientCapabilities" (standard field name) - LoadSessionRequest: add mcpServers field (required by standard) - mapStopReason: add standard stop reasons (max_tokens, cancelled) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
resolveSessionto prevent TOCTOU race on concurrent session creation for the same conversationsession/loadafter process crash, thensession/newtemp-sessions (used by intent_classify, title_generate) immediately after completion instead of waiting for the 30-minute idle reaperWithGoclawSession) so ACP-level logs show both goclaw session and ACP session ID side by sideagent_message_chunknotifications indispatchUpdateto normalize protocol differences at the process layerInitializeRequestfield name:"capabilities"→"clientCapabilities"(ACP SDK v0.16.1 standard)mcpServersfield toLoadSessionRequest(required by standard)max_tokens,cancelled) tomapStopReasonX-GoClaw-User-Idheader in gateway clientChanged files
internal/providers/acp/process.go— multi-session routing viaupdateFnsmap,dispatchUpdate,ProcessPoolinternal/providers/acp/session.go—Initialize,NewSession,LoadSession,Prompt,Cancelinternal/providers/acp/types.go—clientCapabilitiesfield name,LoadSessionRequest.McpServersinternal/providers/acp_provider.go—resolveSession,sessionReaper,purgeSession,Chat,ChatStreaminternal/providers/acp/helpers.go—WithGoclawSession/goclawSessionFromCtxinternal/providers/acp/session_test.go— multi-session API coverageinternal/providers/acp/acp_gemini_test.go— live Gemini protocol integration test