Skip to content

reasoning-drop never fires in single-user-message marathon sessions (closed-turn gate unreachable) #348

Description

@ranxianglei

Session 01a086ff-92ff-76a5-a141-3c839666877d (/tmp, qwen3.8-27b, v0.1.62-pr.347.141, ~/.pi/acp.json compress.reasoning = {drop:true, threshold:1}): 64 entries, genuine user text messages ONLY at lines 3/5 (the opening prompt); 3 closed compress calls (lines 34/49/60) each carrying 20612 / 8411 / 10581 chars of thinking on the compress-call assistant message; zero [reasoning-drop] events — the ~39.6k-char thinking floor rode EVERY request.

Instrumented dist (patched call site): cfg={drop:true,threshold:1} arrives correctly; lastUserIdx=1 (the OPENING prompt); compressMsgs=30 — 30 >= 1, outside the closed zone.

Root cause: dropCompressReasoning (src/reasoning-drop.ts, #339; same gate in billion-context #651/PR #667) treats messages strictly before the last genuine user message as closed. In a single-prompt agent marathon — one user message at the head, model works the whole session, exactly the scenario that builds the largest thinking floor — lastUser sits at the session head, so every compress turn is forever the active round and is never dropped.

Proposed fix: close on round evidence — a compress call is closed once its tool result has arrived AND any later message exists (the conversation moved past it). Provider safety stays via per-provider layering (drop:false for reasoning-echo providers, e.g. GLM reasoning_content).

Cross-refs: pi #339 (merged), billion-context #651 / PR #667 (open, same gate proxy-side).

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions