Carry action item context into adoption

This commit is contained in:
Meta Vens 2026-06-20 17:51:42 +01:00
commit 1e39e37339
6 changed files with 154 additions and 32 deletions

View file

@ -276,6 +276,55 @@ fn run_smoke(args: Args) -> Result<Value> {
&root,
)?;
}
let adoption = read_json(
&repo
.join(".epiphany")
.join("work")
.join(format!("work-adopt-{item}.json")),
)?;
require_eq(
&adoption,
&["schemaVersion"],
"epiphany.repo_work_adoption_receipt.v0",
)?;
require_eq(
&adoption,
&["status"],
"approved-for-branch-local-hands-action",
)?;
require_eq(
&adoption,
&["adoptedActionItem", "safeActionFamily"],
"repo.markdown_planning_note",
)?;
require_text_field(
&adoption,
&["adoptedActionItem", "planningFacets", "decisionPoints", "0"],
"Self may adopt",
)?;
require_bool(
&adoption,
&["adoptedActionItem", "handsCommandAuthority"],
false,
)?;
require_bool(
&adoption,
&["adoptedActionItem", "durableStateAuthority"],
false,
)?;
require_bool(
&adoption,
&["adoptedActionItem", "publicationAuthorized"],
false,
)?;
require_bool(
&adoption,
&["adoptedActionItem", "privateStateExposed"],
false,
)?;
require_bool(&adoption, &["authority", "handsAuthorityGranted"], true)?;
require_bool(&adoption, &["authority", "durableStateAdmitted"], false)?;
require_bool(&adoption, &["privateStateExposed"], false)?;
let close = read_json(
&repo
.join(".epiphany")
@ -310,10 +359,14 @@ fn run_smoke(args: Args) -> Result<Value> {
"openQuestionsRecorded": true,
"decisionPointsRecorded": true,
"evidenceNeedsRecorded": true,
"adoptedActionItemRecorded": true,
"adoptionFacetsRecorded": true,
"handsAuthorityGranted": false,
"durableStateAdmitted": false,
"handsCommandAuthority": false,
"durableStateAuthority": false,
"adoptionHandsAuthorityGranted": true,
"adoptionDurableStateAdmitted": false,
"closeStatus": "closed",
"soulVerdict": "passed",
"familyAssertionsStatus": "passed",

View file

@ -6492,6 +6492,10 @@ fn run_adopt(args: AdoptArgs) -> Result<Value> {
));
}
}
let adopted_action_item = plan_receipt
.as_ref()
.map(adopted_action_item_from_plan)
.unwrap_or(Value::Null);
let mut approved_review = hands_action_review_for_intent(
review_id.to_string(),
&intent,
@ -6536,6 +6540,7 @@ fn run_adopt(args: AdoptArgs) -> Result<Value> {
"status": "approved-for-branch-local-hands-action",
"planSummary": plan_summary,
"adoptionEvidenceRefs": adoption_evidence_refs,
"adoptedActionItem": adopted_action_item,
"handsActionGate": {
"intentId": intent.intent_id,
"reviewId": approved_review.review_id,
@ -6558,6 +6563,7 @@ fn run_adopt(args: AdoptArgs) -> Result<Value> {
"publicationGate": "Bifrost",
"requiredReceiptsBeforeCompletion": approved_review.required_receipts
},
"privateStateExposed": false,
"nextSafeMove": "Execute branch-local work through Hands and record patch/command/commit receipts; Bifrost still gates publish/merge."
});
let receipt_path = artifact_dir.join(format!("work-adopt-{item_slug}.json"));
@ -6570,9 +6576,10 @@ fn run_adopt(args: AdoptArgs) -> Result<Value> {
"runtimeStore": adoption_receipt["runtimeStore"],
"receiptPath": receipt_path,
"item": adoption_receipt["item"],
"adoptedActionItem": adoption_receipt["adoptedActionItem"],
"handsActionGate": adoption_receipt["handsActionGate"],
"authority": adoption_receipt["authority"],
"privateStateExposed": false,
"privateStateExposed": adoption_receipt["privateStateExposed"],
"nextSafeMove": adoption_receipt["nextSafeMove"],
}))
}
@ -9811,6 +9818,64 @@ fn default_if_empty(values: Vec<String>, defaults: Vec<String>) -> Vec<String> {
if values.is_empty() { defaults } else { values }
}
fn adopted_action_item_from_plan(plan: &Value) -> Value {
let action_item = plan
.get("derivation")
.and_then(|value| value.get("actionItemReceipt"));
let plan_action = plan
.get("actions")
.and_then(Value::as_array)
.and_then(|actions| actions.first());
json!({
"source": "plan.derivation.actionItemReceipt",
"planId": plan.get("planId").cloned().unwrap_or(Value::Null),
"receiptId": action_item
.and_then(|value| value.get("receiptId"))
.cloned()
.unwrap_or(Value::Null),
"receiptPath": action_item
.and_then(|value| value.get("receiptPath"))
.cloned()
.unwrap_or(Value::Null),
"schemaVersion": action_item
.and_then(|value| value.get("schemaVersion"))
.cloned()
.unwrap_or(Value::Null),
"status": action_item
.and_then(|value| value.get("status"))
.cloned()
.unwrap_or(Value::Null),
"modelAuthored": action_item
.and_then(|value| value.get("modelAuthored"))
.cloned()
.unwrap_or(json!(false)),
"safeActionFamily": action_item
.and_then(|value| value.get("safeActionFamily"))
.cloned()
.unwrap_or(Value::Null),
"requestedPaths": plan_action
.and_then(|value| value.get("changedPaths"))
.cloned()
.unwrap_or(json!([])),
"summary": plan.get("planSummary").cloned().unwrap_or(Value::Null),
"planningFacets": action_item
.and_then(|value| value.get("planningFacets"))
.cloned()
.unwrap_or(Value::Null),
"adoptionEvidenceRefs": plan
.get("adoptionEvidenceRefs")
.cloned()
.unwrap_or(json!([])),
"handsCommandAuthority": false,
"durableStateAuthority": false,
"publicationAuthorized": false,
"mergeAuthorized": false,
"serviceLifecycleAuthority": false,
"crossRepoMutation": false,
"privateStateExposed": false
})
}
fn compact_text(text: &str, limit: usize) -> String {
let compact = text.split_whitespace().collect::<Vec<_>>().join(" ");
if compact.chars().count() <= limit {

View file

@ -1423,10 +1423,12 @@ Build the remaining MVP in this order:
typed Imagination action-item receipts with allowed safe families, requested
paths, verification asks, stop conditions, escalation reasons, planning
facets, model provenance, and no Hands/publication/durable-state authority
before it lowers the chosen safe family into a plan receipt. Banter remains
banter unless Mind/Interpreter extracts a work candidate. The remaining cut
is richer model-authored families and adoption/interpreter depth, not basic
action-item receipt shape.
before it lowers the chosen safe family into a plan receipt. `adopt` now
records the chosen action item and planning facets in the Mind adoption
receipt before granting branch-local Hands authority. Banter remains banter
unless Mind/Interpreter extracts a work candidate. The remaining cut is
richer model-authored families and interpreter/adoption semantics, not basic
action-item or adoption receipt shape.
3. **Model-authored safe plan families.** Promote `derive-plan` beyond the
deterministic `append-worklog` and `planning-note` reliquaries by letting
Imagination author typed plans over allowlisted repo-local families. Shell
@ -1720,15 +1722,17 @@ Required organs before MVP:
antecedents plus model-call/token-cost/review-load/artifact/proof/credit-readback/redaction
packet requirements while granting no metrics ledger, spend, review-load,
credit ledger, publication, PR, merge, sync, Hands, or cross-body authority.
`repo-planning-facets` smoke `.epiphany-smoke\repo-planning-facets-20260620-163800`
`repo-planning-facets` smoke `.epiphany-smoke\repo-planning-facets-20260620-164958`
proves model-authored planning facets on action-item receipts: assumptions,
constraints, non-goals, open questions, decision points, and evidence needs
survive into the Imagination receipt and plan derivation while Hands command
authority, durable-state authority, publication, merge, service lifecycle,
cross-body mutation, and private-state exposure remain false; the branch-local
item still closes through Soul with family assertions and path scope passing.
survive into the Imagination receipt, plan derivation, and Mind adoption
receipt while the adoption receipt grants only branch-local Hands authority;
Hands command authority, durable-state authority, publication, merge, service
lifecycle, cross-body mutation, and private-state exposure remain false; the
branch-local item still closes through Soul with family assertions and path
scope passing.
Remaining work is later model-authored action classes that can change more
useful repo-owned configuration, plus deeper adoption/interpreter behavior,
useful repo-owned configuration, plus deeper interpreter/adoption semantics,
without arbitrary shell authority.
- Closure depth: `close` now writes a structured
`epiphany.repo_work_closure_review.v0` packet for Hands commits, records

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long