Skip to content

fix(opencode): show Zen balance for Go accounts without subscription usage#1498

Open
kiranmagic7 wants to merge 8 commits into
steipete:mainfrom
kiranmagic7:kiran/opencode-zen-balance-only
Open

fix(opencode): show Zen balance for Go accounts without subscription usage#1498
kiranmagic7 wants to merge 8 commits into
steipete:mainfrom
kiranmagic7:kiran/opencode-zen-balance-only

Conversation

@kiranmagic7

@kiranmagic7 kiranmagic7 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • allow OpenCode Go accounts without Go subscription usage fields to fall back to the existing Zen balance fetch
  • render Zen-only accounts as balance-only snapshots instead of false 0% rate windows
  • reuse the Zen fallback when either the initial page precheck or final subscription parser rejects incomplete usage data
  • wait for required fallback data through the caller's full timeout while keeping the 250 ms grace only for optional enrichment
  • cancel the parallel balance task on unrelated failures and use synchronized request recording in concurrent tests
  • keep the existing parse error when neither Go subscription usage nor Zen balance is available

Fixes #1476

Tests

  • swift test --filter OpenCodeGoUsageFetcherErrorTests --skip-update (16 tests passed)
  • make check (SwiftFormat clean, SwiftLint 0 violations, packaging/release-path checks passed)
  • git diff --check
  • full-branch autoreview found two fallback gaps; both fixed
  • follow-up autoreview clean, no accepted/actionable findings

Proof and risk

  • one regression delays the Zen balance response beyond the optional 250 ms enrichment grace and verifies a balance-only snapshot still renders
  • another regression exercises a page that passes the initial rolling-usage precheck but fails final weekly/reset parsing
  • timeout assertions verify required fallback gets the caller's full timeout while successful subscription usage remains non-blocking
  • no live account or browser-cookie probe was run; repository policy requires explicit permission for live provider probes that may access browser or Keychain state
  • provider auth, cookie normalization, endpoints, and storage are unchanged

@clawsweeper

clawsweeper Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed June 15, 2026, 4:29 AM ET / 08:29 UTC.

Summary
The branch adds an OpenCode Go fallback that returns Zen-balance-only usage snapshots when subscription usage fields are absent, extends focused tests, adds a release-note entry, and adds a PR-specific CI artifact build.

Reproducibility: no. high-confidence live reproduction is available yet. Source inspection shows current main fails before Zen balance fallback and the PR has stubbed regressions, but the real Zen-only dashboard payload proof is still absent.

Review metrics: 2 noteworthy metrics.

  • Changed Surface: 6 files, +343/-46. The diff touches provider fetch concurrency, snapshot rendering, tests, release notes, and CI, so review needs both code and proof checks.
  • Workflow Change: 1 CI workflow modified. The branch adds a PR-specific app artifact path that maintainers should notice before merging workflow config.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

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

Rank-up moves:

  • [P2] Fix the required Zen fallback so parent cancellation wins even when the balance task ignores cancellation.
  • [P1] Add redacted live Zen-only account proof showing the balance-only state instead of Missing usage fields.
  • [P1] Remove or intentionally relocate the PR-specific artifact workflow before merge.

Proof guidance:

  • [P1] Needs real behavior proof before merge: No redacted live Zen-only account output, screenshot, recording, terminal output, log, or linked artifact demonstrates the after-fix balance-only state; redact private details before posting proof, then update the PR body or ask a maintainer to comment @clawsweeper re-review if a fresh review does not trigger automatically.

Mantis proof suggestion
A redacted real CodexBar refresh is the most useful proof for the visible Zen-only provider state that unit tests cannot verify against the live service. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: verify a redacted CodexBar OpenCode Go refresh for a Zen-only account shows the Zen balance-only state instead of Missing usage fields.

Risk before merge

  • [P1] No redacted live output, log, screenshot, recording, or linked artifact currently proves the after-fix balance-only state against a real Zen-only OpenCode account.
  • [P2] The required Zen fallback can still keep a canceled refresh suspended if the balance transport does not finish promptly after Task.cancel().
  • [P1] The CI diff adds a PR-number-specific ad-hoc artifact package/upload path; maintainers should remove or deliberately scope it if it is only for proof collection.

Maintainer options:

  1. Repair Cancellation And Require Live Proof (recommended)
    Fix required fallback cancellation so the refresh returns promptly, then wait for redacted real Zen-only account proof before merge.
  2. Accept Source-Only Provider Risk
    Maintainers can merge on the stubbed regression suite if they explicitly accept that live dashboard payload compatibility remains unproven.
  3. Pause For Test Artifact Proof
    Keep the PR open until the ad-hoc artifact or a maintainer build enables redacted account proof, then decide whether the CI artifact step belongs on main.

