Gate resident result review on terminal output

This commit is contained in:
Meta Vens 2026-08-11 09:29:21 +02:00
commit 9f597ca2e3
5 changed files with 138 additions and 17 deletions

View file

@ -1149,7 +1149,9 @@ fn role_result_is_terminal_for_continuation(
role: crate::EpiphanyRoleResultRoleId,
binding_id: &str,
) -> Result<bool> {
let entry = crate::load_thread_state_entry(runtime_store)?;
let mut runtime = crate::runtime_spine_cache(runtime_store)?;
runtime.pull_all_backing_stores()?;
let entry = runtime.get::<crate::EpiphanyThreadStateEntry>(crate::THREAD_STATE_KEY)?;
let state = entry
.as_ref()
.filter(|entry| entry.thread_id == thread_id)
@ -1175,10 +1177,7 @@ fn resident_self_safe_continuation_action(
) -> Result<Option<String>> {
let direct = matches!(
receipt.final_action.as_str(),
"reviewResearchResult"
| "reviewModelingResult"
| "reviewVerificationResult"
| "launchResearch"
"launchResearch"
| "launchModeling"
| "launchVerification"
| "startFrontierPlanning"
@ -1191,6 +1190,36 @@ fn resident_self_safe_continuation_action(
return Ok(Some(receipt.final_action.clone()));
}
let action = match receipt.final_action.as_str() {
"reviewResearchResult"
if role_result_is_terminal_for_continuation(
runtime_store,
&receipt.thread_id,
crate::EpiphanyRoleResultRoleId::Research,
crate::EPIPHANY_RESEARCH_ROLE_BINDING_ID,
)? =>
{
Some("reviewResearchResult")
}
"reviewModelingResult"
if role_result_is_terminal_for_continuation(
runtime_store,
&receipt.thread_id,
crate::EpiphanyRoleResultRoleId::Modeling,
crate::EPIPHANY_MODELING_ROLE_BINDING_ID,
)? =>
{
Some("reviewModelingResult")
}
"reviewVerificationResult"
if role_result_is_terminal_for_continuation(
runtime_store,
&receipt.thread_id,
crate::EpiphanyRoleResultRoleId::Verification,
crate::EPIPHANY_VERIFICATION_ROLE_BINDING_ID,
)? =>
{
Some("reviewVerificationResult")
}
"waitForResearchResult"
if role_result_is_terminal_for_continuation(
runtime_store,
@ -5117,16 +5146,68 @@ mod tests {
let (entry, _) = cache.prepare_entry(RESIDENT_SELF_STATE_KEY, &state)?;
SingleFileMessagePackBackingStore::new(&resident_store).push(&entry)?;
assert!(ingest_resident_self_coordinator_continuation_pressure(
assert!(!ingest_resident_self_coordinator_continuation_pressure(
&resident_store,
&runtime_store,
1,
)?);
assert!(!ingest_resident_self_coordinator_continuation_pressure(
let job_id = "modeling-terminal-job";
let thread_state = epiphany_state_model::EpiphanyThreadState {
runtime_links: vec![epiphany_state_model::EpiphanyRuntimeLink {
id: "runtime-link-modeling-terminal-job".into(),
binding_id: crate::EPIPHANY_MODELING_ROLE_BINDING_ID.into(),
surface: "jobLaunch".into(),
role_id: crate::EPIPHANY_MODELING_OWNER_ROLE.into(),
authority_scope: "modeling".into(),
runtime_job_id: job_id.into(),
runtime_result_id: Some(format!("result-{job_id}")),
linked_subgoal_ids: Vec::new(),
linked_graph_node_ids: Vec::new(),
}],
..Default::default()
};
let thread_entry = crate::EpiphanyThreadStateEntry::from_state("thread-1", &thread_state)?;
let mut runtime = crate::runtime_spine_cache(&runtime_store)?;
runtime.put(crate::THREAD_STATE_KEY, &thread_entry)?;
runtime.put(job_id, &crate::EpiphanyRuntimeJob {
schema_version: crate::RUNTIME_SPINE_SCHEMA_VERSION.into(),
job_id: job_id.into(),
session_id: "modeling-terminal-session".into(),
role: crate::EPIPHANY_MODELING_OWNER_ROLE.into(),
status: crate::EpiphanyRuntimeJobStatus::Completed,
created_at: "2026-08-11T00:00:00Z".into(),
updated_at: "2026-08-11T00:00:01Z".into(),
summary: "Modeling completed.".into(),
artifact_refs: Vec::new(),
metadata: BTreeMap::new(),
})?;
runtime.put(&format!("result-{job_id}"), &crate::EpiphanyRuntimeJobResult {
schema_version: crate::RUNTIME_SPINE_SCHEMA_VERSION.into(),
result_id: format!("result-{job_id}"),
job_id: job_id.into(),
session_id: "modeling-terminal-session".into(),
role: crate::EPIPHANY_MODELING_OWNER_ROLE.into(),
verdict: "completed".into(),
summary: "Modeling completed.".into(),
completed_at: "2026-08-11T00:00:01Z".into(),
next_safe_move: "Review Modeling.".into(),
evidence_refs: Vec::new(),
artifact_refs: Vec::new(),
metadata: BTreeMap::new(),
})?;
runtime.put(job_id, &role_worker_result(job_id, "modeling"))?;
assert!(ingest_resident_self_coordinator_continuation_pressure(
&resident_store,
&runtime_store,
2,
)?);
assert!(!ingest_resident_self_coordinator_continuation_pressure(
&resident_store,
&runtime_store,
3,
)?);
let pressure = resident_self_pressures(&resident_store)?
.into_iter()
.next()
@ -5135,7 +5216,7 @@ mod tests {
pressure.kind,
RESIDENT_SELF_COORDINATOR_CONTINUATION_PRESSURE_KIND
);
heartbeat_issue_resident_self_grant(&resident_store, "schedule", "action", 3)?
heartbeat_issue_resident_self_grant(&resident_store, "schedule", "action", 4)?
.expect("one continuation grant");
let coordinator = temp.path().join("epiphany-mvp-coordinator");
std::fs::write(&coordinator, b"witnessed executable")?;
@ -5143,7 +5224,7 @@ mod tests {
policy.coordinator_bin = coordinator;
policy.runtime_store = runtime_store;
policy.max_steps = 1;
let prepared = prepare_resident_self_launch(&resident_store, &policy, 4)?
let prepared = prepare_resident_self_launch(&resident_store, &policy, 5)?
.expect("continuation preparation");
assert_eq!(resident_prepared_launch_thread_id(&prepared)?, "thread-1");
assert!(prepared.argv.windows(2).any(|pair| pair == ["--mode", "execute"]));

View file

@ -3923,3 +3923,27 @@ The proposal grant and outer worker are single-attempt proven. Downstream
coordinator review is not yet single-consumption proven: the live run emitted
two receipt-bound `reviewModelingResult` continuation grants for the same
proposal-bound result before settlement. That route is the next ownership cut.
### Receipt-bound role review continuation
- Owner: the runtime-linked role result owns when review becomes runnable;
resident Self owns idempotent conversion of the exact coordinator receipt
into one continuation pressure.
- Inputs: exact last coordinator receipt, authoritative thread runtime link,
and runtime job/result terminal status.
- Outputs: no pressure while the result is pending; one deterministic
`{receipt_id, review_action}` pressure after terminal publication.
- Derived state: a receipt's `review*Result` string is intent, not readiness.
- Forbidden writers: coordinator final-action prose, pulse timing, cooldown,
and process exit cannot make a pending result reviewable.
- Shared paths: direct `reviewResearchResult`, `reviewModelingResult`, and
`reviewVerificationResult` receipts use the same terminal predicate as
`waitFor*Result` conversion.
- Cut line: review actions are removed from the unconditional direct-action
set. The terminal predicate reads through the runtime-spine cache, which owns
every schema in the heterogeneous store; the thread-only cache is not a
runtime-store reader.
- Verification: focused coverage proves a pending direct review receipt emits
no continuation, then the same exact receipt emits one after its linked job
and typed result become terminal; repeated ingestion remains idempotent.
Thirty resident tests pass. Exact packaged copied replay remains required.

View file

@ -46,6 +46,18 @@ but it is not clean single-consumption review either. Next map the result-review
owner and require one proposal grant, one outer worker, at most one review
continuation, and exact settlement on a fresh copy. Yggdrasil never builds.
The source owner is now mapped and cut. `resident_self_safe_continuation_action`
previously treated a receipt's direct `reviewModelingResult` action as runnable
without checking the detached result. That minted one premature grant; the
coordinator correctly returned `waitForModelingResult`, and only then did the
terminal-result path mint the real review. Direct Research, Modeling, and Soul
review continuations now share the same exact terminal-result predicate as the
corresponding wait conversion. That predicate also reads the heterogeneous
runtime store through `runtime_spine_cache`, not the thread-only reader. Thirty
resident tests pass, including a focused negative that pending review mints no
pressure and the same receipt becomes eligible exactly once after terminal
publication. Package and replay before accepting this coordination cut live.
## Governed directory inventory accepted live - 2026-08-11
Actual c006 remains exact `c9a2a979`, alive and cognitively braked. All work

View file

@ -70,7 +70,7 @@ current_status:
yggdrasil_epiphany_service_contract: repaired_in_gamecult_ops_812b427_not_installed
resident_physiology: c006_exact_c9a2a979_alive_braked_revision_34_after_two_receipt_bound_continuation_grants
unresolved_authority: Coordinator receipt, Heartbeat pulse-artifact, genuine-idle and active resource plateaus, exact-grant terminality, restart-persistent cooldown refusal, schedule/action issuance cardinality, runtime-owned typed fulfillment, all three packaged fulfilled-before-receipt lanes, genuine packaged Imagination option generation, narrow model-generation retention, published model-turn JSON ingress, semantic logical/physical retention, Persona conversation retention, stable Starfire firewall ownership, completed model-adapter session archival, normal coordinator lifecycle opening/error closure/legacy repair/archival, co-resident resident lifecycle retention, authenticated outer-worker attempt retention, deployed supervisor/projector journald ownership, Docker named-volume atomic snapshot visibility, and deterministic incremental release construction are accepted. Starfire's Docker Desktop F: bind is rejected for mutable authority after an exact packaged lockless reader observed an empty published snapshot during writer interruption. Historical migrated semantic attempts without recorded physical namespace remain durable and non-retirable. One completed Discord consequence remains blocked by the absent Yggdrasil credential. Exact aa841873 also makes legacy coordinator repair one full-snapshot transaction so a later hostile family cannot leave an earlier partial repair.
next_action: Keep actual c006 exact c9a2a979 alive under its cognitive brake. Treat exact e723058a first-attempt proposal Modeling publication as accepted. Map why one proposal-bound result required two receipt-bound reviewModelingResult continuation grants before settlement; make the exact accepted/bound result single-consumption review authority without weakening coordinator review or minting new consequence. Replay on fresh copied state and require one proposal grant, one outer Modeling job, at most one review continuation, exact terminal settlement, zero open jobs, and no Hands, Persona, or deployment authority. Then continue copied autonomous turnover. Separately recheck Yggdrasil's Persona credential boundary before attempting the one missing public consequence. Yggdrasil never builds.
next_action: Keep actual c006 exact c9a2a979 alive under its cognitive brake. Treat exact e723058a first-attempt proposal Modeling publication as accepted. The duplicate review owner is cut in current source: a receipt requesting role review is continuation-eligible only after the exact runtime-linked result is terminal, and the predicate reads the mixed store through its runtime-spine schema owner. Package and replay this cut on fresh copied state; require one proposal grant, one outer Modeling job, at most one review continuation, exact terminal settlement, zero open jobs, and no Hands, Persona, or deployment authority. Then continue copied autonomous turnover. Separately recheck Yggdrasil's Persona credential boundary before attempting the one missing public consequence. Yggdrasil never builds.
active_subgoals:
- Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.

View file

@ -4,9 +4,8 @@ Disposable working memory for one bounded rite.
## Current Subgoal
Map the duplicate receipt-bound `reviewModelingResult` continuation route after
one proposal-bound Modeling result. Preserve explicit coordinator review while
making the exact result single-consumption authority.
Package and replay the cut that makes receipt-bound role review continuation
eligible only after the exact runtime-linked result becomes terminal.
## Accepted live boundary
@ -50,13 +49,13 @@ completed through one outer job on attempt one, bound one runtime-owned
frontier, terminalized its proposal grant, and ended with zero open jobs and no
Hands/Eyes frontier. Both owners exited zero under the restored brake.
## Next authority map
## Review continuation authority map
- Owner to inspect: coordinator Modeling-result acceptance/review state and
Heartbeat continuation issuance.
- Owner: exact runtime-linked role-result terminality decides review readiness;
resident Self converts one exact receipt into one deterministic pressure.
- Inputs: the exact completed result, proposal binding/admission state, prior
review receipt, and resident continuation lifecycle.
- Output: at most one review continuation for one exact result, followed by one
- Output: no pending-result continuation; at most one review continuation for one exact result, followed by one
terminal settled projection.
- Forbidden cut: do not suppress review with a cooldown, ack tombstone, log
heuristic, or retry ceiling; move the consumed fact to the exact result or
@ -64,3 +63,8 @@ Hands/Eyes frontier. Both owners exited zero under the restored brake.
- Verification: fresh copied proposal produces one proposal grant, one outer
Modeling job, at most one review continuation, exact settlement, zero open
jobs, and no Hands, Persona, or deployment consequence.
Current source removes direct role-review actions from the unconditional
continuation set and makes Research, Modeling, and Soul review share the exact
terminal-result predicate. The predicate now opens the mixed store through
`runtime_spine_cache`; thirty resident tests pass. Package/live proof is open.