[Bug]: Windows run-file lifecycle E2E cannot detect private snapshot directories
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, playwright, typescript
Research direction
Read e2e/specs/mock/run-files-lifecycle.spec.ts, especially snapshotDirectories(), waitForPrivateSnapshot(), and expectSnapshotsRemoved(). Compare its directory filter with the Windows UUID naming in packages/api/src/utils/windowsPrivate.ts and the POSIX branch in packages/api/src/agents/files/snapshots.ts. Update discovery to recognize both naming conventions, then run the lifecycle E2E file on Windows and POSIX; done means both lifecycle scenarios detect creation and verify cleanup.
Written by the indexing model from the issue text.
Description
What happened?
The run-file snapshot lifecycle E2E tests cannot discover private snapshot directories created on native Windows.
This regression is present at commit b59574c6a65270b08475bd3abaa23d1dcabb312d, following the Windows-specific private-directory implementation introduced by [PR #18863](https://github.com/LibreChat-AI/LibreChat/pull/18863).
Root cause
The Windows implementation creates private snapshot directories through:
const directory = win32.join(parent, `${win32.basename(prefix)}${randomUUID()}`);
The resulting directory name has the librechat-run-files- prefix followed by a full UUID, including hyphens.
The production snapshot store selects this implementation on Windows:
const prefix = join(tmpdir(), 'librechat-run-files-');
if (process.platform === 'win32') return makeWindowsPrivateDirectory(prefix);
However, the E2E test's snapshotDirectories() function only accepts directory names with exactly six alphanumeric characters after the prefix:
(entry) => entry.isDirectory() && /^librechat-run-files-[A-Za-z0-9]{6}$/.test(entry.name)
That pattern matches the directory naming convention produced by the POSIX fs.mkdtemp() branch, but not the Windows UUID-based directory name.
Consequences
The waitForPrivateSnapshot() helper polls for exactly one newly created private snapshot directory:
Because the Windows-created directory is filtered out, the helper receives an empty list and the assertion expecting one directory cannot succeed.
This affects the following E2E scenarios:
cancellation deletes private snapshots and a later turn cannot publish their IDsa checkpoint resume restores publications and requires private outputs to be regenerated
There is an additional consequence: expectSnapshotsRemoved() also uses snapshotDirectories(). Therefore, the same incorrect name filter prevents that helper from reliably observing the Windows snapshot directory when checking cleanup.
Expected behavior
The lifecycle E2E tests must recognize the private snapshot directories created by both platform implementations.
The directory-discovery logic should not assume that every platform generates a six-character alphanumeric suffix. It should use a platform-independent way to identify the directories created by the snapshot store, or correctly account for the actual naming conventions of both implementations.
The tests must continue to verify:
- creation and discovery of private snapshot directories;
- cancellation cleanup;
- checkpoint-resume behavior;
- removal of private snapshot directories after the corresponding lifecycle operations.
The Windows ACL protection introduced by PR #18863 must remain unchanged. This report concerns the mismatch between the Windows directory naming implementation and the E2E test's directory-discovery logic; it does not claim that the Windows ACL implementation itself is defective.
Repository-wide search at the audited revision
The source tree was searched for:
makeWindowsPrivateDirectory;librechat-run-files-;snapshotDirectories;newSnapshotDirectories;waitForPrivateSnapshot;- temporary-directory enumeration and name-based filtering.
The search identified one production caller of makeWindowsPrivateDirectory() and one E2E directory-name filter responsible for the mismatch. No additional independent occurrence of the same naming/detection defect was identified in the audited source tree.
Related references
- [PR #18863 — Protect Private Files on Windows](https://github.com/LibreChat-AI/LibreChat/pull/18863)
- [Issue #18838 — Windows does not restrict access to temporary credentials and private artifact snapshots](https://github.com/LibreChat-AI/LibreChat/issues/18838) (closed)
Version Information
Repository: LibreChat-AI/LibreChat
Audited source revision:
b59574c6a65270b08475bd3abaa23d1dcabb312d
Commit subject:
🦗 fix: Explain Why Gemini Stops Without an Answer (#19133)
Commit URL:
https://github.com/LibreChat-AI/LibreChat/commit/b59574c6a65270b08475bd3abaa23d1dcabb312d
Branch: Not specified. The audit is pinned to the exact commit above.
Repository runtime declarations at this revision:
- Node.js:
24.22.3(.nvmrc) - npm:
11.13.0(packageManagerin rootpackage.json) - Playwright:
1.62.1(resolved inpackage-lock.json)
Affected environment:
Native Windows, where process.platform === 'win32'.
The POSIX implementation uses fs.mkdtemp(), while the Windows implementation uses makeWindowsPrivateDirectory() and appends a UUID.
The issue concerns native host filesystem behavior and the E2E test infrastructure. WSL or a Linux Docker container does not exercise the Windows-specific production branch.
Application diagnostics: Not applicable. This is a source-level test-infrastructure issue, not a report about a deployed LibreChat instance.
Docker image/build information: No Docker rebuild was used for this source-level audit.
Execution evidence: The issue was established by inspecting the exact source revision. A native Windows Playwright execution against this commit was not performed as part of this audit. No Windows runtime version or captured Windows test log is therefore claimed.
Related issue: #18838 (closed; original Windows private-files security issue associated with PR #18863).
Steps to Reproduce
-
Check out LibreChat source revision:
b59574c6a65270b08475bd3abaa23d1dcabb312d -
Use a native Windows environment. Do not use WSL or a Linux Docker container for this reproduction.
-
Use the repository-declared Node.js and npm versions:
- Node.js
24.22.3 - npm
11.13.0
- Node.js
-
Install the repository dependencies using the committed lockfile.
-
Open a terminal in the repository root.
-
Run the existing mock E2E script with the lifecycle test file as its argument:
npm run e2e:mock -- 'e2e/specs/mock/run-files-lifecycle.spec.ts' -
Inspect the scenario:
cancellation deletes private snapshots and a later turn cannot publish their IDs -
The snapshot store creates a private directory through the Windows-specific
makeWindowsPrivateDirectory()implementation. -
Inspect
snapshotDirectories()ine2e/specs/mock/run-files-lifecycle.spec.ts. Its regular expression only accepts names matching:librechat-run-files-followed by exactly six alphanumeric characters. -
The Windows-created UUID-based directory does not match that expression. Consequently, the directory is excluded from the returned list.
-
waitForPrivateSnapshot()polls for one matching directory, but the filtered result remains empty. The expectation.toBe(1)therefore cannot be satisfied. -
Inspect the scenario:
a checkpoint resume restores publications and requires private outputs to be regeneratedIt uses the same discovery helper and is affected by the same mismatch.
-
Inspect
expectSnapshotsRemoved(). It also relies onsnapshotDirectories(), so the cleanup check uses the same incompatible name filter.
Expected result
The E2E tests discover the directory created by the Windows snapshot implementation, verify its contents, and correctly verify its removal after cancellation or checkpoint-related lifecycle operations.
The test should pass on Windows and POSIX without weakening the snapshot privacy or cleanup assertions.
What browsers are you seeing the problem on?
No response
Relevant log output
No native Windows runtime log was captured during this source-level audit.
The following excerpts demonstrate the statically verified mismatch. They are source excerpts, not a captured test execution transcript.
**Windows directory generation**
File: `packages/api/src/utils/windowsPrivate.ts`
const directory = win32.join(parent, `${win32.basename(prefix)}${randomUUID()}`);
**E2E directory filter**
File: `e2e/specs/mock/run-files-lifecycle.spec.ts`
(entry) => entry.isDirectory() && /^librechat-run-files-[A-Za-z0-9]{6}$/.test(entry.name)
**E2E expectation**
File: `e2e/specs/mock/run-files-lifecycle.spec.ts`
await expect
.poll(async () => {
directories = await newSnapshotDirectories(before);
return directories.length;
})
.toBe(1);
The Windows-generated directory name does not satisfy the regular expression. It is consequently excluded before the directory count is evaluated.
Expected source-level result:
- Windows creates the private directory.
- `snapshotDirectories()` does not include that directory.
- `waitForPrivateSnapshot()` observes zero matching directories instead of one.
- The expectation for one matching directory cannot be satisfied.
No exact Playwright timeout message, Windows exception, or stack trace is presented because a native Windows execution was not performed for this audit.
This evidence identifies a deterministic source-level mismatch between the directory producer and the E2E directory detector.
Screenshots
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- TypeScript
- Stars
- 45.6k
- Forks
- 9.4k
- Avg merge
- 16h 24m
- Merged PRs (30d)
- 825
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from LibreChat-AI/LibreChat
-
[Bug]: Assistants title generation hardcodes gpt-3.5-turbo, which OpenAI shut down on 23 Oct 2026Possibly taken A pull request linked to this issue is open or already merged. Open🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
LibreChat-AI/LibreChat#19201 ·
Maintainers usually reply within 1 day
-
[Bug]: New agent has no provider/model preselected when only one provider is allowedPossibly taken A pull request linked to this issue is open or already merged. Open🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
LibreChat-AI/LibreChat#19198 ·
Maintainers usually reply within 1 day
-
[Bug]: Root `color-scheme` only set in high-contrast mode, so a custom `logo.svg` ignores the app's dark themePossibly taken @fahm-codes claimed this 1 day ago. Open🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LibreChat-AI/LibreChat#19185 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug]: E2E tests use outdated UI selectors in keys.spec.ts, popup.spec.ts and messages.spec.tsPossibly taken A pull request linked to this issue is open or already merged. Open🐛 bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LibreChat-AI/LibreChat#19091 ·
Maintainers usually reply within 1 day
-
✨ enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
LibreChat-AI/LibreChat#19039 · 1 comment ·
Maintainers usually reply within 1 day
All issues in LibreChat-AI/LibreChat
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
prio:low scope:world
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
OliverRomhagen/vrigstad-joyride#849 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
genfeedai/genfeed.ai#11916 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
erkamyaman/rust-anything#1153 ·
Maintainers usually reply within 1 day
-
The Phase 5 report says 0.3.0 waits for the live checkPossibly taken @fzn0x claimed this today. Opendocumentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day