Skip to content

Add --disable-file-cache flag - #8085

Open
acpiper wants to merge 1 commit into
coder:mainfrom
acpiper:disable-file-cache
Open

acpiper wants to merge 1 commit into
coder:mainfrom
acpiper:disable-file-cache

Conversation

@acpiper

@acpiper acpiper commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Closes #8084

  • Add a --disable-file-cache flag, off by default. With the flag, the browser does not store workspace files on the client disk.

  • Make the webview resource loader send no ETag for a resource outside the webview's own extension. The webview service worker stores only responses that have an ETag, so these resources stay out of Cache Storage.

  • Serve /vscode-remote-resource with Cache-Control: no-store for files outside the extension directories. Extension files keep their ETag and their max-age header.

  • Put the VS Code changes in a new patch, patches/disable-file-cache.diff, which passes the flag the same way as external-file-actions.diff. The patch is last in patches/series, because getting-started.diff does not apply when the new patch comes right after external-file-actions.diff.

  • Add test/e2e/fileCache.test.ts:

    • with the flag, the Markdown preview webview's Cache Storage has no entry for a workspace image, and it has entries for the Markdown extension's own files;
    • with the flag, /vscode-remote-resource responds with no-store for a workspace file and with an ETag for an extension file;
    • without the flag, both behave as before.

    The two tests with the flag fail when the VS Code patch is removed.

  • Add --disable-file-cache to the parser test in test/unit/node/cli.test.ts.

  • Add a changelog entry under "Unreleased".

Entries that the browser cached before the flag was set stay in the cache. The flag stops only new entries.

The browser writes some workspace files to the client disk during normal
use. The webview service worker stores resources that have an ETag in
Cache Storage, and responses from /vscode-remote-resource can end up in
the HTTP disk cache. --disable-file-downloads does not cover either.

With --disable-file-cache, the webview resource loader sends no ETag for
a resource outside the webview's own extension, so the service worker
does not store it. /vscode-remote-resource responds with
`Cache-Control: no-store` for files outside the extension directories.
Extension files keep their ETags, so webviews still load extension code
from the cache. The flag is off by default.

The VS Code changes are in a new patch that follows the plumbing of
external-file-actions.diff. The e2e tests check the Cache Storage of the
Markdown preview webview and the headers of /vscode-remote-resource.
@acpiper
acpiper requested a review from a team as a code owner October 28, 2026 13:03

This branch has not been deployed

No deployments
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.

Add --disable-file-cache to keep workspace files out of the browser cache

1 participant