Add structured outcomes, inspection, and bounded repair (#10) #29
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm!29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/issue-10-structured-outcomes-repair"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #10.
Canonical structured outcomes
Add
rlm_outcomewith one explicit execution vocabulary:successlogical_failuretimeoutdepth_exhaustedresource_exhaustedcapability_deniedvalidation_failureexceptionplan_outcome/5preserves final value, bindings, checkpoints, remaining plan budget, structured plan errors, and bounded transition traces.goal_outcome/3bounds trusted-host goals by wall time/depth and preserves bound goals plus residual constraints viacopy_term/3.Inspection
plan_inspect/4parses/validates without executing and reports normalized plans, required/provided capabilities, estimates, and structured failures.predicate_inspect/2exposes bounded SWI predicate metadata only; it does not dump predicate source or create an arbitrary execution path.outcome_trace/3enforces explicit node and serialized-byte ceilings. Oversized traces collapse to a bounded summary instead of becoming an observability escape hatch.Scoped repair
plan_repair/6gives a trusted repair adapter a structured observation containing status, phase, structured error, bounded trace, and remaining budget. It never decides repairs by scraping stderr or exception text.Repair semantics preserve the original run envelope:
Control-signal integrity
Harden the trusted-tool boundary in
rlm_plansotime_limit_exceededandrlm_cancelled(...)remain control signals rather than being converted into ordinary tool exceptions. This is required for canonical timeout/cancellation semantics above running tools.Deterministic acceptance
The branch-head deterministic suite covers:
No temporary write-capable patch workflow remains in the branch.
REAL OpenRouter repair gate
Same-repository PR CI performs a production-provider repair path with no fake provider fallback:
invalid typed plan -> structured validation_failure observation -> trusted repair adapter -> real OpenRouter strategy selection -> Prolog materializes the allow-listed typed repair plan -> revalidation -> successful execution (REPAIR_OK)The live adapter exposes only a closed strategy vocabulary (
REPAIR_LITERAL_FINALorABORT). OpenRouter must choose the repair strategy from the structured diagnostic; model output is never executed as Prolog code. Prolog owns the strategy-to-plan mapping and the existing typed validator/interpreter owns execution. The adapter may make at most two real-provider attempts to tolerate free-route output variance.Live evidence is limited to non-secret status fields: provider/requested/selected model, HTTP 200, observation status, selected strategy, plan-materialized flag, response channel, provider attempt, repair count, budget-preserved flag, and final success. Planner/repair text, API keys, Authorization headers, and environment dumps are not intentionally logged.
Do not merge until deterministic CI and the REAL OpenRouter PR job are both green on the exact head and the final diff/credential scan is clean.