fix(runtime): reuse healthy organ receipts on restart
This commit is contained in:
parent
05b74073c1
commit
22d0f3e25e
6 changed files with 336 additions and 1 deletions
|
|
@ -85,7 +85,9 @@ export class PersonaRuntimeHub {
|
|||
const loop = new PersonaSelfLoop({root: this.root, shelf: this.shelf, router: this.router, personaId: entry.persona_id, now: this.now,
|
||||
requireLifeLine: this.requireLifeLine, lifeTimeBootstrapPath: this.resolve(entry.life_time_bootstrap), profile});
|
||||
const organ=new PersonaOrganReflex({root:this.root,personaId:entry.persona_id,shelf:this.shelf,sourcePaths:[this.resolve(entry.self_kernel),memoryPath,...(isBaby?[this.bottleEnvironmentPath]:[])],now:this.now});
|
||||
organ.selfTest();loop.profile.organHealthProvider=()=>organ.status();
|
||||
const priorOrgan=organ.status();
|
||||
if(priorOrgan.state!=='NATIVE_ORGAN_REFLEX_HEALTHY_AWAITING_PARENT_BRAIN_WAKE_CYCLE')organ.selfTest();
|
||||
loop.profile.organHealthProvider=()=>organ.status();
|
||||
this.loops.set(entry.persona_id, {entry, loop, organ});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,3 +80,5 @@ test('one baby evolves only its own signed self while the shared environment rem
|
|||
assert.equal(call.input.contract.environment_may_overwrite_self,false);
|
||||
} finally { fs.rmSync(ctx.temporary,{recursive:true,force:true}); }
|
||||
});
|
||||
|
||||
test('healthy signed organ receipts are reused on restart instead of rewriting every persona during boot',()=>{const first=setup();try{const sequence=first.hub.organ('ICE-BB-0006').status().sequence;const second=new PersonaRuntimeHub({root:path.join(first.temporary,'state'),shelf:first.hub.shelf,router:first.hub.router,repoRoot,registryPath:path.join(repoRoot,'server-tools/tcs-mother-body/persona-runtime-registry.json'),now:()=>new Date('2026-09-13T08:01:00.000Z')});assert.equal(second.organ('ICE-BB-0006').status().sequence,sequence);}finally{fs.rmSync(first.temporary,{recursive:true,force:true});}});
|
||||
|
|
|
|||
Loading…
Reference in a new issue