Next step before merge

  • [P1] Manual review is needed because an automated repair cannot provide the required live Zen-only account proof, and maintainers should decide how to handle the temporary artifact workflow.

Security
Cleared: No concrete security or supply-chain regression was found; the workflow artifact change uses existing packaging scripts and does not add new secrets, dependencies, or credential paths.

Review findings

  • [P2] Race the required Zen fallback against cancellation — Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:196
  • [P3] Remove the PR-specific CI artifact step before merge — .github/workflows/ci.yml:49-56
Review details

Best possible solution:

Keep the current balance-only direction, repair the cancellation race, collect redacted live Zen-only account proof, and remove or intentionally retain the temporary test-artifact workflow before merge.

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

No high-confidence live reproduction is available yet. Source inspection shows current main fails before Zen balance fallback and the PR has stubbed regressions, but the real Zen-only dashboard payload proof is still absent.

Is this the best way to solve the issue?

No for the current head: reusing the existing Zen balance fetch and rendering a balance-only snapshot is the right narrow direction, but the cancellation race and missing live proof need to be resolved before merge.

Full review comments:

  • [P2] Race the required Zen fallback against cancellation — Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:196
    The cancellation handler cancels the balance task, but this path still awaits task.value directly. If the underlying transport ignores cancellation or only returns at the request timeout, a canceled provider refresh remains suspended; race the required fallback wait against parent cancellation so it returns promptly.
    Confidence: 0.84
  • [P3] Remove the PR-specific CI artifact step before merge — .github/workflows/ci.yml:49-56
    This workflow branch only runs for this pull request number, so after merge it becomes dead CI configuration on main. Keep it while collecting proof if needed, but remove it or move it to a deliberate manual workflow before landing.
    Confidence: 0.78

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 87b1195969a7.

Label changes

Label changes:

  • add merge-risk: 🚨 availability: The current required fallback can keep a canceled provider refresh suspended when the balance task does not observe cancellation promptly.

Label justifications:

  • P2: The PR addresses a limited-blast-radius OpenCode account-shape problem but is still blocked on proof and one provider cancellation defect.
  • merge-risk: 🚨 auth-provider: The diff changes credential-backed OpenCode Go provider fetch behavior, and the intended live Zen-only account state is not yet proven against the real service.
  • merge-risk: 🚨 availability: The current required fallback can keep a canceled provider refresh suspended when the balance task does not observe cancellation promptly.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: No redacted live Zen-only account output, screenshot, recording, terminal output, log, or linked artifact demonstrates the after-fix balance-only state; redact private details before posting proof, then update the PR body or ask a maintainer to comment @clawsweeper re-review if a fresh review does not trigger automatically.
Evidence reviewed

Acceptance criteria:

  • [P1] swift test --filter OpenCodeGoUsageFetcherErrorTests.
  • [P1] make check.
  • [P1] Redacted live Zen-only OpenCode account refresh proof showing the balance-only state.

What I checked:

Likely related people:

  • steipete: Authored current OpenCode Zen balance support and several recent OpenCode Go/provider refactors, and supplied maintainer proof-gate context on this PR. (role: recent area contributor; confidence: high; commits: d24664bb4e15, 61177d789088, 53d675f914ef; files: Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift, Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoZenBalanceFetcher.swift, Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageSnapshot.swift)
  • ratulsarna: Introduced OpenCode Go provider support and later auth fallback handling that the PR extends. (role: introduced behavior; confidence: medium; commits: 31bd4812d227, 20784e00eaed; files: Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift, Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift, Tests/CodexBarTests/OpenCodeGoUsageParserTests.swift)
  • sopenlaz0: Recently changed OpenCode Go local usage fallback and provider strategy flow near the affected provider behavior. (role: recent adjacent contributor; confidence: medium; commits: 7754035e6bb5; files: Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift, Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoLocalUsageReader.swift, Tests/CodexBarTests/OpenCodeGoLocalUsageReaderTests.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.

@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: 22854fa03e

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

else {
throw error
}
let zenBalance = try await self.completedOptionalZenBalance(from: zenBalanceTask)

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 Wait for required Zen balance before rethrowing parse failure

When the Go page has no subscription usage fields, this balance fetch is no longer optional: it is the only way a Zen-only account can succeed. However completedOptionalZenBalance only waits for optionalZenBalanceJoinGrace (250 ms) before cancelling the task, so a normal network response from /workspace/<id> that arrives after that grace period but within the request timeout still causes parseFailed and the account remains broken. In this fallback path, await the balance task to its timeout instead of using the optional/non-blocking helper.

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. labels Jun 14, 2026
@steipete steipete force-pushed the kiran/opencode-zen-balance-only branch from 22854fa to 59e5fca Compare June 14, 2026 03:36

Copy link
Copy Markdown
Owner

Addressed the required-fallback review finding: the Zen balance task is now awaited to its normal timeout only when subscription usage is missing, while normal subscription enrichment keeps the 250 ms grace. Added a 400 ms regression and synchronized concurrent request recording; focused tests, make check, git diff --check, and local autoreview are clean.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 14, 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:

@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: 59e5fca0a5

ℹ️ 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 +151 to +157
guard case let .parseFailed(message) = error,
message.contains("Missing usage fields"),
let zenBalanceTask
else {
throw error
}
let zenBalance = try await zenBalanceTask.value

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 Reuse the Zen fallback for final parse failures

When the /go response contains enough legacy text to pass fetchUsagePage's precheck (for example a rollingUsage usagePercent) but is still missing the weekly/reset fields required by parseSubscription below, the parseFailed is thrown after this catch block. In that case the already-started /workspace/<id> balance task is canceled by the defer, so an account with no complete subscription windows can still fail even if the Zen balance request succeeded; the same balance-only fallback needs to cover the final parseSubscription failure path too.

Useful? React with 👍 / 👎.

@steipete steipete force-pushed the kiran/opencode-zen-balance-only branch from 59e5fca to 49524f8 Compare June 14, 2026 04:13

Copy link
Copy Markdown
Owner

Addressed the latest review finding at 49524f80: balance-only fallback now covers both initial and final subscription parse failures and uses the caller's full timeout, while successful subscription enrichment still stops waiting after 250 ms. Focused 16-test suite and make check pass; full-branch review found the timeout gap and follow-up autoreview is clean.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 14, 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:

@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: 49524f803f

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

guard case let .parseFailed(message) = error,
message.contains("Missing usage fields"),
let task,
let zenBalance = try await task.value

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 Propagate cancellation while awaiting required Zen balance

When /go has no usage fields and the balance request is still pending, canceling the provider refresh while this fallback is awaiting task.value does not cancel the unstructured zenBalanceTask; the defer only runs after this await returns. In that Zen-only fallback path, the canceled refresh can stay stuck until the balance request finishes or hits the full web timeout, so this await needs cancellation handling that cancels the balance task promptly.

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Owner

Fixed the remaining cancellation defect at a9bb7080.

The required Zen-only fallback now cancels its unstructured balance task immediately when the parent provider refresh is canceled, instead of waiting for the balance request timeout. Added a direct regression test that verifies both prompt parent cancellation and cancellation of the underlying balance task.

Validation:

  • swift test --filter 'zen only fallback promptly cancels the required balance task|zen only account waits for balance beyond optional grace|zen only account falls back after final subscription parse failure|optional zen balance cancellation propagates' — 4 tests passed
  • make check — SwiftFormat clean, SwiftLint 0 violations, package/release path checks passed
  • autoreview --mode local — clean, no accepted/actionable findings
  • git diff --check — clean

The code path is repaired. The existing redacted live Zen-only account proof request remains the merge blocker.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 14, 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 the P2 Normal priority bug or improvement with limited blast radius. label Jun 14, 2026
@kiranmagic7

Copy link
Copy Markdown
Contributor Author

Pushed ad01a74d to resolve the current origin/main conflict and repair the optional/required Zen balance timing split.

What changed:

  • normal subscription usage fetches/parses before optional Zen balance enrichment, so a slow balance page cannot delay the subscription path
  • Zen-only missing-usage fallback now starts a required full-timeout balance fetch only after the parse failure
  • optional balance enrichment stays capped at 5s and joined with the 250 ms grace

Validation:

  • swift test --filter OpenCodeGoUsageFetcherErrorTests --skip-update — 17 tests passed
  • make check — parser hash/path checks passed; SwiftFormat 0/1090; SwiftLint 0 violations, 0 serious in 1089 files
  • git diff --check HEAD — clean

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 14, 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:

@steipete steipete force-pushed the kiran/opencode-zen-balance-only branch from ad01a74 to bba5fda Compare June 14, 2026 05:48
@steipete

Copy link
Copy Markdown
Owner

Rebased and repaired exact head bba5fda9.

The optional Zen enrichment race no longer uses a structured task group that waits for a cancellation-ignoring request when leaving scope. It now returns after the 250 ms grace, cancels the source request, and leaves the required Zen-only fallback path free to wait for the caller's full timeout. This preserves concurrent subscription/balance fetching instead of adding serial latency to every successful refresh.

Validation on the rebased exact head:

  • swift test --filter OpenCodeGoUsageFetcherErrorTests — 17 tests passed; the slow optional balance regression returned in 254 ms, while the required Zen-only fallback still waited and succeeded.
  • make check — SwiftFormat clean; SwiftLint 0 violations; package/release path checks passed.
  • branch-wide autoreview --mode branch --base origin/main — clean, no accepted/actionable findings.
  • git diff --check origin/main...HEAD — clean.

No live provider/account probe was run. The existing redacted Zen-only account proof request remains the merge gate; this update is intended to make CI and code review green without weakening that requirement.

@codex review

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 14, 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:

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: bba5fda935

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

@steipete

Copy link
Copy Markdown
Owner

Maintainer rebase onto 9490a8d5; exact head 26cb5ef2.

Rebase testing found and fixed two additional defects before push: optional Zen enrichment could occupy a serial transport before required subscription usage, and non-eligible API errors could start stray balance work. Required usage now starts first with overlapping bounded enrichment; workspace fallback coverage is deterministic.

  • swift test --filter OpenCodeGo — 50 tests passed
  • make check — clean
  • local fix autoreview — clean after two accepted findings were fixed
  • exact branch autoreview against origin/main — no accepted/actionable findings

Merge remains blocked on redacted live proof from a Zen-only account.

@codex review
@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 14, 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:

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 26cb5ef23e

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

@steipete steipete force-pushed the kiran/opencode-zen-balance-only branch from 26cb5ef to 86b5fb5 Compare June 14, 2026 11:05
@steipete

Copy link
Copy Markdown
Owner

Maintainer rebase and review completed against current main.

Reviewed exact head: 86b5fb57b63a00f8d950cb5e529c703323f13d96

Local proof:

  • swift test --filter OpenCodeGo (50 passed)
  • make check
  • autoreview clean

This remains proof-gated: do not merge until a redacted Zen-only OpenCode account refresh demonstrates the balance-only state.

@codex review
@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 14, 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:

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 86b5fb57b6

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

@steipete

Copy link
Copy Markdown
Owner

Exact-head CI is green on 86b5fb57b63a00f8d950cb5e529c703323f13d96.

Maintainer validation already completed:

  • focused OpenCode tests (50 tests)
  • make check
  • local branch autoreview clean

Still proof-gated: do not merge until a redacted Zen-only account refresh confirms balance display when no Go subscription usage is present.

@NOIPJohnny

Copy link
Copy Markdown

Exact-head CI is green on 86b5fb57b63a00f8d950cb5e529c703323f13d96.

Maintainer validation already completed:

  • focused OpenCode tests (50 tests)
  • make check
  • local branch autoreview clean

Still proof-gated: do not merge until a redacted Zen-only account refresh confirms balance display when no Go subscription usage is present.

I'd love to help test this behavior as my account has Zen balance without a Go subscription, but I don't have Xcode installed on my Mac to build the plugin from source.

Since the macOS CI packaging pipeline is now green, could you please provide a pre-built testing binary (.dmg) or artifact link here? If a pre-built binary becomes available for download, I'll install it and provide a live screenshot confirmation for the Zen-only account state.

@kiranmagic7

Copy link
Copy Markdown
Contributor Author

Thanks for offering to test this. I checked the exact-head CI run for 86b5fb57b63a00f8d950cb5e529c703323f13d96; it does not publish a downloadable macOS artifact or DMG, so I do not have an official CI build link to share from this PR.

I will leave the proof gate open for a maintainer-provided build or maintainer/live-account validation. The latest source, tests, and CI are green; the remaining blocker is only the redacted Zen-only account refresh proof.

@steipete steipete force-pushed the kiran/opencode-zen-balance-only branch from 86b5fb5 to 63df956 Compare June 15, 2026 08:12
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. label Jun 15, 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: 63df956e33

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

throw error
}
let zenBalance = try await withTaskCancellationHandler {
try await task.value

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 Race required Zen fallback against cancellation

In a Zen-only fallback where the /workspace/<id> request is backed by a transport that does not stop on Task.cancel(), the cancellation handler only cancels the source task while this await task.value keeps the refresh suspended until that task returns or hits the full web timeout. Fresh evidence: the new fallback still awaits task.value directly here, so cancellation needs to race the required balance task rather than rely on the source observing cancellation.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. label Jun 15, 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: 9fda9f0258

ℹ️ 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 +189 to +191
guard case let .parseFailed(message) = error,
message.contains("Missing usage fields"),
let task

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 Fetch required Zen balance even when optional usage is off

When a user disables “Show optional credits and extra usage”, OpenCodeGoUsageFetchStrategy passes includeZenBalance: false, so zenBalanceTask is nil here. For a Zen-only account whose /go page has no subscription fields, this new fallback still rethrows Missing usage fields instead of producing the balance-only snapshot, because the only balance request was skipped as optional. The required fallback should start or perform the Zen balance fetch independently of optional enrichment, while subscription accounts can still suppress optional display.

Useful? React with 👍 / 👎.

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: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Add OpenCode Zen balance-only provider for users without OpenCode Go subscription

3 participants