Skip to content

Doubao: query Coding/Agent Plan usage via arkcli CLI - #2221

Merged
steipete merged 19 commits into
steipete:mainfrom
start3015:doubao-arkcli-usage
Jul 18, 2026
Merged

Doubao: query Coding/Agent Plan usage via arkcli CLI#2221
steipete merged 19 commits into
steipete:mainfrom
start3015:doubao-arkcli-usage

Conversation

@start3015

Copy link
Copy Markdown
Contributor

Summary

  • Replace the Volcengine AK/SK signed API with arkcli usage plan CLI (SSO-based) for fetching Coding Plan and Agent Plan usage
  • Split Doubao menu card into "Coding Plan" and "Agent Plan" sections with group headers
  • Replace placeholder smiley icon with official Volcengine logo SVG

Why

The signed Volcengine API (GetCodingPlanUsage / GetAgentPlanUsage) required users to obtain AK/SK credentials separately and did not work well. The arkcli CLI uses the same SSO session the user already has, making setup trivial - just install arkcli and arkcli auth login.

Changes

  • DoubaoUsageFetcher: new fetchCodingPlanUsage(runArkcli:) runs arkcli usage plan and decodes the JSON response. Old Volcengine signer code removed.
  • DoubaoAPIFetchStrategy: try arkcli CLI first, fall back to Ark API key rate-limit probe.
  • MenuCardView: split Doubao metrics into two groups (Coding Plan / Agent Plan) with section headers. Other providers unaffected (guard provider == .doubao).
  • ProviderIcon-doubao.svg: official Volcengine logo (MIT-licensed, from thesvg.org).
  • Tests updated to match new arkcli JSON format and strategy interface.

Closes #1724.

Replace the Volcengine AK/SK signed API approach with arkcli CLI
(SSO-based). The signed API was unreliable and required users to
obtain AK/SK credentials separately; arkcli uses the same SSO session
the user already has, making setup trivial.

Changes:
- DoubaoUsageFetcher: new fetchCodingPlanUsage(runArkcli:) runs
  `arkcli usage plan` and decodes the JSON response (items[].periods[]
  with label/percent/reset_at fields). Old Volcengine signer code
  removed.
- DoubaoAPIFetchStrategy: try arkcli CLI first, fall back to Ark API
  key rate-limit probe. Removed AK/SK fallback path.
- MenuCardView: split Doubao metrics into "Coding Plan" and
  "Agent Plan" groups with section headers for visual clarity.
  Other providers are unaffected (guard on provider == .doubao).
- ProviderIcon-doubao.svg: replace placeholder smiley with official
  Volcengine logo SVG (MIT-licensed, from thesvg.org).
- Tests: updated to match new arkcli JSON format and strategy interface.

Closes steipete#1724.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30acfec624

ℹ️ 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".

