[bug] context_peek schema accepts selector.index but native validator rejects it #311

Closed
opened 2026-09-02 17:25:37 +00:00 by nsaspy · 1 comment
Owner

Problem

The native direct-mode context_peek contract exposed to the model and the runtime validator disagree.

Auto-Dig repeatedly receives model calls shaped like:

{
  "context": "input",
  "selector": {
    "count": 20,
    "index": 0,
    "type": "head"
  }
}

The call is then rejected during native-call preflight with:

phase=schema
kind=malformed_arguments
message=native context arguments are malformed
detail=unexpected_fields([index])

This has reproduced across Auto-Dig integration runs reported in #308, #309, and #310 against Prolog-RLM ref eb2411afdaf981a0a121f55b7ddf23dc9fcef812.

Canonical consumer failure: lost-rob0t/starintel-gpt-auto-dig#2095 / workflow run 33268628425.

Expected behavior

The schema presented to the model and the schema enforced by native argument validation must be the same contract. If selector.index is part of the public tool schema for head, tail, or metadata, the native validator must accept it. If it is not supported, it must not be advertised to the model.

Required fix

  • Make schema projection and native validation derive from one authoritative context-tool argument contract.
  • Add regression coverage for model-emitted context_peek JSON containing selector.type, selector.count, and selector.index.
  • Cover at least head, tail, and metadata selectors.
  • Verify direct mode can execute the accepted call rather than failing in preflight.
  • Add a test proving the projected provider/tool schema cannot advertise a field rejected by the native validator.

Reproduction evidence

The model successfully returns tool calls, but context_calls=0 and tool_calls=0; the run dies before any context operation executes. The repeated integration reports contain the full sanitized traces.

## Problem The native direct-mode `context_peek` contract exposed to the model and the runtime validator disagree. Auto-Dig repeatedly receives model calls shaped like: ```json { "context": "input", "selector": { "count": 20, "index": 0, "type": "head" } } ``` The call is then rejected during native-call preflight with: ```text phase=schema kind=malformed_arguments message=native context arguments are malformed detail=unexpected_fields([index]) ``` This has reproduced across Auto-Dig integration runs reported in #308, #309, and #310 against Prolog-RLM ref `eb2411afdaf981a0a121f55b7ddf23dc9fcef812`. Canonical consumer failure: lost-rob0t/starintel-gpt-auto-dig#2095 / workflow run `33268628425`. ## Expected behavior The schema presented to the model and the schema enforced by native argument validation must be the same contract. If `selector.index` is part of the public tool schema for `head`, `tail`, or `metadata`, the native validator must accept it. If it is not supported, it must not be advertised to the model. ## Required fix - Make schema projection and native validation derive from one authoritative context-tool argument contract. - Add regression coverage for model-emitted `context_peek` JSON containing `selector.type`, `selector.count`, and `selector.index`. - Cover at least `head`, `tail`, and `metadata` selectors. - Verify direct mode can execute the accepted call rather than failing in preflight. - Add a test proving the projected provider/tool schema cannot advertise a field rejected by the native validator. ## Reproduction evidence The model successfully returns tool calls, but `context_calls=0` and `tool_calls=0`; the run dies before any context operation executes. The repeated integration reports contain the full sanitized traces.
Author
Owner

Implemented in #314 (branch fix/312-peek-schema-contract, base main). The native validator now accepts the exact model-emitted shape reported here: selector:{type,count,index} with type as the only required field, optional index/count validated against the advertised minima (index >= 0, count >= 1), with defaults when omitted (head/tail count -> bounded whole, item index -> 0). Local deterministic gate: 1077/1077 tests, exit 0. CI on the PR is the canonical gate.

Implemented in #314 (branch `fix/312-peek-schema-contract`, base `main`). The native validator now accepts the exact model-emitted shape reported here: `selector:{type,count,index}` with `type` as the only required field, optional `index`/`count` validated against the advertised minima (index >= 0, count >= 1), with defaults when omitted (head/tail count -> bounded whole, item index -> 0). Local deterministic gate: 1077/1077 tests, exit 0. CI on the PR is the canonical gate.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/prolog-rlm#311
No description provided.