Repository navigation
Share Session usage accounting across Run metrics and Experiments - #1322
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Run metrics and Experiments now resolve equivalent trace evidence through one Session usage module. Partial totals preserve omitted token/cache fields and costs; reported zeroes remain authoritative.
No stored records or trace formats change. Historical metrics use the shared reader without rewriting saved completion snapshots. The glossary, navigation index, guide and hand-written site pages describe the settled rules.
Closes #1319
Evidence
cargo test --test metrics partial_model_totals_preserve_known_call_usage -- --exact --nocapturefailed on the review base: input/cache reads became null after an output-only Model total.After: the same regression passes with input 16, output 3, cache reads 5; replacing raw input with 20 yields inclusive input 25, retaining cache reads and call cost.
cargo check --all-targetsandcargo clippy --all-targets -- -D warningspass. All 50 site browser tests pass on the final commit.distinct_suite_task_pairs_keep_distinct_trial_resultsafter its fake Model Grader failed. The exact isolated rerun passed:cargo nextest run --test experiments -E 'test(=distinct_suite_task_pairs_keep_distinct_trial_results)'(1 passed, 32.6 s). No product-code change was made for the unreproduced failure.f540a16c:scripts/affected-tests mainpassed all 50 site browser tests and all 3,022 Rust tests (66 skipped). Timed selector wall time: 1,954.34 s, including 52.41 s of Rust compilation; Nextest test execution: 1,715.83 s.Test seams
session::usage::from_eventsandsession::usage::from_spans: equivalent normalized events and recorded retained spans, returning one owned Session usage summary; summary addition combines distinct Sessions.thirdshift metrics ... --json: historical reconstruction, partial Model totals, and completion snapshots.Review coverage
Independent
thirdshift-code-reviewStandards and Spec reviews againstmain(6ecf0715) each found zero findings and inspected all 15 changed files, including generatedsite/docs/index.html. Neither axis excluded generated output. No changed file was left unread.Reports, including each axis's complete files-read list, are retained at
.thirdshift-review-TcwoHu/standards.mdand.thirdshift-review-TcwoHu/spec.mdfor the Session trace.Unaddressed findings
Standards
None.
Spec
None.
Security
None. Guidance-mode review of
6ecf0715...HEAD(15 files, accounting consolidation intosrc/session/usage.rs) found no introduced vulnerability: inputs are the operator's own local session traces and retained spans (no lower-trust principal, no new sink, network, auth, secret, or filesystem-discovery path); thethirdshift.model_usageJSON parse, saturating u64 arithmetic, and cost handling moved verbatim from the prior per-consumer implementations; thetrace::setvisibility widening stays inside the crate-privatesessionmodule; and the harness cache-convention check is behavior-identical (Claude | Grok). No proof-of-concept failed, so no Security fix was made.session::usageunit tests (10 passed) and thepartial_model_totals_preserve_known_call_usagemetrics regression pass. No pre-existing Base-branch findings were tested or recorded in this review.Security review outcome
No unaddressed introduced findings.
Merge Danger
Door: two-way
Reader/accounting refactor; no data migration. Existing completion snapshots remain fixed.
Blast Radius: accounting
New or historically reconstructed Run metrics and Experiment token/cost summaries use the shared rules.
Built with codex · gpt-6.1-sol · xhigh