fix: use workspace-local mise dir on Windows for cache compatibility#437
fix: use workspace-local mise dir on Windows for cache compatibility#437jdx wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the miseDir function to use a workspace-local directory on Windows when GITHUB_WORKSPACE is defined, addressing potential cross-drive issues with GitHub Actions caching. Feedback indicates that the MISE_DATA_DIR environment variable must be explicitly exported when this local path is used to ensure the mise CLI and the action remain synchronized, preventing cache misses.
| if (workspace) { | ||
| return path.join(workspace, '.mise') | ||
| } |
There was a problem hiding this comment.
When defaulting to a workspace-local directory on Windows, it is necessary to export the MISE_DATA_DIR environment variable. Without this, the mise CLI will continue to use its internal default path (typically %LOCALAPPDATA%\mise), while the action will attempt to restore and save the cache from the workspace-local .mise directory. This mismatch results in the actual tool installations not being cached, as they will be installed in the default location instead of the one being tracked by the action.
if (workspace) {
const dir = path.join(workspace, '.mise')
core.exportVariable('MISE_DATA_DIR', dir)
return dir
}
Greptile SummaryThis PR adds diagnostic logging inside
Confidence Score: 3/5Not safe to merge as-is — the Windows cache fix described in the title is absent; the bug remains. The PR title is 'fix: use workspace-local mise dir on Windows' but miseDir() is functionally unchanged on Windows. The cross-drive saveCache failure will still occur on cache miss. The changes present are diagnostic-only, with two P2 debug artifacts that should be cleaned up before the final merge. src/index.ts — miseDir() Windows branch needs the actual fix; .github/workflows/test.yml — debug cache key prefix should be reverted. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[run] --> B{cache enabled?}
B -->|yes| C[restoreMiseCache]
C --> D["miseDir() → saves as MISE_DIR state"]
D --> E{Windows?}
E -->|yes| F["LOCALAPPDATA\\mise ❌ still on C:"]
E -->|no| G["~/.local/share/mise or XDG_DATA_HOME"]
F --> H[core.saveState MISE_DIR = C: path]
G --> H
H --> I[setupMise / miseInstall]
I --> J{cache_save?}
J -->|yes| K[saveCache]
K --> L["miseDir() → reads MISE_DIR state"]
L --> M["cachePath = C:\\...\\mise"]
M --> N["@actions/cache.saveCache ❌ cross-drive error on Windows"]
Reviews (3): Last reviewed commit: "fix: use workspace-local mise dir on Win..." | Re-trigger Greptile |
f991358 to
121dc09
Compare
| if (fs.existsSync(cachePath)) { | ||
| const contents = await fs.promises.readdir(cachePath); | ||
| core.info(`Cache dir contents: ${JSON.stringify(contents)}`); | ||
| } |
There was a problem hiding this comment.
Debug logging accidentally committed in saveCache
Medium Severity
Diagnostic core.info calls logging the cache path, its existence, platform, GITHUB_WORKSPACE, and full directory contents were added to saveCache. These are debug/investigation statements (not core.debug) that will produce verbose output for every user on every cache-miss run. This appears to be troubleshooting code for the Windows cross-drive issue that was accidentally included in the commit.
Reviewed by Cursor Bugbot for commit 121dc09. Configure here.
| MY_ENV_VAR = "abc" | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| ACTIONS_STEP_DEBUG: true |
There was a problem hiding this comment.
ACTIONS_STEP_DEBUG permanently enabled in CI workflow
Low Severity
ACTIONS_STEP_DEBUG: true is set as a permanent environment variable on the test step. This enables verbose GitHub Actions step-level debug output for every CI run, not just during active debugging. This looks like a leftover from investigating the Windows caching issue described in the PR.
Reviewed by Cursor Bugbot for commit 121dc09. Configure here.
@actions/cache uses @actions/glob internally to resolve cache paths, which fails when the path is on a different drive than GITHUB_WORKSPACE. On Windows CI runners, GITHUB_WORKSPACE is typically on D: while LOCALAPPDATA (the previous default) is on C:, causing saveCache to throw "Path Validation Error" on cold caches. Default to GITHUB_WORKSPACE/.mise on Windows so the cache path is always on the same drive as the workspace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
121dc09 to
b8f8b69
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b8f8b69. Configure here.
| async function saveCache(cacheKey) { | ||
| await core.group(`Saving mise cache`, async () => { | ||
| const cachePath = miseDir(); | ||
| core.info(`Cache path: ${cachePath}`); |
There was a problem hiding this comment.
Described Windows miseDir fix is entirely missing
High Severity
The PR description states the fix is to "default mise data dir to GITHUB_WORKSPACE/.mise instead of LOCALAPPDATA\mise" on Windows, but miseDir() was never modified — it still returns path.join(LOCALAPPDATA, 'mise') on Windows. Only debug logging was added to saveCache. The actual fix that would resolve the cross-drive @actions/cache path validation error is absent from this commit.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b8f8b69. Configure here.
| if (process.platform === 'win32' && LOCALAPPDATA) | ||
| return path.join(LOCALAPPDATA, 'mise') |
There was a problem hiding this comment.
Windows fix is absent — cross-drive
saveCache error persists
The PR title promises "use workspace-local mise dir on Windows for cache compatibility," but miseDir() is unchanged: it still returns path.join(LOCALAPPDATA, 'mise') on Windows. On GitHub-hosted Windows runners LOCALAPPDATA is on C: while GITHUB_WORKSPACE is on D:, so saveCache still passes a cross-drive path to @actions/cache, which triggers the "Path Validation Error" on every cold-cache run. The diagnostic logging added below will show the C:\… path, confirming the bug isn't fixed yet.
The intended fix — falling back to path.join(process.env.GITHUB_WORKSPACE!, '.mise') when on Windows — needs to be added here:
| if (process.platform === 'win32' && LOCALAPPDATA) | |
| return path.join(LOCALAPPDATA, 'mise') | |
| if (process.platform === 'win32') { | |
| const workspace = process.env.GITHUB_WORKSPACE | |
| if (workspace) return path.join(workspace, '.mise') | |
| if (LOCALAPPDATA) return path.join(LOCALAPPDATA, 'mise') | |
| } |
|
Not a pre-existing bug — Windows cache save works fine with ncc. The failure is specific to the rollup bundling in #436. Closing this and moving the fix there. |


Summary
GITHUB_WORKSPACE/.miseinstead ofLOCALAPPDATA\mise@actions/cachesaveCache failing with "Path Validation Error" when the cache path is on a different drive thanGITHUB_WORKSPACEWhy
@actions/cacheuses@actions/globinternally to resolve cache paths. On Windows CI runners,GITHUB_WORKSPACEis onD:whileLOCALAPPDATAis onC:. The glob library can't resolve paths across drives, causingsaveCacheto throw when the cache is cold.This has been a latent bug masked by warm caches on main —
saveCacheis only called on cache miss, and the Windows cache has been hitting from a previously-seeded value.Test plan
🤖 Generated with Claude Code
Note
Low Risk
Low risk: changes are limited to extra diagnostic logging and CI debug settings, with no functional changes to installation or caching behavior.
Overview
Adds extra diagnostics for cache troubleshooting by logging the resolved
misecache path, platform/workspace info, and directory contents before calling@actions/cache.saveCache.Updates the test workflow to run the action with a distinct
cache_key_prefixandACTIONS_STEP_DEBUGenabled to surface these logs in CI.Reviewed by Cursor Bugbot for commit b8f8b69. Bugbot is set up for automated code reviews on this repo. Configure here.