fix(media): isolate outputs by run generation#36
Merged
Conversation
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.
What
Isolate screenshots and recordings beneath a persistent run and restart-generation namespace:
Named outputs can no longer overwrite media from another run or from an earlier restart of the same run.
Before / After
Before: Every instance received the same media root. Two runs writing
result.pngtargeted the same file. Restarting a scripted run also reused that path, silently replacing the earlier screenshot. Artifact IDs used only six UUID characters, so persistent output directories could eventually collide even if they were used as namespaces.After: Artifact directories use full UUIDs. Each instance derives a media directory from that run ID, and each restart advances to a fresh generation directory. The selected path is injected when each OpenCode process is spawned, so servers and TUIs in one generation agree while later generations cannot overwrite earlier media. Runs that produce no media leave no empty output directory.
How
OpenCodeInstanceand advance it atomically during restart.OPENCODE_DRIVE_MEDIA_DIRper process spawn instead of freezing it in the base environment.Scope
Testing
bun run checkbun run test: 158 Effect tests, 52 CLI integration tests, and 28 catalog tests passed.bun pm pack --dry-run: 94 expected package files.v2atf05d2ab551; real screenshots were created under<run-id>/generation-0/.Flow