Skip to content

fix(ai-usagebar): clarify quota limits and reset times - #667

Merged
ItsLemmy merged 26 commits into
noctalia-dev:mainfrom
FelipeArtur:fix/ai-usagebar-error-states
Sep 8, 2026
Merged

fix(ai-usagebar): clarify quota limits and reset times#667
ItsLemmy merged 26 commits into
noctalia-dev:mainfrom
FelipeArtur:fix/ai-usagebar-error-states

Conversation

@FelipeArtur

@FelipeArtur FelipeArtur commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Plugin

  • Id: felipeartur/ai-usagebar
  • New plugin
  • Update to an existing plugin (version bumped in plugin.toml)

What it does

Updates AI Usage to 2.2.0 with clearer quota readings in the bar and panel.

  • Shows the exhausted window and its reset time. If multiple windows are at
    100%, it uses the latest reset. Critical severity below 100% remains a warning,
    not a block.
  • Groups Antigravity limits by model, including reports with only one model.
    Model icons, values and colors respect the widget settings.
  • Hides providers with unusable readings, but keeps response-format errors
    visible with a missing-value indicator and diagnostic.
  • Uses theme colors and a master/detail panel without a repeated usage summary.
    Exhausted quotas get a compact notice. Codex reset credits show their type and
    expiry on separate, wrapping lines.
  • Clarifies the English settings and README. Existing translated locales are
    unchanged.

The security review found and fixed gaps in diagnostic redaction. Quoted
sensitive values now remove the rest of the line, including escaped or
truncated values. Authorization and cookie headers are redacted, and sensitive
JSON fields are scrubbed before publication to plugin state. Numeric token
counts retain their values and types. This is pattern-based protection, not a
guarantee that arbitrary CLI output contains no private information.

External dependencies

ai-usagebar, declared in plugin.toml. One service runs the fixed command
ai-usagebar usage --json on the configured interval or a refresh request.
Requests are coalesced, with a 30-second process timeout.

The CLI owns provider requests, credentials and caching. The plugin does not
make network requests or write files. It reads the process output, scrubs text,
and publishes the report to Noctalia plugin state for the bar and panel.
The installation address is plain text; the plugin no longer spawns xdg-open.

Testing

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Noctalia version tested against: v5.0.1 (5.0.1-1-dirty)
  • Plugin API level: 22

Tested with the official ai-usagebar 1.12.0 package. Opened the Codex and
Antigravity panels, selected providers through IPC, refreshed the report, and
checked quota cards and countdowns in the current dark theme. Other themes and
display scales have not been visually tested.

The five Lua suites pass. They cover credential-pattern redaction, refresh
coalescing, malformed data, provider/account selection, exhausted-window reset
selection, Antigravity settings, parser failures, reset-credit layout and
timestamp parsing across daylight-saving transitions. Redaction tests cover
34 secret cases, 20 benign readings and nested sensitive fields. The synthetic
report remains within the existing redaction cost limit.

cd ai-usagebar
lua tests/scrub_test.lua
lua tests/refresh_test.lua
lua tests/bar_test.lua
lua tests/panel_test.lua
TZ=America/New_York lua tests/shared_test.lua
noctalia plugins lint .

Plugin lint reports no errors or warnings. Repository manifest validation and
git diff --check pass.

Screenshots / Videos

image image image image

Checklist

  • The directory name matches the part of id after the / in plugin.toml exactly.
  • It ships plugin.toml, README.md, thumbnail.webp, and translations/en.json.
  • README.md follows the
    README template, documents
    every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
  • thumbnail.webp is present and relevant; for a new plugin I created it with the thumbnail generator, and for an update I regenerated it with the generator if the visual identity or user-facing appearance changed.
  • version follows semver and is bumped in this PR; plugin_api is the oldest API level this plugin requires.
  • Every non-English translation in this PR uses a locale supported by Noctalia core, and I can read, write, and
    understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
  • I did not edit catalog.toml; CI generates it.
  • This PR touches exactly one plugin directory.

Code review attestation

Plugins run as trusted, unsandboxed Luau in the user's session. Confirm:

  • The code is readable and not obfuscated, minified, or generated.
  • It does not download and execute remote code.
  • Every network call, filesystem write, and spawned process is something the description above accounts for.
  • I have the right to publish this code under the license declared in plugin.toml.

Redact quoted diagnostic values and sensitive headers completely.
Inspect JSON field names before publishing report data to plugin state.
Preserve numeric token counts and cover the redaction gaps with tests.
@FelipeArtur
FelipeArtur marked this pull request as ready for review September 8, 2026 14:41
Copilot AI lite review requested due to automatic review settings September 8, 2026 14:41

Copilot AI 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.

🟢 Approval recommended

The changes are cohesive with the stated goals (quota/reset clarity + redaction hardening) and are supported by expanded targeted Lua test coverage across shared, bar, panel, and scrub logic.

Pull request overview

Updates the felipeartur/ai-usagebar plugin to v2.2.0 to improve how quota exhaustion/reset timing is communicated, refine provider/model presentation in the bar + panel, and strengthen diagnostic redaction before publishing CLI output into plugin state.

Changes:

  • Improve quota “headline” selection (incl. exhausted-window reset selection) and group Antigravity limits by model in both bar and panel UI.
  • Filter providers with unusable readings (while keeping schema/parser failures visible with a missing-value indicator) and refine the panel’s master/detail layout.
  • Harden redaction logic for quoted secrets, headers, and sensitive JSON fields; expand/adjust Lua test coverage accordingly.
File summaries
File Description
ai-usagebar/translations/en.json Updates English setting/help strings and adds quota exhaustion/reset copy used by the panel.
ai-usagebar/tests/shared_test.lua Expands shared behavior tests for availability filtering, ordering, bottleneck selection, and model headline logic.
ai-usagebar/tests/scrub_test.lua Adds additional secret/header and structured-field redaction test cases.
ai-usagebar/tests/panel_test.lua Updates/expands panel rendering tests for provider filtering, model grouping, stale behavior, and exhausted-quota notices.
ai-usagebar/tests/bar_test.lua Updates/expands bar rendering/tooltip tests for bottleneck selection, model glyphs, countdown formatting, and filtering.
ai-usagebar/shared.luau Adds transport/auth classifiers, “read failure” exception handling, fixed countdown formatting, and model/headline selection + sorting.
ai-usagebar/service.luau Strengthens redaction patterns (quoted secrets, authorization/cookie headers) and adds structured-field scrubbing rules.
ai-usagebar/README.md Aligns documentation with the new behavior (quota exhaustion/reset semantics, provider filtering, UI behavior, redaction notes).
ai-usagebar/plugin.toml Bumps plugin version to 2.2.0 and adjusts panel dimensions.
ai-usagebar/panel.luau Updates panel visuals/layout, filters transport-detail noise from cards, adds exhausted-quota notices, and supports model grouping.
ai-usagebar/bar.luau Updates capsule rendering/tooltip to reflect bottleneck/exhaustion logic, model grouping, and missing-data behavior for parser failures.
Review details
  • Files reviewed: 11/12 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ItsLemmy
ItsLemmy merged commit 41d0707 into noctalia-dev:main Sep 8, 2026
4 checks passed
@FelipeArtur
FelipeArtur deleted the fix/ai-usagebar-error-states branch September 8, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants