Skip to content

fix(undo-close): a restored parent's live children follow it to its new id - #1374

Merged
Juliusolsson05 merged 1 commit into
integration/batch-2026-09-27-pfrom
fix/undo-close-live-children
Sep 27, 2026
Merged

Juliusolsson05 merged 1 commit into
integration/batch-2026-09-27-pfrom
fix/undo-close-live-children

Conversation

@Juliusolsson05

@Juliusolsson05 Juliusolsson05 commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Fixes #1373.

Plan: docs/plans/2026-09-27-undo-close-live-children.md (first commit).

Problem

Undo Close restores a closed pane under a fresh session id. Its LIVE children (orchestration children and linked panes that stayed open) kept orchestrationParentId / orchestrationRootId / linkedParentId pointing at the dead id. Restore remapped pointers only on the rows it restored, and on the undo stack. The renderer's orchestration visibility gate compares ids for equality, so the restored parent could not list, read or prompt its own surviving children. They also rendered as top-level rows. Replace and Reload Agents already remap every session.

Found by review c of #1369, which carries main's tombstones of CLOSED children on Undo Close. This PR is the live half; the two PRs share no code, only the file.

What merges

  • Both restore commits (a single pane and a project) map every live session through the restore's old→new ids with the existing remapMetaLineage.
  • Why not remapSessionsRelationships: it drops a pointer whose target is not in the record. A child of a different pane that is still closed (still on the undo stack) would then lose its link, and undoing that pane later could not relink it. remapMetaLineage keeps unmapped ids, and returns the same object when nothing changed, so untouched rows keep their identity.

Tests

  • undoCloseLiveChildren.renderer.test.tsx:
    • restoring a pane points its live orchestration child and its linked child at the new id;
    • a child of another still-closed pane keeps its pointer;
    • an untouched row keeps its identity;
    • restoring a project points a live child in ANOTHER project at the members' new ids (parent and root separately).
  • Red check: both tests fail on main, and each is red when either commit site is removed, or when unmapped pointers are dropped.
  • Gates: on d0205863 (main merged), npx tsc -b is clean and the workspace actions suites and lib/undoClose.test.ts pass: 37 files, 260 tests.

Merge order

Merge after #1369. Its Undo Close carry rewrites main's child→parent status hints, which completes this PR's one review residual (a stale hint for up to 250 ms).

Related

🤖 Generated with Claude Code

@Juliusolsson05

Copy link
Copy Markdown
Owner Author

Review disposition (head d0205863). a, b and c (pi) are all MERGE-READY in round 1.

Noted, handled elsewhere

🤖 Generated with Claude Code

Juliusolsson05 added a commit that referenced this pull request Sep 27, 2026
…e the parent can never come back

#1387 review a:
- (major) keeping the pointer only helps if restoring the parent relinks
  it: #1374 is merged in (Depends on #1374) and an end-to-end test closes
  P, reloads its live child, undoes P and asserts the child names P'
  (red without #1374's remap).
- (minor) a kept pointer lingered as a ghost when P's entry left the stack
  without a restore. dropPointersTo drops pointers to exactly those ids
  (never unrelated or cross-window ones) when an entry is consumed as
  stale/failed, expires or is evicted; the stack notifies on a microtask
  because prune can run inside a setState updater. Each path is pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Juliusolsson05
Juliusolsson05 changed the base branch from main to integration/batch-2026-09-27-p September 27, 2026 20:35
@Juliusolsson05
Juliusolsson05 merged commit ee8366c into integration/batch-2026-09-27-p Sep 27, 2026
3 of 4 checks passed
@Juliusolsson05
Juliusolsson05 deleted the fix/undo-close-live-children branch September 27, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

class:C2-identity Identity/ownership across reload, replace, restore, wake sev:P3 Minor type:bug Something works wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(undo-close): a restored parent's live orchestration children keep the dead parent id

1 participant