Skip to content

Restore parent-session Files Changed invalidation #1466

Closed

Description

@jeonghun-jj-lee

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 task tool part records its { parentSessionId, sessionId } relation before the child’s file-edit event arrives.
  • A completed child edit, write, patch, or apply_patch event carrying a file diff and delivered through the live server listener increments the child and every recorded task-spawn ancestor diff-version in ServerSession.
  • For root --session_spawn--> tab --task_spawn--> worker, a completed worker edit increments worker and tab exactly once, leaves root unchanged, and changes the viewed parent query key from busy:0 to busy:1 before any parent idle event.
  • A child with only generic session parentage increments only its own diff version.
  • Directory data.diff_version and set("diff_version", ...) both address the ServerSession record; 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; ServerSession eviction 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 ServerSession diff 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.listen route 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 ServerSession eviction 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=1 packaging fixture: all replacement protections stage with a recorded advisory; omission of each replacement protection fails before staging, names KNOWN-FIX MISSING and #832, emits no advisory, and leaves both staged artifacts absent.

Key Decisions

  • ServerSession owns 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

Prior Art

  • The task-spawn Files Changed rollout and parent invalidation repair.
  • The current session cache contract and production event-routing tests.

Source

Metadata

Metadata

Labels

hitlNeeds human review before merge

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions