CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

StepFun Token Plan (credit) usage is displayed under the hardcoded "5h Window" label

Open BUKOWSKIREAL opened this issue 2 months ago • 2 comments

Summary

For StepFun accounts on the Token Plan (plan_family: 2, monthly Credit pool), CodexBar renders credit-pool data in the row labeled "5h Window", which is misleading: those accounts have no 5-hour window at all (five_hour_usage_left_rate is 0 and five_hour_usage_reset_time is "0").

Repro

Account on Plus Plan / Token Plan, manual Oasis-Token. QueryStepPlanRateLimit returns:

{
  "status": 1,
  "five_hour_usage_left_rate": 0,
  "five_hour_usage_reset_time": "0",
  "weekly_usage_left_rate": 0,
  "weekly_usage_reset_time": "0",
  "plan_family": 2,
  "plan_credit_rate_limit": {
    "subscription_credit_left_rate": 0.9954,
    "subscription_credit_reset_time": "1792472633",
    "credit_total": "1600000000",
    "credit_residual": "1592675954"
  }
}

Menu shows:

StepFun · Plus · 5h Window 99% 剩余 · 29d 23h后重置

The 99% and the reset time are the credit pool's numbers (subscription_credit_left_rate / subscription_credit_reset_time) — the reset is ~30 days out, which cannot be a 5h window reset. The official platform site shows the same numbers as a monthly credit pool that resets next month, so users reasonably read the CodexBar row as wrong.

Cause

Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:

  • sessionLabel: "5h Window" is unconditional
  • supportsCredits: false, so planCreditRateLimit data has no dedicated presentation lane and falls back to the session lane

StepFunUsageFetcher.parseSnapshot already parses the credit fields (added for #2491); the gap is purely in presentation/labeling.

Suggested fix

When the snapshot is a credit plan (isCreditPlan), present the credit pool under a credit-appropriate label/pace (e.g. "Credit" with the monthly reset, or route it through the supportsCredits lane), instead of the fixed "5h Window" session label.

Related: #2491 (payload-shape classification was fixed there; display was not covered)

BUKOWSKIREAL avatar Sep 20 '26 06:09 BUKOWSKIREAL

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 20, 2026, 2:19 AM ET / 06:19 UTC.

Summary Current main still mislabels StepFun credit balances as five-hour usage. This is a bounded presentation bug; the earlier merged fixes address classification and missing balances, and no open PR owning this label correction was found.

Reproducibility: yes. from source: the supplied payload becomes a monthly primary credit window, and both menu paths obtain the unchanged “5h Window” label. No runtime execution or tests were performed during this read-only review.

Next step A source-proven labeling defect has a narrow existing extension point and clear regression controls, with no open fix PR found.

Review details

Best possible solution:

Use StepFun’s existing snapshot-aware presentation hook to label credit balances correctly while preserving rolling-window labels, percentages, resets, and monthly pace behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: the supplied payload becomes a monthly primary credit window, and both menu paths obtain the unchanged “5h Window” label. No runtime execution or tests were performed during this read-only review.

Is this the best way to solve the issue?

Yes to correcting presentation; the existing descriptor label hook is the narrowest solution. Enabling a separate credits lane is unnecessary, and monthly reset/pace metadata is already present.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f1a9b53a3b1b.

Label changes

Label changes:

  • add P2: The misleading quota label affects StepFun credit-plan users, while balances remain available.
  • add impact:ux-friction: A monthly credit reset displayed as a five-hour window makes otherwise valid usage information confusing.
  • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
  • add clawsweeper:source-repro: Current issue advisory state selects this label.
  • add clawsweeper:queueable-fix: Current issue advisory state selects this label.
  • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.

Label justifications:

  • P2: The misleading quota label affects StepFun credit-plan users, while balances remain available.
  • impact:ux-friction: A monthly credit reset displayed as a five-hour window makes otherwise valid usage information confusing.
Evidence reviewed

Acceptance criteria:

  • make test-fast FILTER=StepFun
  • make test
  • make check

What I checked:

  • Current implementation retains the fixed label: The checkout matches fetched main f1a9b53a3b1bd339c0b4527b2828b61986741bd0. StepFun declares sessionLabel as “5h Window” and supplies no rateWindowLabeler in its presentation configuration. (Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:60, f1a9b53a3b1b)
  • Credit conversion proves the mismatched data path: The supplied payload selects isCreditPlan. Conversion puts its credit percentage and monthly reset in the primary window, with no secondary window; Coding Plans instead produce 300-minute and 10080-minute windows. The credit lane is selected explicitly, rather than falling back because supportsCredits is false. (Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:260, f1a9b53a3b1b)
  • Existing shared repair seam: ProviderUsagePresentation accepts a snapshot-aware rateWindowLabeler and otherwise returns metadata.sessionLabel. Both MenuDescriptor.swift:734 and MenuCardView+ModelHelpers.swift:574 consume this shared label for StepFun, allowing a provider-owned correction without new UI or configuration. (Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift:533, f1a9b53a3b1b)
  • Established behavior and regression controls: Provider documentation states that credit plans have no five-hour or weekly quotas. Existing StepFun tests cover live rolling windows overriding the family identifier, exhausted credit balances, and missing balances, but those parsing assertions do not correct the displayed label. (docs/stepfun.md:53, f1a9b53a3b1b)
  • Related merged work has a different scope: GitHub confirms https://github.com/steipete/CodexBar/pull/2492 merged on 2026-07-29 and closed https://github.com/steipete/CodexBar/issues/2491. Its body explicitly preserves existing Token Plan rendering while changing classification. https://github.com/steipete/CodexBar/pull/3582 subsequently repaired missing-balance conversion, without adding dynamic labels.
  • Release check: The supplied latest release, v0.62.0, also declares the fixed “5h Window” label. No fix release is established. (Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:60, 4b3ed1a2a49a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • LeoLin990405: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar Sep 20 '26 06:09 clawsweeper[bot]

Fixed on main by #3771 (7a1704fffd7375fb6861d74f3d51af0ffc72baf2). StepFun credit balances now use Credit with or without reset metadata, and missing/zero reset dates remain absent. Coding Plan retains its five-hour and weekly labels.

Proof: 46 focused tests across five suites, format/lint checks, independent review, and all CI jobs passed. Signed native before/after menu images and production CLI assertions cover monthly credit, no-reset credit, and Coding Plan controls; the four synthetic images are available here. Thanks @BUKOWSKIREAL for the report, contribution, added cases, and live Plus/Token Plan verification.

steipete avatar Sep 20 '26 11:09 steipete