Repository navigation
Files Changed: session-bind Sidebar external file mutations #976
Description
Files Changed: session-bind Sidebar external file mutations
Important
Problem - Sidebar file operations mutate directly through VS Code without an active session identity or server reservation. Post-hoc notifications and raw-path watchers can only make client-side guesses, leaving external changes stale, misattributed, or invisible.
Approach - Bind each chat panel to its current server session. Eligible Sidebar file operations prepare a short-lived reservation before filesystem work, then commit or abort afterward. Watchers carry server-issued canonical descriptors and only invalidate assessed detail for server reassessment.
Scope - in: leaf-file create, delete, rename, move, and restore; per-panel session context; authenticated reservation transport; canonical watcher invalidation. out: recursive directory operations, folder-only changes, baseline storage, and legacy in-worktree diff replacement.
Assumptions - Earlier children supply server baselines, reservation capabilities, assessed detail, and stable lifecycle semantics. Missing session or unavailable reservation preserves ordinary Sidebar behavior without attribution.
Acceptance Criteria
- With an active session and valid reservation, an eligible Sidebar file operation prepares before mutation and commits only after filesystem success.
- A failed post-prepare filesystem operation aborts and never creates an owned changed row.
- Cancelled input and delete confirmation perform neither prepare nor mutation.
- With no active chat session, draft route, unavailable server, or rejected reservation, ordinary Sidebar behavior remains intact but every session leaves the operation untracked.
- The operation uses the last focused chat panel's session, never a primary panel or project-path guess.
- A rename or move submits distinct source and destination targets; the server owns their canonical identities.
- Watcher invalidation carries no client-derived modified or deleted status and triggers assessed-detail refetch.
- Successful filesystem work remains visibly successful if later commit transport fails; tracking is aborted best-effort rather than falsely reported.
- Existing trash behavior, collision checks, native editor opening, and legacy in-worktree diff behavior remain unchanged.
Testing Decisions
- Extend Sidebar bridge and file-operation tests with prepare-before-mutate, commit-after-success, abort-after-failure, no-session fallback, and two-target move cases.
- Extend chat bridge and multi-panel tests for per-panel session context, draft and close clearing, and last-focused-panel selection.
- Extend relay coverage for normal and transition iframe session-context and reassessment envelopes.
- Add focused watcher coverage for canonical descriptor registration, opaque-reference invalidation, debounce, and stale-watch disposal.
- Extend assessed-detail bridge coverage so invalidation refetches server evidence instead of applying local status overrides.
Key Decisions
- Reservation capabilities stay extension-local and are never persisted or sent through the Sidebar webview.
- Watchers are invalidation only; the server determines changed, unchanged, or unavailable.
- Directory operations stay behavior-preserving and untracked until recursive capture has its own contract.
- Client rename maps can remain for legacy behavior but are never authoritative for registered external references.
Constraints & Invariants
- The extension never determines externality with lexical path checks.
- No baseline bytes, patches, expected digests, or raw canonical paths enter browser tracking state.
- No active session or invalid capability is untracked, never silently attributed.
- The OpenCode fork remains source of truth and the overlay is synchronized from it.
Prior Art
- Parent Files Changed: full session-lineage mutation ledger #972
- fix(app): trust server session diff for Files Changed panel #720, Slice 1: Contamination fix — derive agent-file filter from tool filediff only #742, Slice 2: External-change reactivity — watcher ungating + client event handler #743, Files Changed: per-session file watcher for reliable external-change refresh #844, and Files Changed: per-session file watcher for reliable external-change refresh #845
- Existing Sidebar operations, chat bridge, and watcher bridge
Source
Part of #972. Blocked by #975.
Notes
This child starts as hitl because the parent review is degraded. Its own deliberate review must pass before implementation begins.
Activity
jeonghun-jj-lee commentedon Sep 10, 2026
Deliberation addendum: mechanical checks are degraded because model critics were unavailable; independent adversarial review found no remaining blocker. The accepted local contract requires rename and move to use one atomic two-endpoint reservation group, snapshots the active session at operation start, and makes commit retry and abort operate on the group identifier. This issue remains hitl pending implementation review.
jeonghun-jj-lee commentedon Sep 11, 2026
Blocked before implementation: the extension pins OpenCode v1.18.29-amicode.30, which does not expose the assessed-detail, external-reference, or reservation-group contract implemented by the draft OpenCode integration branch. The fork must be reviewed, released, and pinned into Amicode before this extension-only slice can be authored and tested without inventing a transport contract. Both attempted worktrees remain clean; no Sidebar behavior has changed.
jeonghun-jj-lee commentedon Sep 11, 2026
Implementation is complete in paired draft PRs: harmoniqs/opencode#336 and #1007. The local coordinated build passed the focused and full extension suites; the issue remains open for HITL review and release/pin promotion.
jeonghun-jj-lee commentedon Sep 14, 2026
Delivered by PR #1007 (merged to main 2026-09-11). Closing to reflect merged state; this unblocks #1080.