From ba070999952c21aadfcfc2849c4a7c7c1c306141 Mon Sep 17 00:00:00 2001 From: Michal Szelag Date: Sun, 15 Mar 2026 08:47:49 -0400 Subject: [PATCH 1/2] fix: create ~/.gemini directory before CLI invocation to prevent ENOENT Gemini CLI 0.33.0 writes a user-level project registry at ~/.gemini/projects.json during cleanup. The atomic write fails with ENOENT if ~/.gemini/ doesn't exist. Add mkdir -p before the first gemini command to ensure the directory is present. --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 7eccaf14b..0e8df8e6d 100644 --- a/action.yml +++ b/action.yml @@ -265,6 +265,7 @@ runs: npm run bundle npm install --silent --no-audit --prefer-offline --global . fi + mkdir -p "${HOME}/.gemini" echo "Verifying installation:" if command -v gemini >/dev/null 2>&1; then gemini --version || echo "Gemini CLI installed successfully (version command not available)" From c884dac565aa8d5db159ad216adb0503ddd88d81 Mon Sep 17 00:00:00 2001 From: Michal Szelag Date: Sun, 15 Mar 2026 19:47:12 -0400 Subject: [PATCH 2/2] fix: pre-seed projects.json to prevent concurrent-save race in Gemini CLI The previous mkdir-only fix was insufficient. Gemini CLI 0.33.0 runs cleanupCheckpoints() and cleanupToolOutputFiles() concurrently via Promise.all. Both initialize a ProjectRegistry that writes to the same projects.json.tmp file. When the registry file doesn't exist, both call save() without locking, causing a race where one rename succeeds and the other gets ENOENT because the tmp file was already renamed away. Pre-seeding projects.json with valid empty data causes both concurrent callers to skip the unguarded initial save and go straight to proper-lockfile's lock(), which properly serializes access. --- action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/action.yml b/action.yml index 0e8df8e6d..3ea295b0c 100644 --- a/action.yml +++ b/action.yml @@ -266,6 +266,9 @@ runs: npm install --silent --no-audit --prefer-offline --global . fi mkdir -p "${HOME}/.gemini" + if [[ ! -f "${HOME}/.gemini/projects.json" ]]; then + echo '{"projects":{}}' > "${HOME}/.gemini/projects.json" + fi echo "Verifying installation:" if command -v gemini >/dev/null 2>&1; then gemini --version || echo "Gemini CLI installed successfully (version command not available)"