fix(ui): add context-notice component and refresh token stats after every chat turn, solve #45230, #45034, #45192, #45794#45282
Conversation
* Providers: add built-in AIPing provider support * Docs: clarify AIPing router-param usage * Onboard: add AIPing routing presets * Docs: add AIPing API key portal link --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Greptile SummaryThis PR fixes two related bugs in the Control UI chat tab: (1) the context-usage notice displayed impossible values (usage > window) on page refresh because it was using cumulative Changes:
All edge cases are handled correctly: undefined session, zero limit, ratio > 1.0 (clamped to 100%), and ratio < 0.85 (returns Confidence Score: 4/5
Last reviewed commit: 67051c7 |
67051c7 to
82a9321
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82a932114b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
352291e to
7a526cb
Compare
… headers and adding Bearer auth (#4) * fix(minimax): honor authHeader=true by injecting Bearer auth for anthropic-compatible endpoints * fix(minimax): suppress anthropic-beta headers to restore token-by-token streaming --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
|
I also have the same issue (#45230) with 2026.3.13 and can confirm this does fix the issue. |
768305a to
cc5258b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc5258b115
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
744eaf3 to
263dbff
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
263dbff to
df1a366
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df1a366596
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
df1a366 to
87ef55a
Compare
48c7c34 to
ca4b4ba
Compare
ca4b4ba to
6a94643
Compare
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c6fc1195b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…or/issues-45230-45034-root-cause-9f24 Resolve conflicts: use model-auth-env re-exports; keep pinned-session in sessions list; merge GatewaySessionRow fields; combine context-notice logic and browser tests with upstream theme-var coverage. Co-authored-by: 0x4C33 <haoruilee@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: adde5c17b4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| }; | ||
| } | ||
|
|
||
| export async function resolveImplicitProviders(params: { |
There was a problem hiding this comment.
Remove duplicate resolveImplicitProviders declaration
This commit adds a second exported resolveImplicitProviders implementation while one already exists later in the same module, so the file now has duplicate exported function declarations. In ESM this is a duplicate identifier error at module load time, which prevents this provider-config module from importing and breaks commands that rely on model/provider resolution.
Useful? React with 👍 / 👎.
| | "qwen-portal" | ||
| | "xai-api-key" | ||
| | "mistral-api-key" | ||
| | "aiping-api-key" |
There was a problem hiding this comment.
Wire new aiping-api-key choice to an auth handler
Adding "aiping-api-key" to built-in auth choices exposes a new onboarding path, but there is no corresponding runtime handler for that choice in the auth-choice flow (API-provider handling remains limited, and no bundled provider auth choice for AIPing is present). As a result, openclaw onboard --auth-choice aiping-api-key falls through without applying credentials/default model, so the newly advertised flow is non-functional.
Useful? React with 👍 / 👎.
|
Closing as superseded by #71297 for the Control UI chat context-warning/session-refresh portion. #71297 resolves the current version of the same stale context notice failure with a smaller scoped patch: live session metadata is applied immediately from gateway events, overlapping session reloads are coalesced, stale totals are hidden, the context notice layout is covered by current styles, and the compact recommendation CTA is included. This PR also contains broad unrelated provider/config/test churn, so it should not remain the canonical path for the Control UI chat fix. Any still-needed non-UI changes should be split into separate PRs. |
Summary
550.4k / 204.8k, usage > window). Two root causes: (a) the component usedinputTokens(cumulative all-time input, can far exceed the context window) instead oftotalTokens(current turn's context window usage); (b) the CSS for.context-noticewas missing entirely, so the unstyled<div>expanded to fill the screen.loadSessions()was only called after a terminal chat event when the run ID was inrefreshSessionsAfterChat— which only happened for/new/resetcommands, never for normal turns.renderContextNoticetoui/src/ui/views/chat.tsusingtotalTokensasused, with an inline SVG warning icon; (2) added.context-noticeCSS block toui/src/styles/chat/layout.cssas a non-blocking inline banner with progressive amber→red coloring; (3) changedhandleTerminalChatEventinui/src/ui/app-gateway.tsto unconditionally callloadSessions()after everyfinalchat event.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
X% context usedandused / limittoken counts.Security Impact (required)
sessions.listwas already called post-chat for /new commands; it is now called for all final events (same endpoint, same parameters)Repro + Verification
Environment
Steps
Expected
totalTokens / contextTokenswheretotalTokens <= contextTokensActual (before fix)
inputTokenswhich could be 2–3× larger thancontextTokens, showing550.4k / 204.8k; missing CSS caused full-screen overlayEvidence
pnpm test)pnpm checkpasses (oxlint + format)Human Verification (required)
Compatibility / Migration
Failure Recovery (if this breaks)
9d6599072ui/src/ui/views/chat.ts,ui/src/ui/app-gateway.ts,ui/src/styles/chat/layout.csssessions.listcall after each chat turn (very cheap read, no side effects)Risks and Mitigations
loadSessions()now fires after every final chat event instead of only after /new. This adds one lightweight gateway request per turn.loadSessionsalready has a guard (if (state.sessionsLoading) return) to prevent concurrent calls. The request is cheap (just reads the in-memory session store).