Repository navigation
Description
Restore parent-session Files Changed invalidation
Important
Problem — Completed file edits in a task-spawned child session do not reliably refresh the viewed parent session’s Files Changed surface. The current event path and cache shape disagree about diff-version ownership.
Approach — Make ServerSession the sole owner of initialized diff-version state and task-spawn ancestry recorded from task tool metadata. The live server listener increments the child and each recorded task-spawn ancestor when a completed file-edit event carries a file diff; directory-scoped state reads and writes that shared record.
Scope — In: live child-to-parent invalidation, cache eviction coherence, production event-route coverage, and migration of the recorded #832 known-fix contract to the new shared ownership boundary. Out: unrelated touched-files behavior, Fleet v2 tab provenance, and PR #1360’s broader cache rewrite.
Assumptions — A completed file-edit event with a file diff is the authoritative mutation boundary for a live refresh. Generic session parentage is not task-spawn provenance.
Acceptance Criteria
- A
tasktool part records its{ parentSessionId, sessionId }relation before the child’s file-edit event arrives. - A completed child
edit,write,patch, orapply_patchevent carrying a file diff and delivered through the live server listener increments the child and every recorded task-spawn ancestor diff-version inServerSession. - For
root --session_spawn--> tab --task_spawn--> worker, a completed worker edit incrementsworkerandtabexactly once, leavesrootunchanged, and changes the viewed parent query key frombusy:0tobusy:1before any parent idle event. - A child with only generic session parentage increments only its own diff version.
- Directory
data.diff_versionandset("diff_version", ...)both address theServerSessionrecord; the directory cache has no independent diff-version map. - Directory trimming and deletion do not access a diff-version field absent from the directory cache shape;
ServerSessioneviction removes the evicted session’s shared version entry without error. - The recorded chore: fix pre-existing main breakages blocking clean overlay composition (#821) #832 known-fix contract replaces the obsolete directory-cache evidence with identical shared-state evidence in both the machine registry and its human-facing fixture list: initialized
ServerSessiondiff versions, task-spawn ancestor invalidation, and shared eviction cleanup. It rejects omission of any required shared protection or restoration of a directory-owned diff-version copy.
Testing Decisions
- Extend the real
serverSDK.event.listenroute with a task tool relation, a child file-edit event, and a busy parent. - Extend the Files Changed query test so the parent refresh occurs before its idle status event.
- Exercise directory trimming/deletion against a cache shape with no diff-version map and
ServerSessioneviction against the complete shared state. - Preserve reducer-unit coverage, but do not treat it as sufficient proof of the production route.
- Exercise the shared known-fix registry and its human-facing contract in both positive and negative forms, then run the packaging build path that consumes the registry.
- Extend the Enforce known fixes during CI packaging #1469 diverged-
CI=1packaging fixture: all replacement protections stage with a recorded advisory; omission of each replacement protection fails before staging, namesKNOWN-FIX MISSINGand#832, emits no advisory, and leaves both staged artifacts absent.
Key Decisions
ServerSessionowns diff-version initialization, mutation, task-spawn ancestry, and shared eviction.- Only task tool metadata authorizes parent invalidation; generic
parentID, filesystem observation, and status transitions do not. - This slice must land before PR fix(app): the switch-latency arc — mount, mirror, warm, probes + snapshot-first boot (#1306) #1360 is rebased or reconsidered.
- A known-fix contract protects the current canonical behavior and ownership boundary; it must not fossilize superseded internal storage syntax.
Constraints & Invariants
- Do not remove diff-version state or cast around a missing cache field.
- Do not use parent status transitions, polling, or filesystem watchers as the primary live-refresh mechanism.
- Do not modify Fleet v2 provenance behavior.
- Do not weaken known-fix enforcement, suppress the packaging guard, or widen Enforce known fixes during CI packaging #1469; migrate only the chore: fix pre-existing main breakages blocking clean overlay composition (#821) #832 evidence from obsolete directory-cache syntax to the verified shared-state behavior.
Prior Art
- The task-spawn Files Changed rollout and parent invalidation repair.
- The current session cache contract and production event-routing tests.
Activity
fix(app): #1466 restore parent Files Changed invalidation
test(app): cover all #1466 file edit events
fix(app): repair #1466 review findings
fix: recover session reliability regressions (#1472)
Reconcile feature/free-tier-fleet with main (+ instruction.test.ts $T…