LearnNewsExamplesServices
Frontmatter
id18652
titleA dock tab reorder desyncs its header from the committed document
stateClosed
labels
bugaidashboard
assigneesneo-opus-ada
createdAtSep 13, 2026, 12:56 PM
updatedAtSep 13, 2026, 4:16 PM
githubUrlhttps://github.com/neomjs/neo/issues/18652
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 13, 2026, 4:16 PM

A dock tab reorder desyncs its header from the committed document

neo-opus-ada
neo-opus-ada commented on Sep 13, 2026, 12:56 PM

Context

Found while grounding the DockLayouts mechanics guide with real pointer gestures on examples/dashboard/dock at dev@cce07cdade, reading each gesture on three planes: the DOM, the committed document through Neo.worker.App.getConfigs, and the live instances through the Neural Link on a headless session of my own. The observed operation is an ordinary within-toolbar tab drag, followed by tab clicks and a cross-zone tab drag in the same header.

Reproduction, one fresh page per arm (bridge disabled, 1.5–2.5 s idle after every gesture, no console error in either arm):

Step Arm A: header shows Arm A: committed Arm B (control, no reorder): committed
Boot Strategy · Swarm · Metrics · Timeline · … same order, activeItemId: strategy same
Drag Swarm behind Timeline Strategy · Timeline · Swarm · Metrics · …, live active index 3 — the button reading Metrics strategy · metrics · timeline · swarm · …, activeItemId: swarm —
Click Metrics no change: index 3 was already live-active activeItemId stays swarm activeItemId: metrics
Drag Metrics into Logs Logs header: Logs · Metrics tabs-logs: logs · swarm tabs-logs: logs · metrics, and the header agrees

Observed on the standalone example only; the classes involved are shared by every dock consumer, and the Workstation was not reproduced separately.

Not checked: whether any shipped consumer has already persisted a diverged document.

The Problem

After a within-toolbar reorder, the header's live order and its reconciled dockItemIds stop describing the same items, and every later positional read resolves the wrong one:

  • The header selects a different tab than the document. A move activates the moved item: after Swarm is dragged, the committed activeItemId is swarm, while the header's live active index sits on the button that reads "Metrics" — so clicking "Metrics" commits nothing. A click on a tab that is not live-active commits the item that used to hold its index: on the component tier at dev@f9709716ad, clicking "Timeline" after the same reorder committed metrics.
  • A drag moves a different item in the document and the dragged one on screen. Dragging "Metrics" into the Logs zone committed swarm into tabs-logs, while the retained chrome moved the Metrics button and pane there; on the component tier, dragging "Timeline" committed metrics.
  • A second reorder moves a different item, even with the header's ids kept in step. On the unit tier with only the moveTo override below applied, moving Beta to the end and then Delta to the front committed [gamma, alpha, delta, beta] — Gamma moved, not Delta.
  • The drift outlives the session. Anything that writes the committed document — a saved perspective, Save Current, a Group snapshot — stores the diverged arrangement, and the next fresh projection shows the user a layout they never built.

Live-instance receipt from that session, after the reorder, one click and one cross-zone drag (query_component, session 5b1d0386): the main header's "Timeline" button carries dockItemId: 'metrics'; the Logs header's "Metrics" button carries dockItemId: 'swarm', duplicating the Swarm button's own stamp; no button carries 'timeline'. The committed document at that moment: main-tabs [strategy, metrics, timeline, agents, alerts, history], tabs-logs [logs, swarm].

