Skip to content

fix(codex): restore OAuth subscription renewal dates - #3338

Open
CharlieLZ wants to merge 1 commit into
steipete:mainfrom
CharlieLZ:fix/port-codex-subscription-dates
Open

fix(codex): restore OAuth subscription renewal dates#3338
CharlieLZ wants to merge 1 commit into
steipete:mainfrom
CharlieLZ:fix/port-codex-subscription-dates

Conversation

@CharlieLZ

Copy link
Copy Markdown

Problem

Codex OAuth-mode usage did not surface subscription renewal/expiry dates: the ChatGPT subscriptions payload was parsed only on the web-dashboard path, so OAuth-mode cards lost the renewal metadata (rebased from ad636d819 whose architecture has since moved on; the change applies cleanly to current main).

Change

  • Parse active_until/will_renew from the subscriptions payload in the Codex OAuth usage fetcher (new OpenAISubscriptionDates value kept WebKit-free).
  • Attach renewal metadata to the reconciled state so the menu card shows renewal dates like the web mode.
  • Tests covering payloads with/without renewal + response shape diagnostics.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T02:34:28.011386Z 4fcda19 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 4fcda19f4e

ℹ️ 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 +405 to +408
async let subscriptionRequest = CodexOAuthUsageFetcher.fetchSubscription(
accessToken: accessToken,
accountId: accountId,
env: env)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid pairing required and best-effort async-let tasks

When the required usage request throws while the optional subscription request is still running, unwinding this scope must cancel and drain the best-effort sibling; this is the exact mixed required/optional async let pattern associated in this repository with Swift task-lifecycle crashes. Await these sequentially or use a fully drained task group that explicitly contains subscription failures.

AGENTS.md reference: AGENTS.md:L43-L43

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed September 1, 2026, 2:05 PM ET / 18:05 UTC.

ClawSweeper review

What this changes

The branch fetches ChatGPT subscription metadata alongside Codex OAuth usage and carries renewal or expiry dates into the menu-bar usage snapshot.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

Blocked until real behavior proof from a real setup is added - 5 items remain

Keep open: the requested OAuth metadata path is useful, but the introduced mixed required/best-effort async let pair violates repository concurrency guidance and can destabilize a failed usage refresh; no real OAuth after-fix proof is supplied.

Priority: P1
Reviewed head: 4fcda19f4ecdc480899e1fc136edb5d7aa0c1754

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The feature intent and mocked coverage are clear, but a P1 concurrency defect and absent real OAuth behavior proof block merge confidence.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The production owner is the Codex OAuth fetch strategy, which issues the new subscription request before creating the menu-card snapshot; the supplied evidence exercises it only through a stub transport and does not show a real OAuth account’s after-fix request or displayed renewal result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The production owner is the Codex OAuth fetch strategy, which issues the new subscription request before creating the menu-card snapshot; the supplied evidence exercises it only through a stub transport and does not show a real OAuth account’s after-fix request or displayed renewal result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Introduced concurrency trigger: The PR starts required usage and best-effort subscription requests as sibling async-let tasks, then propagates the usage result before explicitly draining the subscription task.
Applicable repository policy: Repository policy explicitly identifies this required/best-effort sibling async-let pattern as a task-lifecycle crash risk and requires sequential awaits or a drained task group.
Existing subscription behavior: The existing web dashboard path already maps active_until and will_renew into mutually exclusive renewal or expiry dates; the proposed OAuth path targets the same user-visible metadata.
Findings 1 actionable finding [P1] Drain the best-effort subscription task before propagating usage failure
Security None None.

How this fits together

CodexBar’s Codex OAuth provider converts account credentials and OpenAI usage responses into the usage snapshot displayed by the menu-bar card. This change adds a best-effort subscription metadata request before that snapshot is reconciled.

flowchart LR
  A[OAuth credentials] --> B[Usage request]
  A --> C[Subscription request]
  B --> D[Usage reconciliation]
  C --> D
  D --> E[Usage snapshot]
  E --> F[Menu bar card]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The production owner is the Codex OAuth fetch strategy, which issues the new subscription request before creating the menu-card snapshot; the supplied evidence exercises it only through a stub transport and does not show a real OAuth account’s after-fix request or displayed renewal result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Drain the best-effort subscription task before propagating usage failure (P1) - If fetchUsage throws at line 409 while the subscription request is still active, this exits through the repository’s explicitly unsafe required/best-effort sibling async let pattern. Fetch sequentially or use a fully drained task group, and cover the failing-usage path.
  • Resolve merge risk (P1) - If the required usage request fails while the optional subscription request remains active, the introduced sibling-task cleanup relies on the repository’s known unsafe mixed async let pattern and may cause a task-lifecycle crash during a failed refresh.
  • Resolve merge risk (P1) - The only behavior evidence is a mocked transport path, so the actual OAuth subscription endpoint and resulting card metadata have not been demonstrated in a real account setup.
  • Complete next step (P2) - A concrete P1 repair exists, but the external contributor must also provide real OAuth behavior proof that an automated repair worker cannot establish on their behalf.

Findings

  • [P1] Drain the best-effort subscription task before propagating usage failure — Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:401-409
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +135/-4, tests +86 The focused implementation is accompanied by substantial request and mapping coverage, but its integration failure path remains untested.

Merge-risk options

Maintainer options:

  1. Drain the optional request safely (recommended)
    Replace the mixed async-let pair with sequential awaits or a drained task group, and cover a usage failure while subscription work is pending.
  2. Pause pending corrected behavior evidence
    Keep the PR unmerged if the lifecycle repair or a redacted real OAuth after-fix run cannot be supplied.

Technical review

Best possible solution:

Fetch required usage before the best-effort subscription enrichment, or use a fully drained task group, then retain the parsed metadata only when the optional request succeeds and demonstrate the result with redacted real OAuth evidence.

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

Yes, at source level: make the required usage request fail while the subscription request is still in flight at the introduced sibling-task pair. Repository policy identifies that exact lifecycle as unsafe, although no live crash trace was supplied.

Is this the best way to solve the issue?

No: parallelizing a required request with a best-effort request is not the repository-approved solution. Sequential awaits or an explicitly drained task group preserves the intended metadata enrichment without the unsafe cleanup path.

Full review comments:

  • [P1] Drain the best-effort subscription task before propagating usage failure — Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:401-409
    If fetchUsage throws at line 409 while the subscription request is still active, this exits through the repository’s explicitly unsafe required/best-effort sibling async let pattern. Fetch sequentially or use a fully drained task group, and cover the failing-usage path.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The introduced OAuth refresh control flow matches an explicit repository crash-risk pattern during a real provider failure.
  • add merge-risk: 🚨 availability: A failed required usage request can unwind while the newly added optional network task is still active.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The production owner is the Codex OAuth fetch strategy, which issues the new subscription request before creating the menu-card snapshot; the supplied evidence exercises it only through a stub transport and does not show a real OAuth account’s after-fix request or displayed renewal result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P1: The introduced OAuth refresh control flow matches an explicit repository crash-risk pattern during a real provider failure.
  • merge-risk: 🚨 availability: A failed required usage request can unwind while the newly added optional network task is still active.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish 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: The production owner is the Codex OAuth fetch strategy, which issues the new subscription request before creating the menu-card snapshot; the supplied evidence exercises it only through a stub transport and does not show a real OAuth account’s after-fix request or displayed renewal result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • Emanuel Stadler: Raw commit 5b0b9fa adds Sources/CodexBarCore/OpenAIWeb/OpenAISubscriptionMetadata.swift:53 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5b0b9fa3e37c; files: Sources/CodexBarCore/OpenAIWeb/OpenAISubscriptionMetadata.swift)
  • Yuxin-Qiao: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Replace the mixed async let pair and add a failure-path test that proves optional work is drained when required usage fails.
  • Post a redacted real OAuth after-fix terminal trace or menu-card screenshot showing the subscription result; updating the PR body should trigger a fresh review, or a maintainer can request @clawsweeper re-review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

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

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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.

1 participant