Wire unresolved delegation into one bounded parent resume #238

Merged
lost-rob0t merged 1 commit from rage/172-parent-resume-replan into main 2026-08-27 02:31:33 +00:00
lost-rob0t commented 2026-08-26 09:39:41 +00:00 (Migrated from github.com)

Advances #172.

RAGE slice

Started from exact canonical main 267697bef10a3fffff7c093e1435ece770e7444b after re-enumerating the complete open issue/PR backlog and excluding active transactions #132, #212/#221, #213, #225, #228, #233, and #237.

The remaining #172 defect is orchestration, not missing delegation primitives: merged tests manually compile/register/execute an unknown binding and manually observe the child result, but no generic runtime boundary connected unresolved trigger -> authenticated command -> canonical rlm_subagent -> successful child result -> one parent continuation.

Analyze / design

rlm_delegation_runtime:delegation_resume/10 is the narrow generic composition boundary. It:

  • consumes the unresolved/unknown trigger as closed data;
  • resolves it only through prompt_command_compile/3;
  • reads the parent capability set from authoritative rlm_agent state instead of accepting a caller-supplied capability claim;
  • registers the command through rlm_subagent_register_command/8 in an ephemeral canonical rlm_tool registry;
  • dispatches only through prompt_command_execute/6;
  • accepts only a closed canonical subagent_result{status:completed,...} as resumable;
  • projects that existing child envelope into closed delegation_resume_input evidence;
  • invokes exactly one trusted host continuation closure;
  • requires the continuation itself to return closed ok(Value) or error(Error);
  • propagates failure/denial/non-completed child states explicitly and never resumes them as success.

No second selector, command executor, scheduler, agent runtime, authority path, or product-specific loop is introduced. Model/KB data never becomes a callable term. The continuation closure is a trusted host input, not model data.

Adversarial review

The first green candidate exposed an unnecessary authority risk during review: it accepted ParentCapabilities as an API argument. Although canonical child spawning would still narrow against the actual parent, a caller could have overstated the parent capability set used by typed command dispatch. That design was rejected before promotion.

The current implementation removes that input entirely. delegation_resume/10 obtains the actual parent's capabilities through agent_status/3 immediately before command compilation/dispatch. The capability-denial regression therefore exercises authoritative runtime state, not a caller-provided list.

Other reviewed failure modes:

  • missing/ambiguous bindings do not spawn a child;
  • parent lacking tool(rlm_subagent) cannot dispatch and makes zero continuation calls;
  • failed/non-completed child results never resume as success;
  • role/skill metadata remains compiler-authenticated provenance and cannot widen authority;
  • child capabilities remain narrowed by canonical rlm_agent / rlm_subagent semantics;
  • continuation is trusted host code only and is invoked at most once;
  • child evidence/results are data and never meta-called;
  • ephemeral tool registry cleanup is protected by setup_call_cleanup/3.

Decision gate: GO for this bounded generic-runtime slice.

Deterministic contract

The existing canonical rlm_prompt_command suite now covers:

  • unresolved binding automatically compiles, delegates through canonical rlm_subagent, preserves reviewer/rlm-facts provenance and child capability narrowing, and resumes exactly once;
  • authoritative parent capability denial results in zero continuation calls;
  • failed canonical child result results in zero continuation calls;
  • missing unresolved binding spawns no child and makes zero continuation calls.

Negative behavior is asserted as expected structured failure while the suite stays green; there is no intentional-red/xfail/skip path.

The new public contract is documented in docs/delegation-runtime.md.

Coordination

  • #175/#221 deadline policy remains separate and this branch does not touch rlm_subagent.pl.
  • #234/#237 numeric schema validation remains separate and this branch does not touch rlm_tool.pl.
  • a0-symbolics remains a thin downstream consumer; Agent Zero product/plugin behavior stays there.
  • agentProlog retains product/frontend/DeepSeek Harness composition; generic delegation orchestration stays upstream here.

Exact-head verification

Exact candidate head: 9f41aa302a1772272c2d3d8c4d3aefede27cdb48.

All returned canonical workflows are completed successfully on this exact head:

  • CI: static production/test loading, runner-integrity checks, deterministic PlUnit, benchmark/conformance, deep recursion, CLI/trace, fresh-process graph/artifact restart, whitespace;
  • deterministic PlUnit: 78 suites / 891 discovered / 891 passed / 0 failed / 0 timeout / 0 blocked / 0 fixme;
  • credential-backed REAL OpenRouter: core, structured repair, benchmark, depth 0/1/2 recursion, CLI smoke;
  • pinned Paid OpenRouter: core, structured repair, benchmark, depth 0/1/2 recursion, CLI smoke;
  • Nix flake;
  • clean SWI pack install;
  • Tree-sitter FFI.

Current PR review submissions, conversation comments, and unresolved review threads are empty. main is still the exact starting SHA above and GitHub reports this PR mergeable.

Remaining #172 scope

