8daf03063d
When the middle section is < 10% of threshold tokens AND at least one prior real-usage ineffectiveness strike has been recorded, skip the expensive LLM summarization call and fall through to the deterministic message-dropping path. Without this guard, a tool-heavy session where the protected tail already holds most of the tokens can burn 500+ seconds on a summary call that replaces a few lightweight messages with negligible token savings. Key design decisions per GottZ review on PR #60451: 1. Separate _prellm_skip_count counter — never increments _ineffective_compression_count (the strike counter that latches at >=2 to disable compression entirely). One real strike + one skip must NOT permanently lock out compression until /new. 2. feasibility_skip sentinel flag — exempts skips from the abort branch (abort_on_summary_failure / _last_summary_auth_failure / _last_summary_network_failure). A stale failure flag from a prior cycle must not turn a deliberate skip into a full abort. 3. reason=None for feasibility-skip fallbacks — a stale _last_summary_error from an earlier real failure must not be embedded into the skip's deterministic fallback marker. 4. info-level logging for feasibility-skip fallbacks (not warning) — this is an intentional optimization, not a failure. Skipped when force=True (manual /compress) so auth/error handling paths are always exercised on explicit user request. Adds 6 regression tests (TestPreLlmFeasibilityCheck) covering: - Strike counter isolation - Stale auth/network failure flag immunity - force=True bypass - No-skip when no prior strikes - Counter reset on session reset Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: TRON <tron-agent@agentmail.to>