feat: include projectPath (workdir) in session reports for all agents - #1618
feat: include projectPath (workdir) in session reports for all agents#1618caius-kong wants to merge 1 commit into
Conversation
Only the pi adapter was emitting projectPath because the generic/claude/qwen loaders passed include_project_path=false to summary_rows(). summary_metadata() already gates the field on session_id being present, so enabling it only affects session reports (daily/weekly/monthly aggregate rows have no session_id and are unchanged). Displaying the workdir for every agent's sessions is useful for dashboards built on top of ccusage (e.g. session grouped by directory).
|
This PR was auto-closed. Only contributors approved with Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply. If a maintainer replies See CONTRIBUTING.md. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe unified loader now includes ChangesSession project path metadata
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Clippy (1.97.1)Clippy execution failed Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Important
Unified Codex session rows still do not expose metadata.projectPath, so the all-agent behavior described by this PR is incomplete.
Reviewed changes
This review covers the single commit that enables existing project-path metadata for the generic, Claude, and Qwen unified session-report paths.
- Generic session rows — passes
include_project_path = truethrough the shared summary-row helper. - Claude and Qwen sessions — enables the same metadata for their dedicated session loaders.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Luna (free via Pullfrog for OSS) | 𝕏
| // Include projectPath (workdir) in session reports for every agent. | ||
| // summary_metadata() only emits it when a session_id is present, so | ||
| // daily/weekly/monthly aggregate rows are unaffected. | ||
| rows: summary_rows(agent, summaries, true), |
There was a problem hiding this comment.
This flag only affects the shared summary_rows path, while unified Codex sessions bypass it through load_codex_rows and codex_group_row. As a result, ccusage session --json still has no metadata.projectPath for Codex rows, despite the PR's all-agent claim; please cover that path or narrow the stated scope.
Technical details
# Cover the Codex session path
## Affected sites
- `rust/crates/ccusage-adapter-all/src/loader.rs:628-657` — `load_codex_rows` constructs Codex rows directly.
- `rust/crates/ccusage-adapter-all/src/loader.rs:830-833` — `codex_group_row` emits session metadata without `projectPath`.
## Required outcome
- Unified Codex session JSON includes `metadata.projectPath` as promised, or the PR description explicitly narrows the feature to adapters backed by `summary_rows`.
Summary
Only the pi adapter was emitting
projectPath(the workdir) in session reports, because the generic / claude / qwen loaders passedinclude_project_path = falsetosummary_rows().This PR flips those session-report call sites to
true, so all agents getmetadata.projectPathinccusage session --json.Why
Tools built on top of ccusage (like dashboards) want to group sessions by working directory. Today that data only exists for pi — claude / openclaw / codex / qwen sessions are just opaque IDs.
Safety
summary_metadata()already gates the field onsummary.session_id.is_some():So daily / weekly / monthly aggregate rows (no session_id) are unchanged. Only session reports gain the field.
Verified
cargo check -p ccusage-adapter-allpassescargo test -p ccusage-adapter-all --no-runcompilesSummary by cubic
Include metadata.projectPath (workdir) in session reports for all agents; previously only pi emitted it. Aggregated daily/weekly/monthly reports remain unchanged because the field only appears when a session_id is present.
ccusage session --jsononly; aggregated reports are unaffected.rust/crates/ccusage-adapter-all/src/loader.rs, flipping include_project_path to true in three call sites.Written for commit 3905098. Summary will update on new commits.
Summary by CodeRabbit