Skip to content

fix: preserve closed-turn usage coverage gaps - #1759

Closed
fwph-oai wants to merge 1 commit into
mainfrom
fwph/closed-turn-usage-gaps
Closed

fwph-oai wants to merge 1 commit into
mainfrom
fwph/closed-turn-usage-gaps

Conversation

@fwph-oai

Copy link
Copy Markdown
Collaborator

Summary

A later successful turn can hide an earlier interrupted turn or a completed turn with no usage record. Preserve those per-turn coverage gaps so the collector doesn't report the session as fully accounted for.

Changes

Track closed and measured turns and retain an interruption warning across subsequent turns. For example, a synthetic aborted turn followed by a measured successful turn retains turn_interrupted; a completed turn without usage followed by a measured successful turn still reports missing usage. Token totals and scan execution behavior are unchanged.

This complements #1640, which covers empty and open sessions, and #1657, which improves recovery of available usage records. Warnings cannot recover records absent from the local event stream or prove complete telemetry.

Testing

  • Usage collector tests: 93 passed, including 24 new regression cases.
  • Ruff checks and formatting passed; SDK TypeScript build passed.
  • Source compatibility tool tests: 9 passed. The source compatibility check reports an existing baseline violation: tests/test_finalize_scan_contract.py is 150,043 bytes against a 150,000-byte limit (same size in the base commit).
  • Offline synthetic comparison confirms fix: label incomplete scan usage and show measurement times #1640 handles the started-only case; this change adds warnings for the two remaining cases without changing token totals.

Risk and rollout

The change affects collector coverage warnings; it does not alter scan execution. Existing consumers may see warnings for sessions previously reported as complete.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the bug Something isn't working label Oct 19, 2026
@fwph-oai fwph-oai closed this Oct 19, 2026
ianw-oai added a commit that referenced this pull request Oct 19, 2026
Adapt the closed-turn coverage checks and regression cases from #1759 to the rebased collector. Keep open-turn warnings and completion-turn handoff behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant