Repository navigation
Conversation
cleanStages only ran when the isolated dev server was enabled (!app.isPackaged && OPENCODE_DESKTOP_ISOLATED_SERVER=1), so released builds staged a new CLI copy on every version change and never removed older ones. Each stage is roughly 175 MB, so userData/cli grew without bound. Prune under the same condition that triggers staging (app.isPackaged || isolated) so packaged builds clean up on startup. Fixes anomalyco#53617
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Author
|
Superseded by #53659, which landed the same fix on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #53617
Type of change
What does this PR do?
The desktop app keeps every CLI build it stages under
userData/cli/<version>/. The cleanup for those already exists,cleanStagesindesktop-cli.ts, but its only call site inbackground-service.tswas guarded byisolated, which is!app.isPackaged && OPENCODE_DESKTOP_ISOLATED_SERVER === "1". That is false in every packaged build, so the cleanup never ran for released apps, whileinstallClistill staged a new copy whenever the bundled CLI version changed. Each copy is about 175 MB, so the folder grew on every update. I had 1.4 GB across 8 builds.This makes the prune run under the same condition that triggers staging,
app.isPackaged || isolated. A non-isolated dev app still skips it, since it runs the repo binary in place and must not remove anything from the resources directory.The
devbranch has a different desktop implementation (background-cli.ts) whoseinstallClihas no pruning at all, so it likely needs its own fix. This PR only covers the v2 line.How did you verify your code works?
I traced the staging and cleanup paths to confirm they now share one condition, and checked the shipped 2.0.24 bundle to confirm
cleanStagesis present and was simply unreachable in production. I did not run the suite here, because a full monorepo install was not practical on this machine, so I have left the local-test box unticked rather than claim otherwise.There is no test for this.
desktop-cli.tsimportselectronand a Vite?rawasset at load, so it is not importable from the bun test harness as it stands. If you want coverage, I can extract the pruning loop into an electron-free module likestore-cleanup.tsand add a test, either here or as a follow-up.Screenshots / recordings
No UI change.
Checklist