Bug Description
The OpenCode TUI status renders a phantom quota 100% segment when OpenAI returns a disabled secondary quota window with window-minutes: 0 and used-percent: 0.
The real primary weekly value is displayed correctly, but the disabled secondary window is also included and formatted as a generic quota limit.
Example status:
Steps to Reproduce
- Use a paid Team workspace whose Codex response headers include a weekly primary window and a disabled secondary window:
x-codex-primary-used-percent: 23
x-codex-primary-window-minutes: 10080
x-codex-secondary-used-percent: 0
x-codex-secondary-window-minutes: 0
x-codex-secondary-reset-at:
x-codex-secondary-reset-after-seconds: 0
- Send a successful Codex request through the plugin.
- Observe the OpenCode TUI status line.
- Inspect
~/.local/state/opencode/oc-codex-multi-auth-tui-quota.json.
The generated cache includes:
{
"label": "quota",
"leftPercent": 100,
"usedPercent": 0,
"windowMinutes": 0
}
Deleting the cache does not resolve the issue; the clean v6.7.1 runtime recreates the same entry from subsequent response headers.
Expected Behavior
A secondary window explicitly reported with window-minutes: 0 should be treated as disabled and omitted from the TUI quota display. Only the real weekly limit should appear:
Actual Behavior
The TUI displays:
Environment
- opencode version:
1.17.19
- Plugin version:
6.7.1 (clean install; no local patches loaded)
- Operating System: Linux
- Node.js version:
v24.3.0
- Plan: paid Team
Possible Cause
In lib/tui-quota-cache.ts, parseLimit() formats a non-positive/absent window as quota. hasUsefulLimit() then retains it because usedPercent is numeric even when windowMinutes === 0:
return Boolean(
limit.windowMinutes ||
typeof limit.usedPercent === "number" ||
typeof limit.resetAtMs === "number"
)
A narrow fix may be to reject a limit when windowMinutes === 0, while preserving generic limits where the window header is genuinely absent.
Logs
No raw request logs attached because they contain unrelated response metadata. The relevant sanitized x-codex-* fields are included above.
Compliance Checklist
Additional Context
The server usage endpoint reports the real weekly allowance correctly. This issue is limited to parsing/rendering the disabled secondary header window in the TUI status cache.
Bug Description
The OpenCode TUI status renders a phantom
quota 100%segment when OpenAI returns a disabled secondary quota window withwindow-minutes: 0andused-percent: 0.The real primary weekly value is displayed correctly, but the disabled secondary window is also included and formatted as a generic
quotalimit.Example status:
Steps to Reproduce
~/.local/state/opencode/oc-codex-multi-auth-tui-quota.json.The generated cache includes:
{ "label": "quota", "leftPercent": 100, "usedPercent": 0, "windowMinutes": 0 }Deleting the cache does not resolve the issue; the clean v6.7.1 runtime recreates the same entry from subsequent response headers.
Expected Behavior
A secondary window explicitly reported with
window-minutes: 0should be treated as disabled and omitted from the TUI quota display. Only the real weekly limit should appear:Actual Behavior
The TUI displays:
Environment
1.17.196.7.1(clean install; no local patches loaded)v24.3.0Possible Cause
In
lib/tui-quota-cache.ts,parseLimit()formats a non-positive/absent window asquota.hasUsefulLimit()then retains it becauseusedPercentis numeric even whenwindowMinutes === 0:A narrow fix may be to reject a limit when
windowMinutes === 0, while preserving generic limits where the window header is genuinely absent.Logs
No raw request logs attached because they contain unrelated response metadata. The relevant sanitized
x-codex-*fields are included above.Compliance Checklist
Additional Context
The server usage endpoint reports the real weekly allowance correctly. This issue is limited to parsing/rendering the disabled secondary header window in the TUI status cache.