You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two bugs in packages/opencode/src/util/log.tscleanup() that together cause the latest log file to be deleted when OpenCode is launched multiple times:
Race condition: cleanup() was called without await in init(), so it ran concurrently with new log file creation. The newly created file could appear in the glob results mid-cleanup and get deleted.
Non-deterministic sort: Glob.scan returns files in filesystem order (non-deterministic on Windows NTFS). Without .sort() before .slice(0, -10), the newest files could be deleted instead of the oldest.
Activity
github-actions commentedon Mar 8, 2026
This issue might be a duplicate of existing issues. Please check:
cleanup()inpackages/opencode/src/util/log.tsdeletes newest log files instead of oldest due to non-deterministicGlob.scanordering (missing.sort()), and the same unawaitedcleanup()race condition fix is proposed.Please review #14731 to see if it covers your report, and consider closing this issue if it does.
maharshi365 commentedon Mar 8, 2026
Duplicate of #14731 which covers the same root cause in more detail.