Skip to content

Commit 5592b88

Browse files
fix(opencode): restrict cumulative aggregate fallback
Allow cumulative session rows only for session reports and unbounded requests, so period reports cannot group session totals by creation date. Collect message session IDs across configured directories before adding aggregate fallbacks while preserving legacy and v2 message deduplication. Co-authored-by: amirh-amini <[email protected]>
1 parent 92fc162 commit 5592b88

3 files changed

Lines changed: 346 additions & 41 deletions

File tree

‎rust/adapters/opencode/src/lib.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,22 @@ pub fn has_data() -> bool {
2626
}
2727

2828
pub fn run(args: AgentCommandArgs) -> Result<()> {
29+
let kind = args.kind;
2930
let shared = args.shared;
30-
let mut entries = loader::load_entries(&shared)?;
31+
let mut entries = loader::load_entries(&shared, kind)?;
3132
filter_loaded_entries_by_date(&mut entries, &shared);
3233
if wants_json(&shared) {
3334
return print_json_or_jq(
34-
report_json(&entries, args.kind, &shared.order)?,
35+
report_json(&entries, kind, &shared.order)?,
3536
shared.jq.as_deref(),
3637
shared.no_cost,
3738
);
3839
}
39-
let mut rows = summarize_entries(&entries, args.kind)?;
40+
let mut rows = summarize_entries(&entries, kind)?;
4041
sort_summaries(&mut rows, &shared.order, |row| summary_period(row));
4142
print_usage_table(
4243
"OpenCode Token Usage Report",
43-
first_column(args.kind),
44+
first_column(kind),
4445
&rows,
4546
&shared,
4647
false,

0 commit comments

Comments
 (0)