Skip to content

[AI-assisted] fix(status): restore Codex usage windows#79505

Closed
brokemac79 wants to merge 1 commit intoopenclaw:mainfrom
brokemac79:fix-codex-usage-status-79312
Closed

[AI-assisted] fix(status): restore Codex usage windows#79505
brokemac79 wants to merge 1 commit intoopenclaw:mainfrom
brokemac79:fix-codex-usage-status-79312

Conversation

@brokemac79
Copy link
Copy Markdown
Contributor

@brokemac79 brokemac79 commented May 8, 2026

Summary

  • route /status Codex-runtime openai/* usage lookups through the effective openai-codex auth/usage provider
  • scope openclaw status --usage to the scanned config/default agent dir so per-agent Codex OAuth profiles are visible
  • preserve Claude CLI Anthropic usage by falling back to the original model provider when the effective auth-provider id has no usage provider

Verification

  • corepack pnpm test src/auto-reply/reply/commands-status.test.ts src/commands/status-runtime-shared.test.ts src/commands/status.test.ts
  • corepack pnpm exec oxfmt --check --threads=1 CHANGELOG.md src/status/status-text.ts src/commands/status-runtime-shared.ts src/commands/status-runtime-shared.test.ts src/commands/status.command.ts src/commands/status.test.ts src/auto-reply/reply/commands-status.test.ts
  • corepack pnpm check:changelog-attributions
  • corepack pnpm check:changed
  • git diff --check origin/main...HEAD
  • codex review --base origin/main -c model_reasoning_effort="medium"

Real behavior proof

  • Behavior or issue addressed: Codex-runtime openai/* status output selected OpenAI Codex auth, but usage routing still looked up the plain openai provider, so Codex quota windows were omitted from /status and openclaw status --usage.
  • Real environment tested: Windows 11 source checkout on branch fix-codex-usage-status-79312 at head 7be9b6d3c9, with the local OpenClaw source tree run through Corepack/pnpm.
  • Exact steps or command run after this patch: Ran corepack pnpm exec tsx -e "import { resolveUsageProviderId } from './src/infra/provider-usage.shared.ts'; const modelProvider = 'openai'; const selectedStatusAuthProvider = 'openai-codex'; const selectedUsageProvider = resolveUsageProviderId(selectedStatusAuthProvider) ?? resolveUsageProviderId(modelProvider); console.log('modelProvider=' + modelProvider); console.log('selectedStatusAuthProvider=' + selectedStatusAuthProvider); console.log('selectedUsageProvider=' + selectedUsageProvider); console.log('statusUsageRoute=' + (selectedUsageProvider === 'openai-codex' ? 'codex-quota-windows-enabled' : 'missing'));" from the patched checkout.
  • Evidence after fix: Terminal output from the patched checkout:
modelProvider=openai
selectedStatusAuthProvider=openai-codex
selectedUsageProvider=openai-codex
statusUsageRoute=codex-quota-windows-enabled
  • Observed result after fix: The status usage route now resolves openai models running under the Codex auth path to openai-codex, which is the provider that owns Codex quota-window loading. The focused status verification also rendered the Usage: line for this route and confirmed the Claude CLI Anthropic fallback remains on anthropic.
  • What was not tested: A live credentialed ChatGPT/Codex OAuth quota request was not sent from this machine; the local proof uses a redacted route probe and focused verification to avoid exposing user credentials.

Fixes #79312.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 8, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 8, 2026

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

Close: current main already contains the Codex usage-window restoration through merged work that covers both /status provider routing and CLI default-agent usage scoping; this branch’s remaining diff is redundant test/mock and compatibility churn rather than unique needed behavior.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best possible solution:

Keep the current-main implementation from the merged status/Codex fix and close this redundant branch without merging extra compatibility or test churn.

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

Do we have a high-confidence way to reproduce the issue? Not against current main: the old source-level regression was clear, but current main now routes Codex-harness openai/* usage through openai-codex and passes CLI agent scope.

Is this the best way to solve the issue?

Is this the best way to solve the issue? Yes for the repository state now: the already-merged fix uses the effective runtime provider and scoped agent directory, which is the narrow maintainable solution; this PR no longer needs to merge.

Security review:

Security review cleared: No concrete security or supply-chain concern found; the PR touches status routing/scoping and tests only.

What I checked:

Likely related people:

  • obviyus: The merged current-main fix for the same status/Codex usage behavior was authored/merged under this account and is the provenance for the implementation now on main. (role: current-main fix author and merger; confidence: high; commits: 7872909709ac, e519ffd3ba7b; files: src/status/status-text.ts, src/commands/status-runtime-shared.ts, src/commands/status.command.ts)
  • steipete: Current main's nearby status/test snapshot and recent commits around the reviewed base are attributed locally to this account, though the specific merged status fix came from the prior PR. (role: recent area contributor; confidence: medium; commits: 3ff0da799387, 8caf925e1d5e, 8c158efa6d3f; files: src/status/status-text.ts, src/commands/status-runtime-shared.ts, src/commands/status.command.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 3ff0da799387; fix evidence: commit 7872909709ac, main fix timestamp 2026-05-09T10:53:09Z.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 8, 2026
@brokemac79 brokemac79 force-pushed the fix-codex-usage-status-79312 branch from 7be9b6d to 5fd9ffd Compare May 9, 2026 13:57
@brokemac79
Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current openclaw/main (c0132e9aa3) and resolved the status-runtime conflicts while preserving the Codex OAuth usage-provider path.

Validation run locally on the rebased head 5fd9ffd9dd:

  • corepack pnpm test src/commands/status-runtime-shared.test.ts src/commands/status.test.ts src/auto-reply/reply/commands-status.test.ts - passed
  • corepack pnpm exec oxfmt --check --threads=1 src/auto-reply/reply/commands-status.test.ts src/commands/status-runtime-shared.test.ts src/commands/status-runtime-shared.ts src/commands/status.command.ts src/commands/status.test.ts src/status/status-text.ts - passed
  • corepack pnpm check:changelog-attributions - passed
  • corepack pnpm check:changed - passed
  • corepack pnpm exec tsgo -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo - passed
  • git diff --check origin/main...HEAD - passed

I also attempted live local openclaw status --usage proof from this Windows checkout (corepack pnpm openclaw status --usage --timeout 5000 and node dist/entry.js status --usage --timeout 5000 --json), but both commands hung until the external command timeout. I did not include that as proof because it did not complete cleanly here.

@brokemac79 brokemac79 force-pushed the fix-codex-usage-status-79312 branch from 5fd9ffd to 3dc33c5 Compare May 10, 2026 10:30
Copy link
Copy Markdown
Contributor Author

Rebased this branch onto current openclaw/main (e43d246e30) and resolved the status test conflict while preserving the Codex OAuth usage-provider path and scoped agent-dir assertion.

Validation on rebased head 3dc33c5b33:

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm test src/commands/status-runtime-shared.test.ts src/commands/status.test.ts src/auto-reply/reply/commands-status.test.ts (31 + 19 tests passed)
  • corepack pnpm exec oxfmt --check --threads=1 src/auto-reply/reply/commands-status.test.ts src/commands/status-runtime-shared.test.ts src/commands/status-runtime-shared.ts src/commands/status.command.ts src/commands/status.test.ts src/status/status-text.ts
  • corepack pnpm check:changed
  • corepack pnpm exec tsgo -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo
  • git diff --check origin/main...HEAD
  • codex review --base origin/main -c model_reasoning_effort='"medium"' returned no actionable correctness issues.

Fresh GitHub checks are now running on the new head.

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

Labels

commands Command implementations proof: supplied External PR includes structured after-fix real behavior proof. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI Codex provider usage no longer shown in /status or openclaw status --usage

1 participant