LearnNewsExamplesServices
Frontmatter
id18522
titleWait for asynchronous dock drops before source cleanup
stateClosed
labels
bugaitestingcoredashboard
assigneesneo-gpt
createdAtSep 9, 2026, 4:55 AM
updatedAtSep 9, 2026, 11:20 AM
githubUrlhttps://github.com/neomjs/neo/issues/18522
authorneo-gpt
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[x] 18516 Demo B''s cross-window participation has no drag embodiment owner, so target staging refuses before previewFor
closedAtSep 9, 2026, 11:20 AM

Wait for asynchronous dock drops before source cleanup

Closed v13.2.0/archive-v13-2-0-chunk-20 bugaitestingcoredashboard
neo-gpt
neo-gpt commented on Sep 9, 2026, 4:55 AM

Context

While repairing Demo B's missing proxy embodiment under #18516, the target began producing a ready preview and accepting the transfer. The source nevertheless emitted cancellation and cleaned itself up before the asynchronous target answered. The consumer ticket explicitly excludes engine changes; this is its bounded engine prerequisite.

The Problem

At dev 335b2ca43a5ec54c823563745c276c3881e05416, an exact-source probe of DragCoordinator.onDragEnd and TabSortZone.processDragEnd, with a deferred successful target and neutral base cleanup, records:

Before target settlement:
reset → dockTearOutCancel → dockVesselConversionRetired → base-cleanup → reset
After target settlement:
remote-out
remoteDropCommitted after cleanup: true

The coordinator attaches a callback but does not return its promise. The dock caller therefore reads remoteDropCommitted before it can become true, chooses the refusal path, and may retire the converted vessel. This is independently reproduced from unchanged engine methods; it is not inferred solely from a browser timeout. The browser investigation and phase receipts are linked in the consumer diagnosis.

Historical repair #15248 / #15326 correctly made source retirement depend on the target's outcome and preserved same-stack synchronous behavior. Its documented assumption that asynchronous source cleanup has no immediate outcome reader no longer holds in the dock conversion path. This successor preserves that outcome contract and carries completion to the reader.

The Architectural Reality

  • src/manager/DragCoordinator.mjs:onDragEnd owns remote target arbitration, invokes onRemoteDrop, and calls the source's onRemoteDropOut only after commitment. It remains dock-blind.
  • src/dashboard/dock/interaction/TabSortZone.mjs:processDragEnd owns dock terminal selection in both ordinary pane and whole-stack paths.
  • src/draggable/container/SortZone.mjs:onDragEnd already holds dragEndActive across asynchronous processing; the dock start path already refuses while that latch is active.
  • src/core/Base.mjs owns destruction and asynchronous cancellation through isDestroyed and trap. Destruction removes writable instance properties, so an unconditional asynchronous finally must not recreate them.

The Fix

Return asynchronous target completion from the coordinator and conditionally await it at the dock terminal decision. Preserve the synchronous path on the same call stack. Use the existing source latch and Base lifecycle for pending/destroyed sources; do not introduce a second gesture tracker.

Keep coordinator arbitration cleanup synchronous. A delayed completion must not clear a later gesture's active target. Capture the source/item for the accepted call, suppress late source callbacks after destruction, and preserve target rejection. Guard the existing base latch cleanup against instance destruction.

Extend the existing manager and dock unit specs with deferred outcomes and lifecycle controls. No new module is needed.

Contract Ledger

Target surface Source of authority Proposed behavior Fallback Docs Evidence
DragCoordinator.onDragEnd Target onRemoteDrop outcome; existing #15248 contract Synchronous result retires the source synchronously; asynchronous completion is returned and retires only on a committed result while source remains alive Null/false/rejection never calls remote-out; rejection remains observable Method JSDoc Deferred success/null/rejection and same-stack controls in existing manager spec
TabSortZone.processDragEnd, ordinary and stack branches Coordinator completion and source remoteDropCommitted Wait before selecting the terminal or starting source cleanup when target is asynchronous Refused/cancelled paths remain zero-remote-out; failed commit propagates after applicable cleanup Method JSDoc Pending state, exact-once terminal, stack and ordinary controls
SortZone.onDragEnd latch Existing dragEndActive and Base destruction Duplicate end and new dock start stay excluded while completion is pending; destroyed instances gain no late state Destruction suppresses source callbacks and follows existing Base cancellation semantics Existing latch JSDoc Real Neo-instance destruction and pending-start controls
Coordinator active gesture state Existing synchronous terminal cleanup Older completion cannot erase a newer active target No new epoch/cache or deferred global reset Coordinator JSDoc Interleaved-source control

Decision Record impact

Aligned with ADR 0029's outcome-before-source-retirement boundary. No new semantic authority or change to Group transactions, preview eligibility, or native-window policy.

Acceptance Criteria

  • A deferred target leaves the dock source pending: no cancellation, vessel retirement, local commit, committed terminal, or base cleanup before settlement.
  • Successful settlement produces exactly one source remote-out and the committed terminal; null/false and rejected settlements produce no remote-out. Rejection remains observable.
  • Ordinary and stack paths obey the same completion boundary. Existing synchronous outcomes still notify the source on the initiating call stack.
  • Duplicate end/new dock start cannot overlap a pending source end. Destruction causes no late source callback, lifecycle event, or recreated instance field.
  • A prior target's completion cannot clear a different source's newer coordinator state.
  • Focused existing manager/dock unit suites pass with discriminating deferred controls, including a recorded failing control before the repair. The headed Demo B adoption remains acceptance work of #18516 after this prerequisite.

Out of Scope

Demo B embodiment wiring, receipt/projection ordering and mount witnesses; broad drag architecture or cleanup refactors; new coordination state; changing target commit semantics; KB ingestion.

Avoided Traps

  • Making the coordinator unconditionally async moves synchronous retirement past its existing reader.
  • Deferring all coordinator cleanup until settlement lets an old gesture erase a newer one.
  • Increasing browser waits or mount-count allowances does not repair premature cancellation.
  • Reopening the completed predecessor conflates the earlier null-outcome repair with this newly reachable completion reader.

Related and Retrieval

Related: #18516, #18303, #15239, #15248, #15326.

Live latest-open sweep: checked latest 20 open Engine issues and latest 30 all-state A2A messages at 2026-09-09 02:54 UTC; no equivalent issue or competing core claim. Own-assignment sweep read same-surface #18516 and #18303; neither owns this bounded core completion repair. Memory rationale queries remoteDropCommitted async target source cancellation and DragCoordinator onDragEnd Promise retirement, KB and all-state issue searches found the completed predecessor and the current consumer lane, not an open duplicate. Agent OS structure map: N/A, existing Engine methods/tests only.

Retrieval hints: commits fe43b812144, 8c5c7915be1, 89c69ccf487; local exact-source probe /private/tmp/18516-async-terminal-probe.cjs; memory d5282168-2a26-40a9-97f2-44ffc9e183b8.

Origin Session ID: 4f9b7bbe-9dbc-4d36-a167-38fe0d288113