Skip to content

fix: close dormant Agent handles before cross-Space move - #218

Merged
Yuqing (mydmdm) merged 2 commits into
mainfrom
fix/issue-212
Sep 20, 2026
Merged

Yuqing (mydmdm) merged 2 commits into
mainfrom
fix/issue-212

Conversation

@mydmdm

Copy link
Copy Markdown
Contributor

Summary

Fixes #212.

  • Close cached dormant Agent handles immediately before rehome, retaining all existing active-invocation, turn-lease, Task ownership, pending-review, and binding restrictions.
  • Keep handle persistence listeners and notification streams attached if driver close fails. For determinate Move failures, rehome completed conversations back before restoring source Agent metadata and removing destination nodes. Do not eagerly reopen closed handles; normal next-invocation recovery remains responsible for that.
  • Preserve ambiguous topology and request-created destinations on unknown outcomes. Return stable redacted Move errors, use allowlisted localized toast messages, and retain bounded phase/error-category/compensation diagnostics.
  • Reuse existing leases, binding checks, trusted Move state, inverse writers, and lazy recovery. Update the matching lifecycle, storage, API, Canvas, and Web contracts.

Control-operation locking is deliberately unchanged. The separately confirmed stale ACP realization race is tracked in #217.

Validation

  • pnpm format, pnpm lint:fix, and repository-level pnpm typecheck passed. Lint reported 276 warnings and no errors; no unrelated formatter/linter changes remain.
  • 246 focused tests passed: 155 server Move/planner/executor/ownership/route tests, 43 Agenetes instance/rehome/notification tests, 10 shared Move-contract tests, and 38 Web modal tests.
  • Coverage includes Disk and SQLite storage, cached internal/external Agents, eligibility refusals, close and target-store failures, multi-thread rollback, metadata preservation, lazy continuation, unknown outcomes, destination cleanup, and redacted HTTP/UI failures. Tests use synthetic data and stub drivers, not live model or ACP sessions.
  • pnpm check:i18n and git diff --check passed. Web tests retain React act-environment warnings. Dependency manifests and lockfile are unchanged.

Commit boundaries

The Agenetes subtree fix and Huabu-only changes are separate commits so the subtree change can be independently propagated upstream. This PR does not change control locking, ordinary undo policy, or introduce a new transaction framework.

Yuqing (mydmdm) and others added 2 commits September 20, 2026 01:44
Close the runtime before detaching persistence listeners and notification streams. Cover failed close, successful retry, final close reports, and rehome recovery.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve existing admission checks, restore durable ownership before Agent nodes during compensation, and recover closed handles lazily. Normalize Move failures into redacted server responses and localized toasts, with storage-backed regression coverage and architecture updates.

Fixes #212. Control-operation locking remains tracked separately in #217.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mydmdm
Yuqing (mydmdm) merged commit 36ea8ea into main Sep 20, 2026
5 checks passed
Yuge Zhang (ultmaster) added a commit to ultmaster/Huabu that referenced this pull request Sep 20, 2026
Reconciles the async Agenetes persistence with two upstream changes.

microsoft#218 made `close()` tear the runtime down before detaching persistence and
notification wiring, so a failed driver teardown can be retried. The async
close keeps that order and drains the thread's queued state writes before
either notification scope ends: a snapshot reported during teardown is the
driver's last word, and the scoped stream now closes with the listener
rather than ahead of the drain.

Its new suites — Agent close retry, close-before-rehome, and the Move
lifecycle cases — await the persistence surfaces they assert on, and the
Move service awaits `close()` and `rehome()` inside the phase boundaries
that map failures onto redacted responses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Close dormant Agent handles before cross-Space thread rehome

1 participant