Skip to content

feat(dashboard): show live credits for credit-backed accounts#767

Closed
Komzpa wants to merge 10 commits into
Soju06:mainfrom
Komzpa:revive/pr-254
Closed

feat(dashboard): show live credits for credit-backed accounts#767
Komzpa wants to merge 10 commits into
Soju06:mainfrom
Komzpa:revive/pr-254

Conversation

@Komzpa
Copy link
Copy Markdown
Collaborator

@Komzpa Komzpa commented May 21, 2026

Summary

Revives #254 on a maintainer-owned branch because the original PR head has maintainerCanModify=false.

Credit: original implementation by @mws-weekend-projects in #254; this branch rebases and updates that work on current main.

  • Keeps credit-backed accounts usable and surfaces live credit fields through account/dashboard schemas.
  • Fixes the review blocker by making apiKeyName optional in frontend request-log parsing and covering omitted values.

Validation

  • uv run pytest tests/unit/test_load_balancer.py -q passed: 66 passed
  • bun install --frozen-lockfile completed
  • bun run test src/features/dashboard/schemas.test.ts src/features/dashboard/components/account-card.test.tsx passed: 23 passed
  • bun run lint -- src/features/dashboard/schemas.ts src/features/dashboard/components/account-card.tsx src/features/dashboard/components/recent-requests-table.tsx src/features/accounts/schemas.ts passed
  • git diff --check passed

Revives #254

Copy link
Copy Markdown

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

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: 4158039454

ℹ️ 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 thread app/core/usage/quota.py
@Soju06 Soju06 added 🤖 codex: needs work [@codex review] raised an issue and removed 🤖 codex: needs work [@codex review] raised an issue labels May 21, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 21, 2026

@codex review

Copy link
Copy Markdown

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

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: af9192737f

ℹ️ 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 thread app/modules/proxy/load_balancer.py Outdated
@Soju06 Soju06 added 🤖 codex: needs work [@codex review] raised an issue and removed 🤖 codex: needs work [@codex review] raised an issue labels May 21, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 21, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

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

@Soju06 Soju06 added 🤖 codex: ok [@codex review] says no issues found. and removed 🤖 codex: ok [@codex review] says no issues found. labels May 21, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 24, 2026

@codex review

Copy link
Copy Markdown

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

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: 79541adb6a

ℹ️ 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 thread app/modules/proxy/load_balancer.py Outdated
Comment thread app/modules/accounts/mappers.py Outdated
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label May 24, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label May 24, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 24, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

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

@Soju06 Soju06 added the 🤖 codex: ok [@codex review] says no issues found. label May 24, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented May 27, 2026

Merge-gate hold: code/CI/Codex look good, but this PR changes quota/account status semantics and dashboard-visible behavior without an active openspec/changes/<slug>/ delta.

Please add the OpenSpec change folder/spec delta for the credit-backed account availability/dashboard behavior, or explicitly waive the OpenSpec gate for this small revived feature. I did not find a code-level blocker in focused review.

@Soju06 Soju06 added the hermes: needs-followup Hermes left a blocker/comment that needs follow-up observation label May 27, 2026
@Soju06 Soju06 added 🤖 codex: ok [@codex review] says no issues found. and removed 🤖 codex: ok [@codex review] says no issues found. labels May 31, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

Hermes re-check blocker: this PR is no longer mergeable against current main after #764 landed, and the conflict is semantic, not just mechanical.

Evidence:

  • GitHub reports mergeable=CONFLICTING / mergeStateStatus=DIRTY; local merge conflicts in app/core/usage/quota.py, app/modules/accounts/mappers.py, app/modules/proxy/load_balancer.py, tests/unit/test_account_mappers.py, and tests/unit/test_load_balancer.py.
  • Current main already contains fix(quota): keep credit-backed accounts usable #764 (fix(quota): keep credit-backed accounts usable) and its OpenSpec requires exhausted primary-window usage to keep rate_limited precedence.
  • This PR's new OpenSpec says primary or secondary 100% usage must not derive rate_limited/quota_exceeded, and app/core/usage/quota.py returns early on any credit override before checking primary_used >= 100. The new test test_apply_usage_quota_allows_primary_100_when_credits_balance_positive asserts ACTIVE for primary_used=100.

Requested fix: rebase onto current main, keep the dashboard/API live-credit display pieces, but align quota/status semantics with #764: credit-backed capacity may override secondary quota_exceeded, while exhausted primary quota remains rate_limited; update the OpenSpec delta and tests accordingly. After that, CI/Codex should be rerun on the rebased head.

@Soju06 Soju06 added the hermes: needs-followup Hermes left a blocker/comment that needs follow-up observation label Jun 1, 2026
# Conflicts:
#	app/core/usage/quota.py
#	app/modules/accounts/mappers.py
#	app/modules/proxy/load_balancer.py
#	tests/unit/test_account_mappers.py
#	tests/unit/test_load_balancer.py
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

Copy link
Copy Markdown

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

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: 5d27d22c40

ℹ️ 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 thread app/core/usage/quota.py Outdated
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

Copy link
Copy Markdown

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

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: 3a60e0e085

ℹ️ 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 thread app/core/usage/quota.py Outdated
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 1, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

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

@Soju06 Soju06 added the 🤖 codex: ok [@codex review] says no issues found. label Jun 1, 2026
@Soju06 Soju06 removed the 🤖 codex: ok [@codex review] says no issues found. label Jun 1, 2026
@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Jun 1, 2026

@codex review

@Komzpa Komzpa removed the hermes: needs-followup Hermes left a blocker/comment that needs follow-up observation label Jun 1, 2026
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

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

@Soju06 Soju06 added the 🤖 codex: ok [@codex review] says no issues found. label Jun 1, 2026
Komzpa added a commit to Komzpa/codex-lb that referenced this pull request Jun 1, 2026
# Conflicts:
#	tests/unit/test_account_mappers.py
#	tests/unit/test_load_balancer.py
@Komzpa
Copy link
Copy Markdown
Collaborator Author

Komzpa commented Jun 2, 2026

Folded into #716.

#716 is the surviving main-based routing/quota branch for this bucket. It includes the routing/quota changes from this PR, has current-head CI green, and has a clean current-head Codex review, so this separate PR can be closed to keep the queue reviewable.

@Komzpa Komzpa closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 codex: ok [@codex review] says no issues found.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants