Skip to content

[3960 by GPT-6.2 Sol] OpenCode cost: a partial step sum must not be recorded as the run's authoritative provider cost - #3961

Merged
integry merged 1 commit into
3758-epic-runtime-abstraction-sc0from
3960/gpt-6.2-sol-opencode-cost-a-partial-s-20261201-1126-jrk
Dec 1, 2026
Merged

integry merged 1 commit into
3758-epic-runtime-abstraction-sc0from
3960/gpt-6.2-sol-opencode-cost-a-partial-s-20261201-1126-jrk

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3960

Branch: 3960/gpt-6.2-sol-opencode-cost-a-partial-s-20261201-1126-jrk
Commits: ✅ Changes committed (a0bc38d)


AI Processing Completed

Execution Details:

Summary:
OpenCode now reports a provider cost only when it has a valid cumulative total or a valid cost for every distinct completed step. Duplicate events still count once, and an explicit whole-run zero is preserved.

Removed duplicate providerCostUsd assignments from the failure adapters. A regression test verifies that a zero-cost step plus an unpriced step uses whole-run token pricing.

All 104 focused tests and the core TypeScript check passed.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (2 files)
    • packages/core/src/agents/impl/openCodeParsing.ts (+15/−8)
    • packages/core/src/agents/impl/utils/failedAgentExecution.ts (+0/−2)
  • Low risk (2 files)
    • test/llmMetricsProviderCost.test.ts (+12/−0)
    • test/opencodeCostReporting.test.ts (+17/−14)

Diff size: 4 files changed, +44/−24 lines

View task for the run's logs and conversation.


This PR was created automatically by ProPR after processing issue #3960.


💡 Need changes?

Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!

OpenCode now reports a provider cost only when it has a valid cumulative total or a valid cost for every distinct completed step. Duplicate events still count once, and an explicit whole-run zero is preserved.

Removed duplicate `providerCostUsd` assignments from the failure adapters. A regression test verifies that a zero-cost step plus an unpriced step uses whole-run token pricing.

All 104 focused tests and the core TypeScript check passed.

ProPR-Agent: codex/gpt-6.2-sol

integry commented Dec 1, 2026

Copy link
Copy Markdown
Owner

/review

@propr-dev

propr-dev Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

Ready to merge within scope, based on static review of the supplied diff and surrounding code. The change is focused and implements the intended cost-completeness rule.

✅ Complete totals only — Unpriced distinct steps suppress the incremental cost sum, while a later valid repeat resolves the missing cost.

✅ Zero remains meaningful — Nullish fallback preserves an explicit cumulative zero, and priced-step deduplication prevents repeated costs from being added.

✅ Fallback coverage — The new regression verifies that a zero-cost step plus an unpriced step retains aggregate tokens and reaches token pricing. Removing duplicate adapter assignments preserves existing behavior.

The supplied current-head status reports 17 passed checks and no failures. No commands or tests were run during this review.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Cover duplicate-token fallback

Consider a follow-up test combining repeated step IDs with an unpriced distinct step. applyOpenCodeUsage currently adds tokens from repeated step events even though cost accounting deduplicates them, so token-based estimates can overcount repeated usage. This is a pre-existing token-accounting limitation, separate from this PR’s correction to provider-cost completeness.

Score

The implementation satisfies the scoped objective with targeted regression coverage and passing current-head checks. Static tracing found no merge-blocking regression.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 40s
  • Tokens: 38,058 (37,646 in / 412 out)
  • Cost: $0.29

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S1

🤖 Review by ProPR

@propr-dev propr-dev Bot changed the title 🔨 [3960 by GPT-6.2 Sol] OpenCode cost: a partial step sum must not be recorded as the run's authoritative provider cost ✅❾ [3960 by GPT-6.2 Sol] OpenCode cost: a partial step sum must not be recorded as the run's authoritative provider cost Dec 1, 2026
@integry
integry merged commit c0c0738 into 3758-epic-runtime-abstraction-sc0 Dec 1, 2026
49 checks passed
@propr-dev propr-dev Bot changed the title ✅❾ [3960 by GPT-6.2 Sol] OpenCode cost: a partial step sum must not be recorded as the run's authoritative provider cost [3960 by GPT-6.2 Sol] OpenCode cost: a partial step sum must not be recorded as the run's authoritative provider cost Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant