Add canonical tool-result projection presets #213

Merged
lost-rob0t merged 3 commits from agent/tool-result-projection-presets into main 2026-08-27 02:20:14 +00:00
lost-rob0t commented 2026-08-25 11:26:53 +00:00 (Migrated from github.com)

Implements slice 1 of #211.

RAGE recovery state

The original slice was TDD-valid but exact old head fced85495700a0746ce49d7f697db3aab39f408d had one real deterministic failure: tool_result_projection_is_canonical_and_ground (888/889 passed). The failure was preserved and diagnosed rather than weakened or skipped.

Root cause: canonical_tool_result/2 required ground(Result0). A normal anonymous SWI-Prolog dict (_{...}) has a variable tag, so it is not ground/1 even when every key/value payload term is ground. The canonicalizer replaces that input tag with the fixed tool_result tag anyway.

Existing PR/branch ownership was recovered rather than replaced. Current exact candidate 99dfc12e6651f69f2e2cac5bf23d1ac224df3e7c is a non-force recovery over canonical main 267697bef10a3fffff7c093e1435ece770e7444b; the branch remains based on that current main and changes only this slice's three files.

What lands

  • public full|once|reference|hidden visibility presets;
  • canonical result_projection{initial,after_consumption,retention,retrievable} policy data;
  • structural normalization/validation for expanded policies;
  • canonical tool-message projection helper built on message_normalize/2;
  • canonical tool-result projection that accepts anonymous dict tags while requiring ground key/value payload data, then retags to tool_result;
  • negative regression proving a genuinely nonground tool-result payload remains rejected;
  • deterministic regression coverage in the existing chain message metadata suite;
  • stable runtime documentation.

Security / architecture boundary

REGISTERED != EXECUTABLE != EXECUTED != STORED != PROJECTED
retention != projection

Projection metadata is inert data. This slice does not grant execution authority, delete authoritative results, expose handlers/callables, or change effect/permission semantics. Anonymous tag acceptance does not admit nonground payload data.

Deliberate non-goals

This does not yet alter tool invocation, managed context packing, provider serialization, token accounting, or once consumption tracking. Those remain later slices of #211.

Exact-head verification

Exact candidate: 99dfc12e6651f69f2e2cac5bf23d1ac224df3e7c on unchanged canonical base 267697bef10a3fffff7c093e1435ece770e7444b.

Fresh repository-native verification on this exact candidate is green for every returned required workflow:

  • canonical CI: success, including deterministic and credential-backed REAL OpenRouter jobs;
  • Paid OpenRouter: success;
  • Nix flake: success;
  • clean SWI pack install: success;
  • Tree-sitter FFI: success.

Current submitted reviews, PR conversation comments, and unresolved review threads are empty. The PR is mergeable. Any changed head invalidates this evidence.

Decision

RAGE decision for slice 1: GO / ready for review. Do not close #211: this PR lands only slice 1. The repository merge gate still applies; no merge is implied by this promotion.

Implements slice 1 of #211. ## RAGE recovery state The original slice was TDD-valid but exact old head `fced85495700a0746ce49d7f697db3aab39f408d` had one real deterministic failure: `tool_result_projection_is_canonical_and_ground` (888/889 passed). The failure was preserved and diagnosed rather than weakened or skipped. Root cause: `canonical_tool_result/2` required `ground(Result0)`. A normal anonymous SWI-Prolog dict (`_{...}`) has a variable tag, so it is not `ground/1` even when every key/value payload term is ground. The canonicalizer replaces that input tag with the fixed `tool_result` tag anyway. Existing PR/branch ownership was recovered rather than replaced. Current exact candidate `99dfc12e6651f69f2e2cac5bf23d1ac224df3e7c` is a non-force recovery over canonical `main` `267697bef10a3fffff7c093e1435ece770e7444b`; the branch remains based on that current main and changes only this slice's three files. ## What lands - public `full|once|reference|hidden` visibility presets; - canonical `result_projection{initial,after_consumption,retention,retrievable}` policy data; - structural normalization/validation for expanded policies; - canonical tool-message projection helper built on `message_normalize/2`; - canonical tool-result projection that accepts anonymous dict tags while requiring ground key/value payload data, then retags to `tool_result`; - negative regression proving a genuinely nonground tool-result payload remains rejected; - deterministic regression coverage in the existing chain message metadata suite; - stable runtime documentation. ## Security / architecture boundary ```text REGISTERED != EXECUTABLE != EXECUTED != STORED != PROJECTED retention != projection ``` Projection metadata is inert data. This slice does not grant execution authority, delete authoritative results, expose handlers/callables, or change effect/permission semantics. Anonymous tag acceptance does not admit nonground payload data. ## Deliberate non-goals This does **not** yet alter tool invocation, managed context packing, provider serialization, token accounting, or `once` consumption tracking. Those remain later slices of #211. ## Exact-head verification Exact candidate: `99dfc12e6651f69f2e2cac5bf23d1ac224df3e7c` on unchanged canonical base `267697bef10a3fffff7c093e1435ece770e7444b`. Fresh repository-native verification on this exact candidate is green for every returned required workflow: - canonical CI: success, including deterministic and credential-backed REAL OpenRouter jobs; - Paid OpenRouter: success; - Nix flake: success; - clean SWI pack install: success; - Tree-sitter FFI: success. Current submitted reviews, PR conversation comments, and unresolved review threads are empty. The PR is mergeable. Any changed head invalidates this evidence. ## Decision RAGE decision for slice 1: **GO / ready for review**. Do not close #211: this PR lands only slice 1. The repository merge gate still applies; no merge is implied by this promotion.
lost-rob0t commented 2026-08-27 02:19:33 +00:00 (Migrated from github.com)

Backlog merge recovery: after #237 advanced main, this branch was content-preservingly replayed onto current main c836b500b2a024637487401ec3312c4616822df5 to satisfy the repo's rebase-only merge rule. Current candidate is 8989e116e89a99aef2771b1973626296ceee1133, exactly 3 commits / 3 intended paths; the final blobs for the original slice are preserved. The old 99dfc12e... exact-head green evidence is intentionally invalidated. Fresh PR workflows were triggered on 8989e116...; do not merge until all required runs complete green.

Backlog merge recovery: after #237 advanced `main`, this branch was content-preservingly replayed onto current `main` `c836b500b2a024637487401ec3312c4616822df5` to satisfy the repo's rebase-only merge rule. Current candidate is `8989e116e89a99aef2771b1973626296ceee1133`, exactly 3 commits / 3 intended paths; the final blobs for the original slice are preserved. The old `99dfc12e...` exact-head green evidence is intentionally invalidated. Fresh PR workflows were triggered on `8989e116...`; do not merge until all required runs complete green.
Sign in to join this conversation.
No description provided.