Skip to content

memory: recover stale Wiki and project construction plans - #3291

Merged
Hillary Mutisya (hillary-mutisya) merged 2 commits into
mainfrom
dev/hillarym/wiki-scoped-plan-recovery
Nov 18, 2026
Merged

Hillary Mutisya (hillary-mutisya) merged 2 commits into
mainfrom
dev/hillarym/wiki-scoped-plan-recovery

Conversation

@hillary-mutisya

Copy link
Copy Markdown
Contributor

Summary

  • Replace whole-family/whole-View freshness rejection during Wiki and project construction planning with dependency-scoped validation.
  • Preserve unrelated descriptor and cursor updates instead of overwriting them; retain candidates and pages when real dependency changes require replanning.
  • Persist bounded deferred recovery across restart, with focused offline regression coverage.

Motivation

An unrelated page addition or revision currently invalidates a prepared informational construction plan because the guard compares the entire family and every View revision. Useful prepared work should survive unrelated maintenance. Actual target, coverage/canonical, separation, source-revision and construction-authorization changes must still prevent stale admission or overwrites.

Behavior and compatibility

  • Track inspected/changed descriptors, consulted page revisions, nominated coverage/canonical context, separation relationships and original source inputs, including retained decisions that select no build.
  • Recheck original inputs and construction authorization immediately before admission. Preserve existing build and publication checks.
  • Merge concurrent unrelated family progress and descriptor updates; leave the family dirty for another bounded pass.
  • On genuine planning conflicts, retain existing pages, proposals, candidate identities and unprocessed discovery progress. Return visible blocked/deferred plan targets rather than recording a permanent technical rejection.
  • Resume through the existing 30-second reconciliation wave, not an immediate retry loop. After three consecutive dependency conflicts in one source-index generation, stop automatic retries with an explicit-maintenance-required error. Explicit maintenance or a changed source-index generation resets the streak.
  • A concurrent pause remains authoritative. Successful recovery does not erase unrelated target failures.

The optional persisted planningConflict state is additive; no migration is required. Existing automatic-pass and candidate-read budgets remain in force. Choice-only Luna, evidence-grounded maintenance, admission/editorial policy and publication authority are unchanged. This PR does not introduce native Decision1, arbitration, Inbox or partial-retention policies.

Reviewer guide

  1. Service planning and admission: capture and validate consulted dependencies, merge unrelated progress, defer safely.
  2. Durable family state and maintenance scheduling: bounded recovery, restart persistence and failure isolation.
  3. Recovery regressions: unrelated writes; changed targets/descriptors/sources/authorization; consulted coverage and separation changes; final admission freshness; bounded retries; restart and explicit recovery.
  4. Operator behavior.

Validation

Local Windows validation at 775c6a6d4354cb4fee373e835ef5279522b1bac6, based on 79205019103b2f18e9b7388ad7b57d699ae4a9f1:

Check Command / evidence Result
Full workspace build pnpm run build from ts PASS
Offline memory regressions Command below PASS: 10 suites, 265 tests, including 15 recovery tests
Pinned formatting pnpm exec prettier --check on all seven changed files PASS
Lint ratchet pnpm run code-lint -- --ratchet --base origin/main PASS: zero new violations
Complexity ratchet pnpm run code-complexity -- --ratchet --base origin/main --cyclomatic 25 --cognitive 30 --new-file-cyclomatic 25 --new-file-cognitive 30 PASS
Circular ratchet pnpm run code-circular -- --ratchet --base origin/main --exceptions-file tools/scripts/code/circular-baseline-exception.json PASS: no new cycles
Debt gate pnpm run code-debt -- --gate --base origin/main PASS
Patch whitespace git diff --check PASS

From ts/packages/memory/service:

pnpm run jest-esm --runInBand --runTestsByPath `
  dist/test/wikiPlanningRecovery.spec.js `
  dist/test/wikiAdmission.spec.js `
  dist/test/wikiContribution.spec.js `
  dist/test/wikiConsolidation.spec.js `
  dist/test/informationalWiki.spec.js `
  dist/test/viewMaintenance.spec.js `
  dist/test/viewEditorial.spec.js `
  dist/test/maintenanceScheduler.spec.js `
  dist/test/knowledgeLifecycle.spec.js `
  dist/test/viewStore.spec.js

The first local circular scan lacked Git LFS in its process PATH. Rerunning with the existing portable dependency available passed, without bypassing hooks or changing the gate.

Fixtures and synthesis are deterministic/offline. No live model or whole-pipeline latency/quality qualification is claimed. CI results are separate from local validation.

Risks and rollback

Freshness now depends on complete dependency capture rather than a blanket global hash. The regression matrix covers selected and no-build paths; existing output/publication validation remains a separate guard. Repeated genuine churn intentionally pauses automatic retries after the bound and requires explicit maintenance or a new source-index generation.

Rollback is a revert of this policy change. No automatic publication, model change or data deletion is introduced.

Retain useful construction work across unrelated page and maintenance-progress changes. Revalidate consulted pages, relationships and exact source access before admission, and defer genuine dependency conflicts with durable bounded recovery instead of terminal rejection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the confirmed service forget API rather than purging the store behind a live service. This serializes the privacy rewrite with background segment collection and preserves fail-closed quarantine checks. Verify source and separated-child deletion after closing and reopening the service.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hillary-mutisya

Hillary Mutisya (hillary-mutisya) commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Fixed the failing Windows Node 24 test in 04ad59b.

The separation lifecycle test directly purged TypedViewStore while its live service could still run background segment collection. That bypassed the corpus write queue and intermittently exposed the deliberately quarantined history to maintenance. The test now obtains confirmation and calls the public service source-forget API, which serializes the purge. It also closes/reopens the service and verifies the source and separated children remain deleted. No production privacy guard, test threshold, skip or workflow was changed.

Validation on the pushed tree:

  • Full workspace build passed.
  • 38 offline suites / 648 tests passed, including every suite from the failed CI group and the scoped-recovery/privacy regressions.
  • The corrected lifecycle passed three additional repeated runs.
  • Changed-file pinned formatting and all four whole-branch quality gates against origin/main passed.

CI status after the bounded observation window on the pushed head:

  • The previously failing Windows Node 24 test group 4 now passes.
  • 95 checks passed, 3 skipped, and none failed in the final snapshot.
  • Still pending: macOS Node 24 root tests; Windows Shell/CLI smoke tests; and the aggregate TypeAgent Smoke Tests check (required).

No review threads are outstanding; human review is still required. Monitoring has ended. The PR is not being declared fully CI-green or merged.

@hillary-mutisya
Hillary Mutisya (hillary-mutisya) merged commit 4f2d364 into main Nov 18, 2026
109 checks passed
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.

1 participant