Skip to content

apr code: record the prompt bytes sent and consumed, and exit ≠ 0 when consumed < sent (L22 slice 1) #5190

Closed as not planned

Description

@noahgift

Refs #4600. This is the first slice of L22, for apr code only. run, chat and serve come in a later slice. The SHACL shape and the 200 KB cell in the #3715 suite come in another.

Defect. apr code does not record how much of its prompt reached the model. #4601 (#4599) refuses an over-budget prompt instead of dropping it. Still, a result can say Pass while nothing proves the whole prompt was consumed.

Done when:

  1. Measure. The agent turn measures the current prompt as it appears in the request handed to the driver:
    • input_bytes_sent: the prompt's bytes.
    • input_bytes_consumed: the bytes of that prompt present in the request.
    • prompt_sha256: the hash of the consumed bytes.
    • prompt_tokens: the count from the same counter that sizes the window.
  2. Fail loudly. When consumed < sent, the turn ends with an input_not_consumed error. apr code exits ≠ 0, and the JSON result reports "kind": "input_not_consumed".
  3. Record. The four fields go into the -p --output-format json result document and into the session trace's session_end record.
  4. Prove. A falsifier plants a one-byte drop between the loop and the driver and must turn red. A prompt at the window limit must stay green with sent == consumed.

Agent: aprender-w71-e3a

Activity

  1. added this to the 0.71.0 milestone on Oct 12, 2026
  2. noahgift commented on Oct 12, 2026

    @noahgift
    ContributorAuthor

    Status: a fix is committed locally (3f4ab48d7b, off main 8c12fca) and waits for a PR slot.

    • Each agent turn measures its prompt on the request exactly as handed to the driver: input_bytes_sent, input_bytes_consumed, prompt_sha256, prompt_tokens.
    • consumed < sent ends the turn with input_not_consumed before the driver is called (exit != 0; JSON "kind": "input_not_consumed").
    • The four fields are in the -p --output-format json document and in the trace's session_end record.
    • FALSIFY-5190-001 (planted one-byte drop) is red; -002 (same prompt, unplanted) is green; -003 (largest prompt the window admits) is green with sent == consumed, and one byte more is context_overflow.
    • Measured: clippy -D warnings clean; 935/936 agent:: tests pass, including all 9 new ones. The single failure, test_find_apr_binary, needs an apr on PATH and is unrelated to this diff.

    Limits: the measurement is at the request boundary, not inside a backend, and the error path still writes no session trace.

  3. added
    P1High priority
    and removed
    P0Critical priority
    on Oct 14, 2026
  4. noahgift commented on Oct 14, 2026

    @noahgift
    ContributorAuthor

    P0 to P1 (2026-10-14 P0 triage): P0 now means it blocks the next release or carries the operator's own words on it; this issue does neither, so it stays on the 0.71.0 milestone at P1.

  5. modified the milestones: 0.71.0, 0.72.0 on Oct 14, 2026
  6. noahgift commented on Oct 14, 2026

    @noahgift
    ContributorAuthor

    Folded into #5335 as a checklist row (TRIAGE-100, 2026-10-14): the open-ticket cap is 100, so this ticket is now tracked on that master and closed as not planned. Nothing is lost: reopen it when its work resumes, and an open PR for it reopens it.

    Agent: aprender-clerk

  7. modified the milestones: 0.72.0, 0.73.0 on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priorityowner:aprender-cdOwned by session aprender-cd

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions