fix(gemini): wire --resume flag through to Gemini backend#378
Merged
tiann merged 2 commits intotiann:mainfrom Mar 31, 2026
Merged
fix(gemini): wire --resume flag through to Gemini backend#378tiann merged 2 commits intotiann:mainfrom
tiann merged 2 commits intotiann:mainfrom
Conversation
The --resume flag sent by the runner was silently ignored because the gemini command did not parse it. This caused remote Gemini sessions to always start fresh instead of resuming the previous conversation context. Thread resumeSessionId through commands/gemini.ts → runGemini → geminiLoop → GeminiSession, mirroring the existing OpenCode implementation. When a session ID is present, use ACP loadSession instead of newSession to restore the previous session state, with fallback to newSession on failure. Remove the now-redundant resumeSessionId from createGeminiBackend to avoid double-resume (CLI --resume flag + ACP session/load).
Error objects serialize to {} in JSON, making prompt failures
impossible to diagnose from logs. Extract the error message
before logging and surface it to the session UI, consistent with
how stderr errors are already handled in the same file.
There was a problem hiding this comment.
Findings
- No issues identified in the added/modified lines.
Summary
Review mode: initial. No diff-attributable correctness, security, or regression issues found in the latest patch. Residual risk: the new Gemini resume path still lacks direct coverage for cli/src/commands/gemini.ts argument parsing and cli/src/gemini/geminiRemoteLauncher.ts loadSession fallback behavior; the added tests only verify runGemini forwards resumeSessionId.
Testing
- Not run (automation)
HAPI Bot
SeeFlowerX
pushed a commit
to SeeFlowerX/hapi
that referenced
this pull request
Apr 1, 2026
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.
Problem
Gemini remote sessions currently start fresh when the runner respawns them with
--resume <sessionId>. The--resumeflag is accepted by the runner but not yet handled in the Gemini command path, so the session ID does not reach the ACP backend.Related: #337, #338
Solution
--resumeincommands/gemini.tsand threadresumeSessionIdthroughrunGemini→geminiLoop→GeminiSession, consistent with the existing OpenCode resume path (opencode/loop.ts)backend.loadSession()instead ofbackend.newSession()so the ACP server can restore the previous session state, with fallback tonewSessionon failureresumeSessionIdfromcreateGeminiBackendto avoid double-resume (CLI--resumeflag + ACPsession/load)Error.messagebefore logging prompt failures, consistent with how stderr errors are already handled in the same fileUsage
Resume is triggered automatically by the runner when a Gemini session process is restarted. No user-facing CLI change; the
--resumeflag is an internal runner interface.Tests
runGemini.test.ts: verifyresumeSessionIdis forwarded togeminiLoop