Skip to content

feat(gemini-module): Gemini session resume#810

Open
Harsh9485 wants to merge 19 commits intocoder:mainfrom
Harsh9485:gemini-session-resume
Open

feat(gemini-module): Gemini session resume#810
Harsh9485 wants to merge 19 commits intocoder:mainfrom
Harsh9485:gemini-session-resume

Conversation

@Harsh9485
Copy link
Copy Markdown
Contributor

Description

Closes: #745

This PR adds the enable_state_persistence variable.

The session resume logic works as follows: when we run the Gemini CLI, it creates a folder with the same name as the directory where the CLI command runs. In the script, we use agentapi, which runs in the $GEMINI_START_DIRECTORY directory. So, I get the directory name and check whether it exists. If it does not exist, a new session is created.

Changes:

  • Added enable_state_persistence variable.
  • Improved AGS passing in start.sh.
  • Added --type gemini in agentapi.
  • Added logic for session resume using --resume.
  • Updated Readme.md file
  • added main.tftest.hcl file.

Type of Change

  • New module
  • New template
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Module Information

Path: registry/coder-labs/modules/gemini
New version: v3.1.0
Breaking change: [ ] Yes [x] No

Testing & Validation

  • Tests pass (bun test)
  • Code formatted (bun fmt)
  • Changes tested locally

Related Issues

#749
#745

@Harsh9485
Copy link
Copy Markdown
Contributor Author

@mafredri,
I can’t test this because the module requires Node.js, and the user must install it first to use the Gemini module.

If I add the Gemini module but my workspace does not have Node installed, the workspace crashes. If I first don’t add the module, install Node, and then add the module in the template, Coder creates a new workspace, and again Node is not available, so the workspace crashes.

In this PR: #374, the Node installation part was removed, and I don’t see any valid reason for that.

@matifali matifali requested a review from mafredri March 24, 2026 11:34
@DevelopmentCats
Copy link
Copy Markdown
Collaborator

@mafredri, I can’t test this because the module requires Node.js, and the user must install it first to use the Gemini module.

If I add the Gemini module but my workspace does not have Node installed, the workspace crashes. If I first don’t add the module, install Node, and then add the module in the template, Coder creates a new workspace, and again Node is not available, so the workspace crashes.

In this PR: #374, the Node installation part was removed, and I don’t see any valid reason for that.

You should just be able to use an image with node installed, or use the pre_install_script variable to install node.js before gemini even goes to install?

Copy link
Copy Markdown
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

The base64 encoding of env vars in the start script is a solid improvement, eliminating a class of shell injection via special characters in API keys and prompts. Adding --type gemini to the agentapi server command aligns with the codex, copilot, and cursor-cli modules.

A few things need attention before this can merge: 4 P1, 4 P2, 1 P3, 1 nit across 10 inline comments.

Hisoka: "The --resume branch silently eating task_prompt on restart, the undeclared breaking change to the default folder, and the new exit 1 killing Vertex AI ADC users. Each breaks an existing use case documented in the README."

Mafuuu: "The promise is broken at the default configuration. enable_state_persistence defaults to true with agentapi v0.10.0, a combination the README itself says won't work."

Also: all four README code examples still show version = "3.0.0" but the PR declares v3.1.0. The registry checklist requires updating version references.

🤖 This review was generated with the help of Coder Agents.

mafredri

This comment was marked as duplicate.

@Harsh9485
Copy link
Copy Markdown
Contributor Author

Sorry for being inactive.

The module update runs without errors, but there are still some issues.
Screenshot 2026-04-01 120526

  1. I added the resume logic, but this module has an invalid configuration in settings.json, and the Coder MCP server is not configured properly.

`gemini --version
Invalid configuration in /home/coder/.gemini/settings.json:

Error in: mcpServers.coder
Unrecognized key(s) in object: 'enabled', 'name'`

  1. The module does not appear in the Task tab.
Screenshot 2026-04-01 120329

@Harsh9485
Copy link
Copy Markdown
Contributor Author

I think the coder exp mcp configure gemini command does not support the Gemini CLI yet.

install-log.txt

So can I remove that command and configure the MCP server on my own?

@Harsh9485 Harsh9485 requested a review from mafredri April 1, 2026 09:45
@Harsh9485 Harsh9485 changed the title Gemini session resume feat(gemini-module): Gemini session resume Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gemini: wire session resume on workspace restart

3 participants