Skip to content

Preserved compatible reasoning is omitted from context sizing and overflow recovery #385

Description

@Calmingstorm

Confirmed opt-in context-accounting defect

Reviewed master at 886c36d8ebe861aa987059a1744d45b78797baae (v4.7.0). Suggested priority: P2.

Compatible reasoning replay with reasoning_dialect="glm_thinking", glm_clear_thinking=false, and reasoning_content_feedback_policy="preserve" adds reasoning_content blocks to agent history and sends that field on the provider wire. The shared character estimator and truncator omit this field.

Sources: agent history, wire replay, estimator, truncation.

Isolated reproduction

A synthetic agent transcript includes a 10,000-character preserved reasoning block and a paired tool cycle. A fake provider raises a context-overflow error, exercising the real recovery ladder and wire converter with small test rungs.

all 3 attempts: estimated_chars=41, reasoning_wire_chars=10000
recovery rung 1: target=500, compressed_chars=41, fits=True
recovery rung 2: target=250, compressed_chars=41, fits=True
final state: failed

Three reviewers reproduced/verified this using fake provider errors, not live provider calls. The payload component causing the undercount remains unchanged while recovery claims it fits.

Acceptance criteria

  • Count every replayed reasoning field in context measurement.
  • Apply only transformations valid under the selected provider's reasoning replay contract; do not blindly strip or fabricate native reasoning.
  • A recovery report must not claim fit based on excluding bytes that will still be sent.
  • Cover preserve and default do-not-echo modes, normal compaction and overflow recovery.

Scope: explicit preserve mode only; this is not claimed to affect default configuration. Behavior change: accurate budgeting/recovery for that mode. No source changes were made.

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions