Correct AGENTS.md on ImageRef locking - #542
Merged
Merged
Conversation
r.lock only guards lifecycle transitions (Close, SetKill, setImage, streaming materialize/save); ordinary methods take no lock, so state plainly that an ImageRef is not safe for concurrent use rather than implying general methods are mutex-guarded. Flagged by Macroscope on #541. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Fixes the inaccuracy Macroscope flagged on #541: AGENTS.md said ImageRef methods "guard with
runtime.KeepAlive(r)andr.lock", implying general concurrency safety. In realityr.lockis taken only at lifecycle/ownership transitions (Close,SetKill,setImage, streaming materialize/save — verified via grep, those are the only fiver.lock.Lock()sites); ordinary transform/export/metadata methods take no lock. The doc now says that plainly and warns against using oneImageReffrom multiple goroutines.🤖 Generated with Claude Code
Note
Correct
ImageReflocking and concurrency documentation in AGENTS.mdUpdates AGENTS.md to accurately describe
ImageRefconcurrency semantics. Clarifies thatr.lockguards only lifecycle/ownership transitions (Close,SetKill,setImage, streaming materialize/save), while ordinary transform, export, and metadata methods do not take the lock and rely solely onruntime.KeepAlive(r). Explicitly documents thatImageRefis not safe for concurrent use and that no methods, includingClose, may be called from multiple goroutines simultaneously.Macroscope summarized 54f71e7.