Repository navigation
fix(agent): restore session view before tools and reject recording drift - #205
Closed
vinceblock99 wants to merge 3 commits into
Closed
vinceblock99 wants to merge 3 commits into
vinceblock99 wants to merge 3 commits into
Conversation
vinceblock99
marked this pull request as draft
September 20, 2026 23:29
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.
Resuming an OpenCode conversation after its working directory switched views could leave tools on the wrong view until Stop. Recording then treated files absent from that other view as deletions. Materialization also logged individual file-write failures while returning success, so a matching view pointer did not establish that file restoration had completed.
Prepare the session view before returning from same-ID SessionStart and before each TurnStart. Preserve pending work when switching would overwrite it. Propagate per-file materialization errors from the repository instead of counting them as successful skips; retain the successful files' index/conflict information and report the failure.
Persist a target-view completion marker before an agent restore, verify the resulting working copy, and clear the marker only after completion. Failed/interrupted restores block tools, Stop, recording, and new/fallback sessions in that canonical working copy, including after restart. Explicit repair followed by resuming the original session verifies completion and clears the marker. A successfully rendered graph conflict is valid output: it remains visible and tools can resolve it. The repository continues to refuse recording unresolved markers.
Unscoped recording also checks effective change/dependency closures before status and after acquiring a writer. Different closures are rejected instead of repairing the pointer at Stop; equivalent closures still permit fresh forks. Validated explicit manifests retain scoped behavior once preparation is complete, and sandbox working copies remain separate.
Why the pending marker exists
The existing deferred-TREE alignment marker is cleared after TREE/pointer publication, before filesystem materialization finishes. It cannot identify a later file-write failure. The new marker spans the agent's complete restore/verification interval and contains only a target view. It is operational completion state, not a file-ownership map, saved file snapshot, or source of graph history. The code comment now states that purpose directly.
Validation
atomic-agentsuite: 1,358 unit + 2 integration + 31 doctests pass; 9 doctests ignored.atomic-repositorysuite: 946 tests pass; 86 existing tests/doctests ignored.-D warningspasses. An additional--all-targetsClippy run hits five pre-existing test-only lints in two unchanged files (merge_property_tests.rs and integrations/install.rs); those files are identical to base.052bca3+ the candidate CLI + GPT-5 mini: four isolated scenarios pass, with 10 successfully recorded turns. Covered normal resume, build/Atomic-mode controls, existing edits, process restart, new-session handoff, shell-created vault memory, failed write/restart/explicit repair/continuation, and a real graph conflict restored and resolved by an Atomic agent.git diff --checkpasses.Scope
Keep Draft pending CI/review of this update. This does not redesign deferred TREE/path resolution, repair historical deletions, migrate old explicit-file ownership sessions, or certify concurrent writers sharing a working directory. On incomplete restoration, resolve filesystem obstructions, restore expected files and preserve other edits, then retry the original session; do not delete the marker to bypass verification. Healthy same-view edits remain allowed.