Agentic UI: Warn in the composer at 90% AI credit usage and complete the exhausted state - #4714
Open
gcsecsey wants to merge 4 commits into
Open
Agentic UI: Warn in the composer at 90% AI credit usage and complete the exhausted state#4714gcsecsey wants to merge 4 commits into
gcsecsey wants to merge 4 commits into
Conversation
…the exhausted state
Contributor
There was a problem hiding this comment.
Pull request overview
Adds AI-credit warning and exhausted-account behavior to the Agentic UI composer.
Changes:
- Warns users at 90% credit usage.
- Hides new-chat actions and suggested prompts when credits are exhausted.
- Preserves the composer during active runs and expands related tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
session-chat-actions.tsx |
Conditionally hides new-chat controls. |
session-chat-actions.test.tsx |
Tests hidden controls and shortcut. |
session-view/index.tsx |
Implements exhausted-state rendering. |
session-view/index.test.tsx |
Tests exhausted and active-run states. |
composer/style.module.css |
Styles the warning strip. |
composer/index.tsx |
Adds the warning strip. |
ai-credits-warning-strip.tsx |
Implements the 90% warning. |
ai-credits-warning-strip.test.tsx |
Tests warning thresholds. |
use-ai-credits-meter.ts |
Exposes the combined credit meter. |
use-ai-credits-meter.test.ts |
Tests meter availability and values. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
gcsecsey
marked this pull request as ready for review
August 28, 2026 16:57
…-states' into gcsecsey/composer-credit-warning-states
Collaborator
📊 Performance Test ResultsComparing 6e387be vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
I used Opus 5 for implementation and tests.
Proposed Changes
This PR adds a caution strip once the balance enters its last 10%, and hides the New chat action and the suggested prompts in the exhausted state.
One included fix: when the balance hit zero mid-run, the composer was replaced instantly and hid the Stop button. An in-flight run now keeps showing it.
Testing Instructions
Use the testing steps in 236947-ghe-Automattic/wpcom for setting up your balance at the desired states:
CleanShot.2026-08-28.at.17.52.20.mp4
Check both color schemes, a narrow window, and an RTL locale such as Arabic.
Pre-merge Checklist