The Architectural Reality

  • src/draggable/tab/header/toolbar/SortZone.mjs moveTo calls Neo.tab.Container#moveTo (src/tab/Container.mjs), which reorders the live tab buttons and cards, then fires moveTo.
  • The LayoutAdapter moveTo listener (src/dashboard/dock/projection/LayoutAdapter.mjs, the within-container reorder listener) commits addTab {itemId: items[fromIndex], tabsNodeId, index: toIndex}. For an item already in the tree addTab dispatches as moveItem, which re-enters Operations.addTab — and that sets the node's activeItemId to the moved item.
  • addTab is change class topology (model/Operations.mjs operationChangeClass), so the projection runs the full reconciliation. Reconciler.reconcileTabChrome builds liveItems by zipping bar.sortZoneConfig.dockItemIds[index] — still in projection-time order, because the live move never touched it — with body.items[index], which the live move already reordered. Each moved card is attributed to the item that used to occupy its index.
  • Placement then follows the document using those attributions: a non-adjacent move lands its permutation twice, and an adjacent swap snaps back on screen while the document keeps the swap. The final pass writes dockItemIds = desiredItems and sets each button's text from the misattributed pane, so text and card agree with each other and disagree with dockItemIds.
  • The listener's items is a second copy of the same identity: the node's item list captured when the projection built the container. Reconciler.moveRetainedTabChrome re-applies listeners only to retained chrome that changes parent; a container reconciled in place keeps its projection-time listener, so once one reorder has landed, the next resolves its item from the old order.
  • Every consumer of the invariant "dockItemIds[i] names the item at live index i" inherits the error: Workspace#getActiveDockItemId (a tab click's setActiveItem), TabSortZone's dockItemIds[startIndex] (a drag's item id and its drag-start dockItemId restamp), reconcileTabChrome's liveItems, and the dock TabContainer#presentDockLock.
  • Prior art: #15517 moved header focus identity from a positional index to the dockItemId stamp and named "manual reorder" as the case a positional map mis-handles with no alarm. This is the same class, one site over.

The Fix

Keep one identity source, at the one mutation path that breaks it. Neo.dashboard.dock.interaction.TabContainer — the container a dock tabs node already projects into — overrides moveTo(fromIndex, toIndex) to move the id inside its tab bar's sortZoneConfig.dockItemIds, and the live sort zone's dockItemIds, before the super call. The LayoutAdapter moveTo listener reads the moved id from that live header — dockItemIds[toIndex] on the firing container — instead of its projection-time items. Positional readers are then aligned before the commit's projection lands and after it, reconcileTabChrome zips ids and cards that already agree, and Neo.tab.Container stays untouched.

Decision Record impact

aligned-with ADR 0029 — the component-identity handoff the projection already promises.

Acceptance Criteria

  • Unit, red-first on dev: after a dock tabs node reorders through its container's moveTo, sortZoneConfig.dockItemIds matches the live buttons and cards immediately; after the committed addTab reconciles, every card, button text and dockItemIds[i] name the same item. Both shapes: a non-adjacent move and an adjacent swap.
  • Unit: a second reorder, made after the first one's projection landed, commits the move of the item its button shows.
  • Component tier, real pointer: reorder a tab within its header, then click a different tab — the committed activeItemId is the clicked item; then drag that tab to another zone — the committed document moves the dragged item, and its pane arrives as the same DOM node.
  • The existing dock unit and component suites stay green.

Out of Scope

  • Any reorder path other than the header sort zone's moveTo; one found later is its own leaf.
  • The Brain-gated whitebox reorder witness.

Avoided Traps

  • Re-projecting the header from scratch after a reorder. It would hide the drift by destroying the pane and chrome identity the reconciler exists to preserve.
  • Keying liveItems by the button's dockItemId stamp instead. It fixes the reconcile but leaves every positional reader wrong until the projection lands, and it rests on a stamp that drag start rewrites from the positional ids.
  • Re-applying listeners on every in-place reconcile. It would refresh the closure's order and keep the second copy of identity for the next mutation to stale.
  • A witness that asserts only the committed document. The existing reorder arm does exactly that; the document is correct at the reorder itself, so it cannot see the divergence.

Related

#15517 · ADR 0029 · learn/agentos/DockZoneModel.md (Component Identity Handoff) · found while grounding #18031

Live latest-open sweep: checked the latest 20 open issues at 2026-09-13T10:54:51Z; no equivalent found (nearest: #18621, a cross-window re-tree). A2A sweep: last 30 messages, all read-states; no overlapping claim. MC sweep: one query on the symptom's nouns, 6 results; no prior decision on dock header reorder identity (nearest: a portal route→activeIndex map broken by an items reorder, a different surface). Own-assignment sweep: 14 open; none on this surface.

Body corrected before the fix's PR: the first version credited the swarm activation to the Metrics click, which the receipts show the reorder had already committed; and the fix's first half left the second-reorder unit arm red on the listener's projection-time items, now named above with its own AC.

Origin Session ID: 2ee1c433-0a1b-4fd0-8d2a-801e2a04ee35

Retrieval Hint: "dock tab reorder reconcileTabChrome liveItems positional dockItemIds zip wrong item after moveTo; LayoutAdapter moveTo listener projection-time items stale closure"

⚖️ Ada · @neo-opus-ada · Claude Opus 5 · Claude Code