Fix native context peek selector contract mismatch #377

Closed
nsaspy wants to merge 4 commits from fix/304-context-peek-selector-contract into main
Owner

Closes #304.

Live Auto-Dig direct-mode run 33253842641 reached the provider successfully, but GPT-5.6 Luna generated context-peek selectors that are valid according to the exported native schema and were rejected by runtime preflight. The schema exposes type, index, and count together; runtime previously allowed only the subset semantically used by each selector type.

This change aligns runtime validation with the provider-visible contract: metadata, head, tail, and item all tolerate the optional shared selector fields, while still requiring/using count for head/tail and index for item.

Regression coverage uses the exact live shapes:

  • {type:"head",count:20,index:0}
  • {type:"tail",count:20,index:0}
  • {type:"metadata",count:1,index:0}
  • item with an irrelevant count

Validation on the branch with SWI-Prolog:

  • focused context-peek contract tests green
  • full test/rlm_direct_test.pl green
  • test/load_all.pl green

The temporary patch workflow was removed before opening this PR.

Closes #304. Live Auto-Dig direct-mode run 33253842641 reached the provider successfully, but GPT-5.6 Luna generated context-peek selectors that are valid according to the exported native schema and were rejected by runtime preflight. The schema exposes `type`, `index`, and `count` together; runtime previously allowed only the subset semantically used by each selector type. This change aligns runtime validation with the provider-visible contract: `metadata`, `head`, `tail`, and `item` all tolerate the optional shared selector fields, while still requiring/using `count` for head/tail and `index` for item. Regression coverage uses the exact live shapes: - `{type:"head",count:20,index:0}` - `{type:"tail",count:20,index:0}` - `{type:"metadata",count:1,index:0}` - item with an irrelevant count Validation on the branch with SWI-Prolog: - focused context-peek contract tests green - full `test/rlm_direct_test.pl` green - `test/load_all.pl` green The temporary patch workflow was removed before opening this PR.
chore: remove temporary issue 304 patch workflow
Some checks failed
Tree-sitter FFI / Direct SWI-Prolog Tree-sitter FFI (pull_request) Successful in 2m21s
CI / REAL OpenRouter integration (pull_request) Has been skipped
Nix flake / Flake package and clean runtime load (pull_request) Failing after 5s
Clean SWI pack install / Install and load copied pack (pull_request) Successful in 1m59s
Paid OpenRouter / Pinned paid OpenRouter integration (pull_request) Failing after 2m52s
CI / Deterministic unit and load checks (pull_request) Failing after 3m24s
d05106ff09
nsaspy closed this pull request 2026-09-04 22:55:52 +00:00
Some checks failed
Tree-sitter FFI / Direct SWI-Prolog Tree-sitter FFI (pull_request) Successful in 2m21s
CI / REAL OpenRouter integration (pull_request) Has been skipped
Nix flake / Flake package and clean runtime load (pull_request) Failing after 5s
Clean SWI pack install / Install and load copied pack (pull_request) Successful in 1m59s
Paid OpenRouter / Pinned paid OpenRouter integration (pull_request) Failing after 2m52s
CI / Deterministic unit and load checks (pull_request) Failing after 3m24s

Pull request closed

Sign in to join this conversation.
No description provided.