Files
DeepSeek-Reasonix/internal/taskmonitor
SivanCola 23b5d68ecf Unify session archive, trash and historical recovery / 统一会话归档、回收站与历史恢复 (#10396)
* Unify archived sessions, trash recovery and durable lifecycle identity

Problem: restored sessions could disappear from workspace lists, legacy archive state diverged from canonical membership, and stale runtime aliases could route tasks to a replacement session.

Root cause: directory projections, runtime indexes and migration adoption were independent authorities without a durable lifecycle transaction.

Fix: integrate registry schema 2 with upstream multi-head migration receipts; add idempotent archive/restore/purge commands and deletion tombstones; preserve historical originals and unknown fields; unify trash and historical recovery UI under protocol 10; bind runtime and task ownership to published session identities.

Verification: focused lifecycle, migration, interruption and race regressions passed; frontend 379 suites, typecheck and production build passed. Full post-review Go suites and integrated production package qualification remain in progress and are tracked in the validation document.

* Separate lifecycle owners and validate durable migration inputs

Problem: CI rejected oversized lifecycle owners, while concurrent legacy catalog repair could make a valid archive import fail its source revision check.

Root cause: lifecycle commands and projections accumulated in large entrypoints; stat-only import validation treated identical JSONL rewrites and derived metadata as changed history.

Fix: extract cohesive RPC, validation, sidebar and runtime-control owners without raising lint budgets. Remove superseded migration/deletion helpers. Retain a durable-input digest for sources requiring import, ignore disposable indexes and known derived listing fields, and verify content when a stat stamp changes. Keep workspace, ancestry and unknown metadata fields in validation. Add legacy purge and deterministic source-repair regressions.

Verification: repository lint and both Go lint modules passed; focused migration/archive tests passed including ten repetitions of the original failure; frontend typecheck and trash/recovery tests passed. The first integrated Electron package passed archive/restart/preview/restore/purge/restart; final package will be rebuilt from this revision.

* Refresh desktop inventory after lifecycle owner extraction

Problem: source owner moves and final comment edits changed inventory coordinates.
Root cause: inventory was generated before the last source edits.
Fix: regenerate the classified Desktop inventory from the reviewed tree.
Verification: desktopinventory tests and generation checks pass.

* Keep recovery terminal publication alive through controller close

Problem: race CI caught session-directory writes after controller cleanup, and
the build contract check rejected a current uncommitted contract.

Root cause: recovery completion dropped its live-turn marker before terminal
fanout; the watchdog could finalize resources while another terminal publisher
remained active. The build guard test pinned git syntax rather than behavior.

Fix: retain turn ownership through recovery fanout and explicitly track watchdog
publication. Verify contract guard behavior for unchanged, changed, added,
removed and failed generation. Record qualification evidence and CI assessment.

Verification: the deterministic regression fails before the fix; recovery and
cancellation race tests pass ten repetitions. Root lint, repository lint,
inventory freshness and build contract checks pass. Broad qualification continues.

* Retire archived navigation caches before permanent deletion

Problem: immediately purging an archived session failed while its released
canonical writer remained in the 60-second navigation cache.

Root cause: client detachment intentionally retains idle runtimes, but archive
did not retire them and purge treated every cached runtime as a live client.
The package smoke also accepted async false predicates as completed waits.

Fix: retire archived runtimes through Service.Close, retaining its bound-client
and executing-turn guards. Poll awaited RPC results in both package smoke
scripts and capture registry checkpoints for restart diagnostics.

Verification: both cache regressions fail before the fix and pass afterward;
related lifecycle race tests pass three repetitions. All 29 packaging tests,
Desktop lint, repository lint, build guard and inventory freshness pass.
2026-09-16 18:05:39 +08:00
..