Skip to content

optimize: low-worth sessions with zero edits claim the full session as recoverable savings #640

Description

@avs-io

Problem

estimateLowWorthRecoverableTokens returns the entire session token total when editTurns === 0 (src/optimize.ts:1971). That per-session number feeds tokensSaved, the headline "Potential savings: X tokens ($Y, ~Z% of spend)" (src/optimize.ts:2557-2563), and the JSON potentialSavingsCostUSD / per-finding estimatedSavingsUSD. The finding text hedges (review candidate, not proof of waste), but the number asserts the whole session cost is savable. An exploration-heavy user sees an upper bound presented as a point estimate, and it inflates the setup-health picture.

The retry path already does this right: it applies a bounded recovery fraction. Only the no-edit branch claims 100%.

Evidence

  • src/optimize.ts:1967-1978, specifically :1971 if (editTurns === 0) return tokens
  • Headline roll-up: src/optimize.ts:2557-2563; JSON: :2619-2650
  • Verified on main at 1a75484.

Proposed fix

Either apply a conservative recovery fraction to the no-edit case (mirroring the retry branch), or exclude low-worth candidates from the summed dollar headline entirely and present them as a review list without a claimed dollar figure. Realized-savings measurement (act report) makes honesty here cheap to keep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions