Skip to content

Windows: opencode temp directory accumulated 150k+ files and caused 30s ProfSvc logon delay #27005

Closed as not planned

Description

@Bl0ck154

Summary

On Windows, opencode/OpenCode created or left a very large number of files under %LOCALAPPDATA%\Temp\opencode. This caused Windows User Profile Service (ProfSvc) to spend ~30 seconds during post-PIN logon scanning the user temp tree before the desktop appeared.

After cleaning %LOCALAPPDATA%\Temp\opencode, the same logon phase dropped from ~30 seconds to ~5 seconds.

Impact

This is not just disk usage. On Windows, a large temp tree can directly affect interactive logon time because ProfSvc scans the user temp directory during profile load.

Observed before cleanup:

%LOCALAPPDATA%\Temp
Items=156,045
Dirs=11,058
Files=144,987
Size=2.87 GB

%LOCALAPPDATA%\Temp\opencode
Items=152,744
Files=142,179
Size=2.56 GB

Observed after cleanup:

%LOCALAPPDATA%\Temp
Items≈17,980
Files≈15,914
Size≈0.64 GB

ProfSvc logon phase: ~5 seconds instead of ~30 seconds

Evidence

Windows Event Log showed the delay in the Microsoft-Windows-User Profile Service/Operational log for the affected user profile. A separate clean test profile logged in immediately.

A dump of the ProfSvc svchost process during the delay showed it inside the temp-tree scan path:

ProfSvc
CUserProfile::Load
CreateTempDirectoryForUser
StorageReserveHelper::SetReserveAreaOnFileTree
StorageReserveHelper::RecursiveScanDirectory

This matches the observed behavior: once the temp tree was cleaned, the delay disappeared.

Environment

OS: Windows
OpenCode desktop: 1.14.40
Older OpenCode install metadata also present: 1.14.33
Temp path: %LOCALAPPDATA%\Temp\opencode

Expected Behavior

opencode should not leave unbounded temporary artifacts under %LOCALAPPDATA%\Temp\opencode.

Possible mitigations:

  • Clean old temp/session artifacts on startup or shutdown.
  • Use bounded cache retention by age and/or size.
  • Store durable cache under %LOCALAPPDATA%\OpenCode instead of %TEMP%.
  • Avoid creating very high file counts in Windows temp directories.
  • Provide a documented cleanup command.

Actual Behavior

The temp directory grew to 150k+ items within a relatively short install window and caused a reproducible Windows post-PIN logon delay.

Request

Please add automatic cleanup/retention for %LOCALAPPDATA%\Temp\opencode on Windows, or move non-temporary cache artifacts to a bounded cache directory.

Activity

  1. github-actions commented on May 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If the root cause is the same, it may be worth referencing or continuing the discussion there.

  2. github-actions commented on Jul 12, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions