Skip to content

fix(opencode): sub-1% usage units (port 0.45.2 #2331)#215

Merged
Finesssee merged 1 commit into
mainfrom
port/045-opencode-percent-units
Jul 21, 2026
Merged

fix(opencode): sub-1% usage units (port 0.45.2 #2331)#215
Finesssee merged 1 commit into
mainfrom
port/045-opencode-percent-units

Conversation

@Finesssee

@Finesssee Finesssee commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

First PR of the 0.43 → 0.45.2 Windows port stack.

Ports upstream CodexBar steipete#2331 / v0.45.2: OpenCode and OpenCode Go must not treat a computed used/limit percent (already 0…100) with the direct-field fraction heuristic (<= 1 → *100). That turned real 1% usage into 100% (false exhausted).

  • Direct fields (usagePercent, etc.) may still be 0…1 fractions → scale to percent
  • used/limit (and aliases) stay as (used/limit)*100 with no second scale
  • Drop raw "usage" as a percent key in the scraper (token counts)

Audits (read-only upstream)

  • %TEMP%\port-045\audit-backend.md
  • %TEMP%\port-045\audit-ui.md
  • %TEMP%\port-045\audit-skip.md

Test plan

  • cargo test --manifest-path rust/Cargo.toml --lib providers::opencode
  • cargo test --manifest-path rust/Cargo.toml --lib providers::opencodego
  • New fixtures: used=1/limit=100 → 1%; used=1/limit=200 → 0.5%; direct 0.25 → 25%

No version bump / packaging (port stack continues).


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

@Finesssee
Finesssee merged commit 4cb9208 into main Jul 21, 2026
1 check failed
@Finesssee
Finesssee deleted the port/045-opencode-percent-units branch July 21, 2026 01:48
@github-actions

Copy link
Copy Markdown

This repository allows each user to open at most 4 pull requests per 7 days.

Closing this automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant