Repository navigation
fix: label incomplete scan usage and show measurement times - #1640
Conversation
mldangelo-oai
left a comment
There was a problem hiding this comment.
Thanks for making the measurement window and partial coverage explicit. Keeping measured usage alongside the separate cost estimate is useful, and the shared reporting guidance explains the distinction well.
One concrete cleanup before merging: test_cli_scan_history_persists_per_scan_cost still requires the raw cost_json value to equal the old flat cost object, so all three pricing variants fail. I suggest deleting only the direct SQLite read/equality block at test_workbench_scan_history.py:523-528. The preceding fresh list-scans and get-scan calls already verify the full persisted cost through the public contract. I tested that deletion in memory; all three variants passed.
Two optional follow-ups:
_read_rollout_usagecan require a finite completion timestamp now that its production caller always supplies one. Giving the parity fixture a fixed cutoff would remove three nullable-window branches.- Consider preserving valid account-limit observations when only token reconciliation fails. A synthetic delayed-cache case retained a valid allowance reading in the rollout reader, but the collector's
token_breakdown_unavailablereturn discarded it and the observation timestamps. This would also need a narrow update to the unavailable-usage validator. If deferred, a short documentation caveat would clarify that these observations can be omitted when token attribution fails.
The remaining role, window, and incomplete-measurement tests look useful; I would keep them.
b61bc41 to
00b2902
Compare
Adapt the closed-turn coverage checks and regression cases from #1759 to the rebased collector. Keep open-turn warnings and completion-turn handoff behavior.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Report partial token usage when scan-owned workers have missing receipts or unfinished turns. Preserve recorded tokens instead of treating missing usage as a complete zero.
Changes
Testing
Risk and rollout
Usage metadata is additive. Existing cost fields remain unchanged. Consumers can see partial coverage where earlier versions reported complete coverage. The exact parent completion turn can extend the saved measurement window to include its final response.
These checks flag gaps visible in local records. They do not recover unrecorded server responses or establish a billing total. Native cancellation, scan results, and stopping behavior are unchanged.
Public disclosure review