[codex] Add project-level Codex cost rollups - #1820
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05481806da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ForEach(Array(self.projects.prefix(Self.maxVisibleProjectRows)), id: \.projectRowID) { project in | ||
| VStack(alignment: .leading, spacing: Self.projectSourceSpacing) { | ||
| self.projectParentRow(project) | ||
| if project.sources.count > 1 { |
There was a problem hiding this comment.
Show single differing source paths
When a project has exactly one source whose path differs from the canonical project path, such as usage that came only from a .codex/worktrees/... checkout, this condition hides the only source row. The submenu then shows the rolled-up main worktree path but drops the source CWD detail that the project rollup is supposed to preserve; consider showing sources when the sole source path differs from project.path, not only when there are multiple sources.
Useful? React with 👍 / 👎.
| [ | ||
| project.name, | ||
| project.path ?? "", | ||
| "\(project.totalTokens ?? -1)", | ||
| Self.formatOptionalDoubleForSignature(project.totalCostUSD), | ||
| ].joined(separator: ",") |
There was a problem hiding this comment.
Include project sources in refresh signatures
When an open menu already has a Codex project row and only its source breakdown changes while the project total stays the same, this signature remains unchanged because it records only the parent project fields. In that case didMenuAdjunctReadinessChange can skip invalidation and leave the visible Projects section showing stale source rows; include source path/name/totals in the project signature.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 1, 2026, 9:15 AM ET / 13:15 UTC. Summary Reproducibility: yes. source inspection gives a high-confidence reproduction path for the review findings: a single differing source is hidden by Review metrics: 3 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a narrow additive project-rollup implementation after maintainers approve path/privacy and cache-upgrade behavior, and after the branch preserves source details, refreshes source rows correctly, and includes real CLI/menu proof. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence reproduction path for the review findings: a single differing source is hidden by Is this the best way to solve the issue? No. The feature direction is plausible, but this implementation should first fix source-detail rendering and refresh invalidation, prove cache upgrade behavior, add real behavior proof, and get maintainer approval for path exposure. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 54003cfe5f43. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Superseded and landed via #1884 at 1e49619. The maintainer rewrite preserved contributor credit, rebased the feature onto current Thanks @clemenspeters for the original project-rollup contribution! |
Summary
--group-by project, and the cost history submenuWhy
Codex sessions spawned in
.codex/worktrees/*/<repo>were shown as separate projects, which made customer/project totals hard to read. This keeps the detailed source breakdown while showing the true combined project total first.Closes #1819
Validation
swift build --product CodexBarCLIswift build --product CodexBarswift test --filter 'CostUsageScannerBreakdownTests|CostUsageCacheTests|CLICostTests|CostHistoryChartMenuViewTests'codexbar cost --provider codex --group-by project --days 30 --no-color