feat: recover interrupted installation preparation safely

This commit is contained in:
Codex
2026-10-06 19:02:01 +02:00
parent 5c05778614
commit af6cf88b5a
32 changed files with 497 additions and 37 deletions
@@ -153,6 +153,30 @@ Core admission requires all of the following:
Failure leaves the workspace unavailable to the core. There is no rollback: fix the cause and run
the complete command again.
## Interrupted owner recovery
Current preprocessing runs also hold a kernel writer lock on the shared workspace
volume. Every mutating worker inherits a separate shared kernel lock and validates
an owner generation before starting. Recovery takes both locks exclusively before
rotating that generation: a surviving orphan worker blocks recovery, while a delayed
worker from the old generation cannot start. These guards establish process ownership;
PostgreSQL remains the readiness authority.
A repeated `preprocess run` can mark an orphaned current-protocol Catalog lease as
`preprocessing_interrupted` through the version/fingerprint/run-identity-checked completion
operation, then restart the entire pipeline. It does not resume internal stages or
clear Memory, sessions, curated descriptions or canonical Evidence. Older running jobs
without this ownership protocol are not automatically adopted; inspect their original
owner during upgrade instead of deleting data or resetting leases speculatively.
Each attempt records its unique run identity in PostgreSQL (migration 015). A late
completion from the previous attempt cannot finish its replacement, even when the
metadata revision and input fingerprint are unchanged.
The installer requests this guarded recovery when status remains running. An active
owner returns a conflict and the installer waits. A pending destructive Catalog Sync
Run is preserved for human review, including when its reservation temporarily blocks
binding import. Interrupted synchronization is retried through the existing domain API.
## Administration sidebar
The Administration sidebar exposes the same one-shot operation for the workspace selected in the
+14
View File
@@ -266,6 +266,20 @@ the lock; after a forcibly killed process, confirm that its owner is no longer r
before explicitly removing a stale lock. A different release requires the upgrade
path rather than this command.
If apply is interrupted during synchronization or preprocessing, repeat the same command.
Persisted Catalog runs are read again and pending human decisions remain pending. Active
preprocessing is awaited. If its owner has exited, recovery also checks that no orphan
worker is still running before restarting the complete pipeline. It never clears sessions,
curated Evidence, descriptions or Memory. Do not use `workspace preprocess clear` or volume
deletion as a recovery remedy. Older jobs without the ownership protocol require inspection
during an upgrade.
A changed credential or endpoint invalidates the old plan. Correct the documents, repeat
`validate`, then `plan` with a new filename. If a binding was already imported, apply the
intended correction in Administration too: bootstrap inputs must agree with the Catalog
and never overwrite administrative changes. Other stages reconcile actual Docker/Catalog
state without recreating existing data.
## Advanced source build with the same prepared documents
Source compilation is an explicit choice before planning. It requires a ThothII
+14
View File
@@ -275,6 +275,20 @@ nuovo piano. Ctrl+C rilascia il lock; dopo un arresto forzato del processo verif
che non sia più attivo prima di rimuovere esplicitamente il suo lock residuo.
Un rilascio differente richiede il percorso di aggiornamento, non questo comando.
Se `apply` viene interrotto durante sync o preprocessing, ripetere lo stesso comando.
I run Catalog persistiti vengono riletti; una decisione umana pendente resta pendente.
Il preprocessing in corso viene atteso. Se il suo proprietario è terminato, la ripresa
verifica anche l'assenza di processi figli ancora attivi e riesegue la pipeline completa
con il contratto esistente. Non cancella sessioni, Evidence curate, descrizioni o Memory.
Non usare `workspace preprocess clear` o la cancellazione dei volumi come rimedio.
I vecchi job senza il protocollo di ownership richiedono un'ispezione durante upgrade.
Una credenziale o un endpoint modificato rende il piano vecchio inutilizzabile.
Correggere i documenti e ripetere `validate` e `plan` con un nome di piano nuovo.
Se il binding era già importato, applicare la correzione voluta anche in Amministrazione:
il bootstrap deve corrispondere al Catalog, non sovrascrive modifiche amministrative.
Le altre fasi vengono riconciliate con Docker e Catalog senza ricreare dati già presenti.
## Percorso avanzato da sorgenti con gli stessi documenti
La build è una scelta esplicita precedente alla predisposizione del piano.
@@ -0,0 +1,41 @@
# Installation recovery — T09/#51
The installer retains pending schema review even when a durable synchronization's
reservation blocks binding import. It waits for busy operations, retries interrupted
sync through the domain API and explicitly requests guarded preprocessing recovery.
Preprocessing now uses the existing kernel writer-lock mechanism plus inherited
worker locks and an owner-generation check. A surviving orphan worker prevents
recovery; a delayed worker from an older generation cannot start. Once absence of
writers is established, the Catalog fingerprint/revision/run-identity CAS marks an orphaned
current-protocol run interrupted and the full pipeline can run again. Legacy owners
without this protocol are not silently adopted. Clear operations use the same guard
but are never invoked by installation recovery.
No new Catalog authority or generic reset was added. Existing document seals detect
changed credentials and inputs; corrected documents need a new plan. Imported binding
changes must also be reconciled through Administration, preserving intentional edits.
Source and prebuilt installations share this behavior.
Migration 015 stores the attempt identity so a late completion cannot finish a new
attempt using the same inputs. Ownership is rechecked after asynchronous work before
updating the job. Regression tests kill the real lock holder during semantic preflight
and verify rejection of a stale completion against real PostgreSQL.
Real source installation exposed two additional contract defects: containerd image
stores may identify a locally loaded image by its manifest rather than Buildx's config
digest; unsupported Git ports must fail document validation before runtime startup.
Both now have regression tests. A fresh installation also uses `low` reasoning for
the Pi smoke when neither installation nor saved settings select a level.
Verification includes real kernel-lock/child-process tests, delayed-worker rejection,
service retry after Catalog completion loss, legacy-owner refusal, authenticated route
conflict handling and installation client readiness checks. Full suite results and
published consumer acceptance are recorded after completion, not inferred from mocks.
Validation before publication: the full backend suite and all Go packages passed;
backend typecheck, source-producer tests and the strict documentation build passed.
After aligning the in-memory Catalog test double with the new run identity, the
focused Catalog route/service/identity suite passed (39 tests), as did typecheck.
Standards and Spec reviews found no remaining production blocker. Real consumer
fault-recovery acceptance remains pending at this commit.