Skip to content

fix(snapshot): handle info/exclude write failure gracefully instead of orDie#37494

Open
mgajda wants to merge 1 commit into
anomalyco:devfrom
mgajda:fix/snapshot-exclude-race
Open

fix(snapshot): handle info/exclude write failure gracefully instead of orDie#37494
mgajda wants to merge 1 commit into
anomalyco:devfrom
mgajda:fix/snapshot-exclude-race

Conversation

@mgajda

@mgajda mgajda commented Jul 17, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #37493

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Snapshot.sync writes to info/exclude inside the snapshot gitdir with Effect.orDie, so any EACCES (from UID mismatch when the snapshot directory is shared between a container and the host, or from concurrent writes across sessions) crashes the SessionProcessor mid-conversation with:

PlatformError: PermissionDenied: FileSystem.writeFile (.../info/exclude)
cause: EACCES: permission denied, open .../info/exclude

Changes both write sites (ensureDir + writeFileString) to Effect.catch with Effect.logWarning instead of Effect.orDie. The exclude file is advisory — a write failure should log and continue, not kill the session.

How did you verify your code works?

  • tsgo --noEmit passes
  • Existing tests in packages/opencode pass
  • Running opencode from source confirms errors are logged as warnings instead of crashing

Screenshots / recordings

N/A.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…f orDie

Snapshot.sync writes info/exclude with Effect.orDie, so any EACCES
(from UID mismatch in containerized setups or concurrent session writes)
crashes SessionProcessor mid-conversation.  The exclude file is advisory —
a write failure should log a warning and continue.

Closes anomalyco#37493
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.

fix(snapshot): handle info/exclude write failure gracefully instead of crashing session

1 participant