This slice closes the previously manual parent-resume composition gap. Reconciliation of the parent issue should still distinguish this one bounded continuation primitive from broader autonomous recursion-policy choices; no downstream product loop is added here.

Advances #172. ## RAGE slice Started from exact canonical `main` `267697bef10a3fffff7c093e1435ece770e7444b` after re-enumerating the complete open issue/PR backlog and excluding active transactions #132, #212/#221, #213, #225, #228, #233, and #237. The remaining #172 defect is orchestration, not missing delegation primitives: merged tests manually compile/register/execute an `unknown` binding and manually observe the child result, but no generic runtime boundary connected unresolved trigger -> authenticated command -> canonical `rlm_subagent` -> successful child result -> one parent continuation. ## Analyze / design `rlm_delegation_runtime:delegation_resume/10` is the narrow generic composition boundary. It: - consumes the unresolved/unknown trigger as closed data; - resolves it only through `prompt_command_compile/3`; - reads the parent capability set from authoritative `rlm_agent` state instead of accepting a caller-supplied capability claim; - registers the command through `rlm_subagent_register_command/8` in an ephemeral canonical `rlm_tool` registry; - dispatches only through `prompt_command_execute/6`; - accepts only a closed canonical `subagent_result{status:completed,...}` as resumable; - projects that existing child envelope into closed `delegation_resume_input` evidence; - invokes exactly one trusted host continuation closure; - requires the continuation itself to return closed `ok(Value)` or `error(Error)`; - propagates failure/denial/non-completed child states explicitly and never resumes them as success. No second selector, command executor, scheduler, agent runtime, authority path, or product-specific loop is introduced. Model/KB data never becomes a callable term. The continuation closure is a trusted host input, not model data. ## Adversarial review The first green candidate exposed an unnecessary authority risk during review: it accepted `ParentCapabilities` as an API argument. Although canonical child spawning would still narrow against the actual parent, a caller could have overstated the parent capability set used by typed command dispatch. That design was rejected before promotion. The current implementation removes that input entirely. `delegation_resume/10` obtains the actual parent's capabilities through `agent_status/3` immediately before command compilation/dispatch. The capability-denial regression therefore exercises authoritative runtime state, not a caller-provided list. Other reviewed failure modes: - missing/ambiguous bindings do not spawn a child; - parent lacking `tool(rlm_subagent)` cannot dispatch and makes zero continuation calls; - failed/non-completed child results never resume as success; - role/skill metadata remains compiler-authenticated provenance and cannot widen authority; - child capabilities remain narrowed by canonical `rlm_agent` / `rlm_subagent` semantics; - continuation is trusted host code only and is invoked at most once; - child evidence/results are data and never meta-called; - ephemeral tool registry cleanup is protected by `setup_call_cleanup/3`. Decision gate: **GO** for this bounded generic-runtime slice. ## Deterministic contract The existing canonical `rlm_prompt_command` suite now covers: - unresolved binding automatically compiles, delegates through canonical `rlm_subagent`, preserves reviewer/`rlm-facts` provenance and child capability narrowing, and resumes exactly once; - authoritative parent capability denial results in zero continuation calls; - failed canonical child result results in zero continuation calls; - missing unresolved binding spawns no child and makes zero continuation calls. Negative behavior is asserted as expected structured failure while the suite stays green; there is no intentional-red/xfail/skip path. The new public contract is documented in `docs/delegation-runtime.md`. ## Coordination - #175/#221 deadline policy remains separate and this branch does not touch `rlm_subagent.pl`. - #234/#237 numeric schema validation remains separate and this branch does not touch `rlm_tool.pl`. - `a0-symbolics` remains a thin downstream consumer; Agent Zero product/plugin behavior stays there. - `agentProlog` retains product/frontend/DeepSeek Harness composition; generic delegation orchestration stays upstream here. ## Exact-head verification Exact candidate head: `9f41aa302a1772272c2d3d8c4d3aefede27cdb48`. All returned canonical workflows are completed successfully on this exact head: - CI: static production/test loading, runner-integrity checks, deterministic PlUnit, benchmark/conformance, deep recursion, CLI/trace, fresh-process graph/artifact restart, whitespace; - deterministic PlUnit: 78 suites / 891 discovered / 891 passed / 0 failed / 0 timeout / 0 blocked / 0 fixme; - credential-backed REAL OpenRouter: core, structured repair, benchmark, depth 0/1/2 recursion, CLI smoke; - pinned Paid OpenRouter: core, structured repair, benchmark, depth 0/1/2 recursion, CLI smoke; - Nix flake; - clean SWI pack install; - Tree-sitter FFI. Current PR review submissions, conversation comments, and unresolved review threads are empty. `main` is still the exact starting SHA above and GitHub reports this PR mergeable. ## Remaining #172 scope This slice closes the previously manual parent-resume composition gap. Reconciliation of the parent issue should still distinguish this one bounded continuation primitive from broader autonomous recursion-policy choices; no downstream product loop is added here.
Sign in to join this conversation.
No description provided.