Preserve terminal coverage authority across restarts

This commit is contained in:
Meta Vens 2026-07-19 06:48:24 +01:00
commit 519574ce0d
5 changed files with 99 additions and 42 deletions

View file

@ -2817,16 +2817,13 @@ pub(crate) fn publish_workspace_coverage_terminal_sight(
let terminal = crate::workspace_coverage_projector::authenticate_current_workspace_coverage_terminal_authority_with_store(
runtime_store, &coverage.store,
)?.ok_or_else(|| anyhow!("owned workspace coverage has no current terminal authority"))?;
if terminal.managed_process_launch_id != launch_id {
bail!("terminal sight launch disagrees with terminal coverage authority");
}
if let Some(existing) = authenticate_current_workspace_coverage_terminal_sight(
runtime_store,
local_verse_store,
runtime_id,
trusted_host,
)? {
if existing.launch_id == launch_id
if existing.launch_id == terminal.managed_process_launch_id
&& existing.claim_id == terminal.claim_id
&& existing.claim_epoch == terminal.claim_epoch
&& existing.plan_id == terminal.plan_id
@ -2836,6 +2833,9 @@ pub(crate) fn publish_workspace_coverage_terminal_sight(
}
bail!("current terminal sight disagrees with owned terminal authority");
}
if terminal.managed_process_launch_id != launch_id {
bail!("terminal sight launch disagrees with terminal coverage authority");
}
let opening = coverage.store.pull_all()?;
let receipt_env = opening
.iter()
@ -3899,6 +3899,28 @@ mod tests {
_ => bail!("reopened exact executor did not resume claim"),
};
crate::workspace_coverage_projector::commit_workspace_coverage_success(&resumed, observed)?;
let terminal_sight = publish_workspace_coverage_terminal_sight(
&verse,
&runtime,
&reopened,
"local",
&launch.launch_id,
host.entry(),
&provider,
chrono::Utc::now(),
)?;
let historical_sight = publish_workspace_coverage_terminal_sight(
&verse,
&runtime,
&reopened,
"local",
&Uuid::new_v4().to_string(),
host.entry(),
&provider_key(),
chrono::Utc::now(),
)?;
assert_eq!(historical_sight, terminal_sight);
assert_eq!(historical_sight.launch_id, launch.launch_id);
assert_eq!(std::fs::read(&body_store)?, body_before);
assert!(reopened.store.pull_all()?.iter().all(|entry| !matches!(
entry.r#type.as_str(),

View file

@ -220,40 +220,6 @@ impl WorkspaceCoverageProjectorServiceBody {
let authority = self.execution_authority.as_ref().ok_or_else(|| {
anyhow!("workspace coverage projector has no installed execution authority")
})?;
if let Some(directive) = authenticate_workspace_coverage_recovery_directive(
&authority.local_verse_store,
&self.runtime_store,
&authority.runtime_id,
&self.managed_process_launch_id,
&authority.trusted_host,
)?
{
let basis = load_current_runtime_repository_body_basis(&self.runtime_store)?;
if directive.workspace_id != basis.workspace_id
|| directive.body_binding_sha256 != basis.body_binding_sha256
|| directive.body_observation_id != basis.observation_id
|| directive.body_generation != basis.generation
|| directive.manifest_root_sha256 != basis.manifest_root_sha256
|| directive.coverage_store_binding_id
!= self.coverage_authority.store_binding.binding_id
|| directive.coverage_store_binding_envelope_digest
!= self.coverage_authority.store_binding_envelope_sha256
|| directive.coverage_store_file_identity
!= self.coverage_authority.store_binding.store_file_identity
|| directive.runtime_coverage_route_envelope_digest
!= self
.coverage_authority
.runtime_coverage_route_envelope_sha256
{
bail!("workspace coverage recovery directive disagrees with held authority");
}
crate::workspace_coverage_projector::recover_workspace_coverage_projection_with_authority(
&self.coverage_authority, &self.runtime_store, &authority.local_verse_store,
&authority.runtime_id, &authority.trusted_host, &directive.old_launch_id,
&directive.replacement_launch_id, &directive.replacement_ready_heartbeat_id,
&directive.old_claim_id,
)?;
}
// Retirement is derived from typed Body history and is deliberately
// performed before the idle fast path. Qdrant never nominates its own
// garbage and incompatible same-name collections stop the pulse.
@ -296,6 +262,43 @@ impl WorkspaceCoverageProjectorServiceBody {
fault: None,
});
}
// A durable terminal projection outranks process recovery. Its signed
// historical sight remains valid across managed-policy rotation; a new
// daemon observes that fact but does not take ownership of the old
// succeeded claim. Recovery still precedes all nonterminal claim work.
if let Some(directive) = authenticate_workspace_coverage_recovery_directive(
&authority.local_verse_store,
&self.runtime_store,
&authority.runtime_id,
&self.managed_process_launch_id,
&authority.trusted_host,
)?
{
if directive.workspace_id != basis.workspace_id
|| directive.body_binding_sha256 != basis.body_binding_sha256
|| directive.body_observation_id != basis.observation_id
|| directive.body_generation != basis.generation
|| directive.manifest_root_sha256 != basis.manifest_root_sha256
|| directive.coverage_store_binding_id
!= self.coverage_authority.store_binding.binding_id
|| directive.coverage_store_binding_envelope_digest
!= self.coverage_authority.store_binding_envelope_sha256
|| directive.coverage_store_file_identity
!= self.coverage_authority.store_binding.store_file_identity
|| directive.runtime_coverage_route_envelope_digest
!= self
.coverage_authority
.runtime_coverage_route_envelope_sha256
{
bail!("workspace coverage recovery directive disagrees with held authority");
}
crate::workspace_coverage_projector::recover_workspace_coverage_projection_with_authority(
&self.coverage_authority, &self.runtime_store, &authority.local_verse_store,
&authority.runtime_id, &authority.trusted_host, &directive.old_launch_id,
&directive.replacement_launch_id, &directive.replacement_ready_heartbeat_id,
&directive.old_claim_id,
)?;
}
let body = RepositoryBodyReadSession::open(&self.runtime_store, &basis)?;
let prepared = prepare_workspace_coverage_projection(
&body,
@ -416,7 +419,7 @@ mod tests {
}
#[test]
fn recovery_directive_is_consumed_before_normal_projection_work() {
fn terminal_authority_precedes_recovery_and_recovery_precedes_new_work() {
let source = include_str!("workspace_coverage_projector_service.rs");
let start = source.find("fn pulse_inner(&mut self)").unwrap();
let tail = &source[start..];
@ -427,10 +430,16 @@ mod tests {
let recovery = body
.find("recover_workspace_coverage_projection_with_authority")
.unwrap();
let normal = body
let retirement = body
.find("retire_workspace_coverage_collections")
.unwrap();
assert!(directive < recovery && recovery < normal);
let classification = body
.find("classify_current_workspace_coverage")
.unwrap();
let new_work = body.find("RepositoryBodyReadSession::open").unwrap();
assert!(retirement < classification);
assert!(classification < directive && directive < recovery);
assert!(recovery < new_work);
assert!(!body.contains("authenticate_current_workspace_coverage_claim_sight"));
}

View file

@ -2964,3 +2964,29 @@ creation token, and executable. Exact token and executable substitution still
refuse. Focused process-observation and resident-readiness suites pass. Replace
the braked, unadmitted `c9e9a352` transaction through Idunn after committing
this cut; do not reinterpret the current candidate as deployed.
Candidate `5e298e637d3470828fec3b26feeaa550a0ad91f9` proved resident readiness and
the installed operator check healthy under the `epiphany` runtime identity,
with all three services stable and the all-scope brake engaged. Idunn still
withheld final admission because workspace coverage had already terminalized
under a historical managed launch, while the restarted projector obeyed a
stale recovery directive before recognizing that durable terminal authority.
It first rejected the new launch as the owner of the old terminal receipt and
then refused to recover the already-succeeded claim.
Terminal coverage authority belongs to the succeeded claim and its historical
managed launch. A later daemon may authenticate and reuse the immutable signed
terminal sight, but cannot rewrite it or inherit the receipt. Projector pulse
now classifies current terminal coverage and republishes that historical sight
before considering process-recovery pressure; recovery still precedes every
nonterminal acquisition or claim path. The real checkpoint-to-terminal fixture
proves a different later launch receives the original sight byte-for-byte, and
the service ordering proof fixes terminal classification before recovery and
recovery before new Body work.
Next action: commit and push this successor, revoke exact candidate `5e298e63`,
terminate only Idunn transaction PGID `1485835`, and verify the installed
signal-safe rollback boundary. Then authorize and deploy the exact successor
through Bifrost and Idunn under brake. Require historical terminal-sight reuse,
three stable services, typed resident readiness, signed aggregate health, and
`deployment.env` before beginning the ordinary organizational product loop.

Binary file not shown.

View file

@ -796,4 +796,4 @@ current_status:
- Candidate `b8517d9d7905eb62314db675cc2f0688510aa5bd` proved stale launch terminalization and current-policy replacement launch: supervisor PID `1147968` launched replacement workspace projector PID `1148157`, whose authenticated ready heartbeat advanced while the engaged brake held. Recovery still stalled because the old Body claim could be read only through current-claim authentication, which correctly rejected its historical policy before the mismatch recovery branch. The candidate was rolled back and revoked; no deployment witness exists. Claim sight now has two explicit authorities: current authentication is required for provider projection work and rejects stale launches; recovery authentication proves the old signed claim/body/route lineage only. Supervisor recovery and directive writing use the recovery reader, while old launch authentication inside the atomic lease-transfer transaction is historical and the replacement launch/heartbeat remain current-policy evidence. The full causal test performs an actual policy rotation and proves current refusal, historical recovery, directive fencing, lease transfer, successor current sight, and replay/tamper boundaries. Full core passes 573/573 with one ignored; all binaries compile.
- Candidate `351355d3baee2d475f84168136380d2f50197ef8` authenticated the historical claim and started all three owners under the brake, but recovery refused because the claim named an older launch than the current replacement's direct parent. Repeated failed candidate deployments had formed a valid signed replacement chain, while recovery still assumed one direct old-to-new edge. The exact Idunn process group was terminated, all services stopped, active pointer and witness removed, and Bifrost authority revoked. No deployment witness exists. Recovery now authenticates the complete immutable chain from the claim's historical launch to the live current-policy descendant: every intermediate launch is host-signed, every parent termination id and envelope digest is exact, chronology is ordered, cycles and broken edges refuse, and the selected endpoint must be current. Directive writing, receipt verification, atomic lease transfer, and supervisor resume share this proof. Typed refusal now exposes the exact lineage fault instead of swallowing it. The causal recovery test contains a real intermediate generation and still proves the full fenced transaction. Full library passes 573/573 with one ignored; supervisor authority tests pass 24/24.
- Candidate `a70fe275195740ecefc2984b32ebd8ae93658c18` proved the full signed multi-generation chain and emitted recovery directive `06165fb6-97bd-4c27-97e3-38af03dec72d` from historical claim `c6df4335-7080-4d5f-80fc-4fa18a9d16ce` to current launch `9414c32f-f53c-450c-bc19-a69f5ba04a29`. The replacement projector nevertheless kept refusing stale-policy claim sight because its pulse authenticated the not-yet-created current successor claim before looking for the recovery directive. Supervisor replayed the same directive without mutating Body, exposing a circular ordering fault. The exact Idunn process group was terminated, services stopped, pointer and witness removed, and Bifrost authority revoked; no deployment witness exists. Projector recovery directive consumption now precedes all ordinary projection work and invokes the already idempotent atomic transfer directly. Current claim sight is an output of recovery, never a prerequisite for it. Full library now passes 574/574 with one ignored; supervisor authority tests pass 24/24.
next_action: "Diagnostic candidate c9e9a352 remains braked and unadmitted on Yggdrasil. Exact failed-predicate output proved both readiness providers fail only process-incarnation because the native observer incorrectly treated optional derived created_at_rfc3339 as process authority when readiness reconstructs PID, native creation token, and executable. Commit/push the observer correction, revoke c9e9a352, cancel only through Idunn's exact transaction group and verify the newly installed signal-safe rollback leaves no services, current links, active-release.env, or deployment.env. Then Bifrost-authorize and Idunn-deploy the exact successor under brake. Require exact release/witness/source/process diagnostics, signed aggregate health, and final deployment.env before the Starfire-offline ordinary-product rehearsal: persistent Modeling map -> autonomous bounded Imagination proposal, with organization feedback through Persona as additional attributed pressure; explicit Mind adoption -> Hands consequence -> Bifrost release -> Idunn deployment remain separate gates. Prove replay/tamper refusal and that conversation alone grants no Mind, Hands, Persona-speech, release, or deployment authority. No host reboot is authorized."
next_action: "Candidate 5e298e63 is braked and unadmitted on Yggdrasil: readiness is healthy, but the restarted workspace projector obeyed stale recovery pressure before recognizing durable terminal coverage owned by the historical succeeded claim and launch. Commit/push the terminal-authority correction, revoke 5e298e63, terminate only Idunn transaction PGID 1485835, and verify the installed signal-safe rollback leaves no services, current links, active-release.env, or deployment.env. Then Bifrost-authorize and Idunn-deploy the exact successor under brake. Require immutable historical terminal-sight reuse, three stable services, typed resident readiness, signed aggregate health, and final deployment.env before the Starfire-offline ordinary-product rehearsal: persistent Modeling map -> autonomous bounded Imagination proposal, with organization feedback through Persona as additional attributed pressure; explicit Mind adoption -> Hands consequence -> Bifrost release -> Idunn deployment remain separate gates. Prove replay/tamper refusal and that conversation alone grants no Mind, Hands, Persona-speech, release, or deployment authority. No host reboot is authorized."