Agent isolation enhancements (W6/W7/W8)#2
Merged
MikeSchirtzinger merged 5 commits intomainfrom Mar 13, 2026
Merged
Conversation
W7 (--metadata-only flag on jj describe): - Add --metadata-only flag to DescribeArgs (conflicts with editor/stdin/author flags) - When set, writes operation to op_store via Transaction::write() but calls leave_unpublished() instead of publish() — skipping update_op_heads entirely - Other workspaces see zero oplog staleness from metadata-only operations - Suppresses editor when --metadata-only is set (no description change needed) - Prints operation ID to stdout for orchestrator tracking W8 (read-only op heads loading): - Add read_op_heads_non_mutating() to op_heads_store.rs: reads op heads without acquiring locks or triggering merge operations; picks most recent by timestamp when multiple heads exist - Add ReadOnlyOpHeadsStore wrapper: delegates reads to inner store, errors on any write attempt, returns no-op lock - Add RepoLoader::load_at_head_readonly() for guaranteed non-mutating head load - Add RepoLoader::as_readonly() to clone a loader with ReadOnlyOpHeadsStore W6 (ForkedOpHeadsStore per-agent isolation): - New file: lib/src/forked_op_heads_store.rs - ForkedOpHeadsStore: copies parent op_heads at agent spawn time into a private directory; all agent writes go to the private store only - fork_base file records the fork point for correct merge ancestry computation - ForkedOpHeadsStore::fork_from() / load() for lifecycle management - Register ForkedOpHeadsStore in StoreFactories defaults - 3 unit tests: test_fork_copies_parent_heads, test_agent_writes_do_not_affect_parent, test_load_roundtrip — all passing
…sory) - Fix import ordering in repo.rs (ForkedOpHeadsStore moved alphabetically) - Fix rustfmt line wrapping in forked_op_heads_store.rs test - Fix comment line length in repo.rs load_at_head_readonly doc - Add #[allow(clippy::unnecessary_literal_bound)] on ReadOnlyOpHeadsStore::name() - Fix broken doc link merge_back in forked_op_heads_store.rs - Fix broken doc link ReadOnlyOpHeadsStore in repo.rs using full path - Update CLI reference snapshot for --metadata-only and --set-* hox flags - Update time crate to v0.3.47 (security advisory fix) - Fix clippy::cloned_ref_to_slice_refs in test_agent_writes_do_not_affect_parent
…rebase The main branch had code (brevity/mod.rs, test_forked_op_heads.rs) using the old ForkedOpHeadsStore API (init, init_from, load→Self). Update to the PR's authoritative API (fork_from, load→Result) and fix formatting (alphabetical module ordering in lib.rs and runner.rs). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3da27d0 to
717f700
Compare
Co-Authored-By: Claude Opus 4.6 <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
--metadata-onlyflag onjj describe): Writes operations to op_store but skipsupdate_op_heads, so other workspaces see zero oplog staleness from metadata-only operations. Suppresses editor and prints operation ID for orchestrator tracking.read_op_heads_non_mutating()that reads op heads without acquiring locks or triggering merges. IncludesReadOnlyOpHeadsStorewrapper andRepoLoader::load_at_head_readonly()for guaranteed non-mutating head loads.ForkedOpHeadsStoreper-agent isolation): New store that copies parent op_heads at agent spawn time into a private directory — all agent writes stay private. Includesfork_from()/load()lifecycle and 3 unit tests.Files changed
cli/src/commands/describe.rs—--metadata-onlyflaglib/src/forked_op_heads_store.rs— New ForkedOpHeadsStorelib/src/lib.rs— Module registrationlib/src/op_heads_store.rs— Read-only op heads supportlib/src/repo.rs— Readonly loader methodsTest plan
test_fork_copies_parent_heads,test_agent_writes_do_not_affect_parent,test_load_roundtrip--metadata-onlyflag conflicts correctly with--editor/--stdin/--author