private struct ArkcliUsageItem: Decodable {
let product: String
let subscribed: Bool?
let periods: [ArkcliPeriod]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Decode error-only plan items without failing all usage

When arkcli usage plan returns a per-bucket failure, its usage-plan reference says the bucket is represented with items[].error while other buckets remain usable; making periods required means JSONDecoder rejects the entire stdout whenever one probed product returns an error item, so a single failed team/coding bucket prevents displaying otherwise valid subscribed plan usage.

Useful? React with 👍 / 👎.

for item in response.items {
let isAgent = item.product == "agent-plan"
if let updatedAt = item.updatedAt, updatedAt > 0 {
updateTime = updateTime ?? Date(timeIntervalSince1970: updatedAt)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat arkcli updated_at as milliseconds

For CodingPlan items, the usage plan reference documents updated_at as epoch milliseconds, but this line passes the raw value to Date(timeIntervalSince1970:) as seconds; when the CLI emits a normal millisecond timestamp, the snapshot timestamp jumps thousands of years into the future, which makes “updated” labels and any freshness/history logic incorrect.

Useful? React with 👍 / 👎.

var status: String?

for item in response.items {
let isAgent = item.product == "agent-plan"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Classify team Agent Plan products as agent windows

The CLI returns both personal and team product ids (agent-plan, coding-plan, agent-plan-team, coding-plan-team), but this exact comparison treats agent-plan-team as a coding product; team Agent Plan quotas therefore get unprefixed, can occupy the Coding Plan primary/secondary/tertiary windows, and disappear from the Agent Plan section.

Useful? React with 👍 / 👎.

Comment on lines +80 to +82
do {
let usage = try await self.cliUsageLoader()
return self.makeResult(usage: usage.toUsageSnapshot(), sourceLabel: "cli")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor explicit API source before running arkcli

When Doubao is configured with source api, this strategy still runs arkcli first and returns its SSO plan data on success, so users who explicitly selected API key probing—especially because arkcli is logged into a different account or they only want Ark rate-limit headers—never reach the API-key fallback despite .api being an advertised source mode.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed July 17, 2026, 8:03 PM ET / July 18, 2026, 00:03 UTC.

Summary
The branch adds SSO-backed arkcli usage retrieval for Doubao Coding and Agent Plans, retains API credential retrieval, and updates the menu, docs, localization, and focused tests.

Reproducibility: yes. from source: configure Doubao as cli with API credentials present, or as api without credentials, then trigger a normal app refresh and observe that the default mode is used instead of the explicit selection.

Review metrics: 2 noteworthy metrics.

  • Patch surface: 38 files affected; 1,654 additions and 69 deletions. The provider integration spans fetch routing, process execution, UI, docs, localization, and tests, so the remaining routing regression should be fixed with focused coverage before merge.
  • Revision history: 19 commits. The branch has already incorporated several compatibility repairs, making continuity against the remaining prior P1 especially important.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Propagate the persisted Doubao source mode into normal app refreshes.
  • [P2] Add routing tests for auto, cli, and api through the app-facing provider path.
  • [P2] Run the focused Doubao suite and make check after the repair.

Risk before merge

  • [P1] Merging before app refreshes propagate the configured Doubao source mode can silently use API credentials when a user selected cli, or use SSO behavior contrary to a documented api choice; this is both an account-selection compatibility risk and an auth-provider routing risk.

Maintainer options:

  1. Propagate the configured source mode (recommended)
    Pass the persisted Doubao auto/cli/api selection into the app refresh context and add focused regression tests before merging.
  2. Accept automatic source routing
    Merge with the current refresh default only if maintainers intentionally want configured cli and api selections to be ignored in the app.
  3. Pause the provider addition
    Pause this PR if the repository does not want to commit to stable source-mode semantics for Doubao accounts.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Propagate the persisted Doubao source mode through app refreshes, add focused routing coverage for auto/cli/api, and run the Doubao-focused tests plus make check.

Next step before merge

  • [P2] A narrow, mechanical source-mode wiring repair and regression suite can resolve the remaining merge blocker without revisiting the accepted arkcli feature direction.

Security
Cleared: The patch executes a user-installed local CLI through the existing binary-location pattern and introduces no dependency, workflow, secret, permission, or download-and-execute change.

Review findings

  • [P1] Honor configured Doubao source modes during app refreshes — Sources/CodexBarCore/Providers/Doubao/DoubaoProviderDescriptor.swift:45-48
Review details

Best possible solution:

Wire the persisted Doubao source setting through the normal refresh path, then add regression coverage proving auto, cli, and api keep their documented account and fallback boundaries.

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

Yes, from source: configure Doubao as cli with API credentials present, or as api without credentials, then trigger a normal app refresh and observe that the default mode is used instead of the explicit selection.

Is this the best way to solve the issue?

No: the provider strategy split is appropriate, but it must receive the persisted source mode from application refreshes; otherwise the documented source controls do not govern normal usage.

Full review comments:

  • [P1] Honor configured Doubao source modes during app refreshes — Sources/CodexBarCore/Providers/Doubao/DoubaoProviderDescriptor.swift:45-48
    The descriptor now supports .cli and .api, but normal app refreshes still obtain the default source mode through DoubaoProviderImplementation rather than the persisted setting. A user who selects cli with API credentials present can still take the API path, while api can retain auto behavior; propagate the configured mode into the refresh context and cover both cases.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 02456949b895.

Label changes

Label changes:

  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is live_output.

Label justifications:

  • P1: Ignoring an explicit source choice can route active users to a different Doubao account or authentication mechanism during normal refreshes.
  • merge-risk: 🚨 compatibility: Configured cli and api source selections may not retain their documented behavior after upgrade.
  • merge-risk: 🚨 auth-provider: The unresolved routing can select ambient arkcli SSO or stored API credentials contrary to the user’s selected source.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The contributor supplied redacted live arkcli usage plan output and a menu screenshot that directly demonstrate the new plan data and rendered UI; the remaining defect is source routing rather than missing proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor supplied redacted live arkcli usage plan output and a menu screenshot that directly demonstrate the new plan data and rendered UI; the remaining defect is source routing rather than missing proof.
Evidence reviewed

Acceptance criteria:

  • [P1] swift test --filter 'CodexBarTests.Doubao'.
  • [P1] make check.

What I checked:

Likely related people:

  • steipete: Authored the recent hardening and merge commits on the affected Doubao/arkcli implementation, including the current PR head. (role: recent area contributor; confidence: medium; commits: e10a6a350a48, 29d789c384bd, 9e6b5c9d3bb3; files: Sources/CodexBarCore/Providers/Doubao/DoubaoProviderDescriptor.swift, Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift, Sources/CodexBarCore/Host/Process/SubprocessRunner.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.
Review history (6 earlier review cycles)
  • reviewed 2026-07-17T01:47:08.166Z sha 4d0bd73 :: needs real behavior proof before merge. :: [P1] Preserve the shipped AK/SK usage path | [P1] Register arkcli as a CLI strategy
  • reviewed 2026-07-17T08:50:16.190Z sha 2c54574 :: needs real behavior proof before merge. :: [P1] Preserve configured credentials in auto mode
  • reviewed 2026-07-17T09:08:37.656Z sha 2c54574 :: found issues before merge. :: [P1] Preserve configured credentials in auto mode
  • reviewed 2026-07-17T20:42:18.311Z sha 36ded78 :: needs changes before merge. :: [P1] Honor Doubao source settings in app refreshes | [P2] Expose extra-only Doubao plans in compact displays
  • reviewed 2026-07-17T21:29:45.681Z sha 98c11fa :: needs changes before merge. :: [P1] Wire configured Doubao source modes into app refreshes | [P2] Make strict subprocess output limits opt-in
  • reviewed 2026-07-17T22:41:46.588Z sha 0323a4b :: needs changes before merge. :: [P1] Honor configured Doubao source modes during app refreshes | [P2] Keep subprocess output limits opt-in

- Split DoubaoAPIFetchStrategy into DoubaoCLIFetchStrategy (kind .cli,
  arkcli SSO) and DoubaoAPIFetchStrategy (kind .apiToken, AK/SK signed
  + Ark API key probe) so --source cli selects arkcli and --source api
  never silently falls through to SSO
- Restore fetchCodingPlanUsage(credentials:) and decodeCodingPlanUsage
  to preserve the shipped AK/SK signed Volcengine API path
- Auto-detect updated_at unit (seconds vs milliseconds) by magnitude
  so real arkcli output (epoch seconds) doesn't render as 1970
- Classify coding-plan-team as agent windows alongside agent-plan-team
- Prefix agent extra windows with 'Agent ' for clear menu separation
- Surface signed error (not generic missing-key) when AK/SK fails and
  no API key is configured
- Add 20+ tests covering routing, fallback, cancellation, signed decode

Co-Authored-By: Claude <noreply@anthropic.com>
@start3015

Copy link
Copy Markdown
Contributor Author

Behavior proof (addressing ClawSweeper P1 findings)

P1-1: AK/SK compatibility restored

The signed Volcengine API path is fully restored in DoubaoUsageFetcher.fetchCodingPlanUsage(credentials:). Existing users with AK/SK credentials keep working — DoubaoSettingsReader.codingPlanCredentials and DoubaoVolcengineSigner are unchanged.

P1-2: Source routing fixed

arkcli is now a separate DoubaoCLIFetchStrategy (kind .cli), not conflated with .apiToken:

--source Strategies Behavior
auto [CLI, API] arkcli first, then AK/SK / API key
cli [CLI only] arkcli only, no API fallback
api [API only] AK/SK + API key probe, never falls through to SSO

Redacted arkcli usage plan output

Details
{
  "viewer": {
    "auth_method": "sso",
    "user_id": "REDACTED",
    "user_name": "REDACTED",
    "account_id": "REDACTED",
    "profile": "agent-plan_cn-beijing_personal",
    "tenant": "volc",
    "region": "cn-beijing",
    "project_name": "REDACTED"
  },
  "items": [
    {
      "product": "agent-plan",
      "edition": "personal",
      "tier": "small",
      "subscribed": true,
      "periods": [
        {"label": "5h", "used": 1309.88, "total": 2000, "percent": 65.49, "reset_at": "2026-07-17T19:46:35+08:00"},
        {"label": "weekly", "used": 5359.78, "total": 7000, "percent": 76.57, "reset_at": "2026-07-20T00:00:00+08:00"},
        {"label": "monthly", "used": 5359.78, "total": 20000, "percent": 26.80, "reset_at": "2026-08-14T23:59:59+08:00"}
      ]
    },
    {
      "product": "coding-plan",
      "edition": "personal",
      "subscribed": true,
      "periods": [
        {"label": "session", "percent": 40.74, "reset_at": "2026-07-17T19:22:45+08:00"},
        {"label": "weekly", "percent": 43.54, "reset_at": "2026-07-20T00:00:00+08:00"},
        {"label": "monthly", "percent": 21.77, "reset_at": "2026-08-15T23:59:59+08:00"}
      ],
      "updated_at": 1784278016
    }
  ]
}

Key observations:

  • auth_method: "sso" — arkcli uses SSO
  • updated_at: 1784278016 — epoch seconds (≈ 2026-07-17 CST); the code now auto-detects seconds vs milliseconds by magnitude
  • All user identity fields redacted

Test results

$ swift test --filter 'CodexBarTests\.Doubao'
✔ Test run with 45 tests in 4 suites passed

New tests cover: source-mode routing (auto/cli/api), CLI fallback semantics, AK/SK signed decode + request signing (headers verified), signed error surfacing, updated_at unit auto-detection, coding-plan-team classification.

Menu screenshot

(dragged into the comment box below)


image

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36ded78e83

ℹ️ 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".

pipeline: ProviderFetchPipeline(resolveStrategies: { _ in
[DoubaoAPIFetchStrategy()]
})),
sourceModes: [.auto, .cli, .api],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor Doubao source settings in the app

Fresh evidence: this commit advertises .cli/.api for Doubao, but app refreshes still get their source from ProviderRegistryDoubaoProviderImplementation.sourceMode; that implementation does not override the default .auto. As a result, a config such as source: cli with an API key present still goes through auto and selects DoubaoAPIFetchStrategy, while source: api without credentials can still run arkcli, so the explicit modes documented by this change are ignored in the app.

Useful? React with 👍 / 👎.

Comment on lines +130 to +133
for plan in [
(levelPrefix: "agent_", idPrefix: "doubao-agent"),
(levelPrefix: "coding_team_", idPrefix: "doubao-coding-team"),
(levelPrefix: "agent_team_", idPrefix: "doubao-agent-team"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Surface extra-only Doubao plans in compact views

When arkcli returns only Agent Plan or team plan buckets, this conversion leaves primary/secondary nil and stores every quota only in extraRateWindows. The existing Doubao menu-bar metric path still falls through to snapshot.primary ?? snapshot.secondary in MenuBarMetricWindowResolver, and widget rows only opt into extra windows for Kimi/Antigravity, so those successfully fetched users get no compact quota/status display outside the new menu card.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Jul 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98c11fa7c9

ℹ️ 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".

Comment on lines +289 to +291
guard capturedStdout.count <= normalizedMaxOutputBytes,
capturedStderr.count <= normalizedMaxOutputBytes
else {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep subprocess output caps opt-in

With this guard on the default path, every existing SubprocessRunner.run caller now throws .outputTooLarge when either stream exceeds 1 MiB instead of receiving the previously truncated prefix. That breaks current expectations such as SubprocessRunnerTests.bounds oversized stdout/stderr and makes callers that use try? for large-but-parseable output (for example process/session scans) drop all data; make the strict failure behavior opt-in for the arkcli call or update the affected callers/tests explicitly.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Doubao: query Coding/Agent Plan usage via arkcli CLI This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7bdbc4d6e

ℹ️ 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".

private struct ArkcliUsageItem: Decodable {
let product: String
let subscribed: Bool?
let periods: [ArkcliPeriod]?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Decode periods only after filtering supported products

When arkcli includes an unsupported or future product bucket whose periods entries do not have the Doubao label/percent shape, this typed field makes JSONDecoder fail before the loop below can hit default: nil and skip that product. In that scenario, one unrelated bucket hides otherwise valid Coding/Agent Plan usage; decode unsupported item payloads more loosely or defer period decoding until after the product is recognized.

Useful? React with 👍 / 👎.

steipete added 2 commits July 18, 2026 00:50
# Conflicts:
#	Sources/CodexBar/Resources/ar.lproj/Localizable.strings
#	Sources/CodexBar/Resources/ca.lproj/Localizable.strings
#	Sources/CodexBar/Resources/de.lproj/Localizable.strings
#	Sources/CodexBar/Resources/en.lproj/Localizable.strings
#	Sources/CodexBar/Resources/es.lproj/Localizable.strings
#	Sources/CodexBar/Resources/fa.lproj/Localizable.strings
#	Sources/CodexBar/Resources/fr.lproj/Localizable.strings
#	Sources/CodexBar/Resources/gl.lproj/Localizable.strings
#	Sources/CodexBar/Resources/id.lproj/Localizable.strings
#	Sources/CodexBar/Resources/it.lproj/Localizable.strings
#	Sources/CodexBar/Resources/ja.lproj/Localizable.strings
#	Sources/CodexBar/Resources/ko.lproj/Localizable.strings
#	Sources/CodexBar/Resources/nl.lproj/Localizable.strings
#	Sources/CodexBar/Resources/pl.lproj/Localizable.strings
#	Sources/CodexBar/Resources/pt-BR.lproj/Localizable.strings
#	Sources/CodexBar/Resources/ru.lproj/Localizable.strings
#	Sources/CodexBar/Resources/sv.lproj/Localizable.strings
#	Sources/CodexBar/Resources/th.lproj/Localizable.strings
#	Sources/CodexBar/Resources/tr.lproj/Localizable.strings
#	Sources/CodexBar/Resources/uk.lproj/Localizable.strings
#	Sources/CodexBar/Resources/vi.lproj/Localizable.strings
#	Sources/CodexBar/Resources/zh-Hans.lproj/Localizable.strings
#	Sources/CodexBar/Resources/zh-Hant.lproj/Localizable.strings
@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Jul 18, 2026
@steipete
steipete merged commit f6e3bd7 into steipete:main Jul 18, 2026
8 checks passed
@steipete

Copy link
Copy Markdown
Owner

Maintainer verification:

  • swift test --filter Doubao: 63 tests in 4 suites passed.
  • swift test --filter SubprocessRunnerTests: 13 tests passed.
  • swift test --filter LocalizationLanguageCatalogTests: 30 tests passed.
  • swift test --filter ArkcliBinaryLocatorTests: 2 tests passed.
  • swift test --filter 'PathBuilderTests|ProviderIconResourcesTests|UserFacingLocalizationCoverageTests': 59 tests passed.
  • make check: locale, docs, package, format, and lint checks passed; SwiftFormat found 0 files requiring formatting and SwiftLint found 0 violations.
  • Exact-head CI run https://github.com/steipete/CodexBar/actions/runs/29622152129 passed all Linux, lint, GitGuardian, and both macOS shards on 8544cae5298a28882a2b88f4f09b95ee7713af7f.
  • Final autoreview reported no accepted/actionable findings after fixing active empty plan buckets to fail closed instead of silently returning partial usage.
  • Live Doubao account verification was unavailable. Synthetic arkcli fixtures and fake executables covered four product variants, JSON argv, authentication states, PATH/node resolution, strict 256 KiB output rejection, partial errors, active subscriptions, timestamp formats/order, and source routing.
  • One exact local CI-shard run hit the unrelated existing BoundedChildProcessProofTests PTY overflow proof flake; the focused Doubao, subprocess, binary-locator, and localization suites above passed.

Merged as f6e3bd74d1af03b630b2329f7240eba2fb708eae.

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

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doubao: surface Coding Plan usage (session/weekly/monthly) via GetCodingPlanUsage instead of "Limits not available"

2 participants