Skip to content

fix(frontend): OHE-3247 hide quota settings entry when daily limit is unlimited - #343

Merged
hieptl merged 1 commit into
design-updatefrom
hieptl/ohe-3247
Sep 10, 2026
Merged

hieptl merged 1 commit into
design-updatefrom
hieptl/ohe-3247

Conversation

@hieptl

@hieptl hieptl commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes OHE-3247.

  • Hide the Quota entry in the Settings navigation when the daily conversation limit is unlimited (daily_limit === null).
  • Keep the entry visible whenever a finite limit is in effect.
  • Only enable the quota status query in SaaS mode so the navigation hook never calls the enterprise-only endpoint in OSS builds.
  • Regression tests for both the configured-limit and unlimited cases.

Supersedes #340, which carries the same change but targets the stale feat/quota-usage-page branch (already merged via #199). This PR targets design-update.

Root cause

The /settings/quota item is part of SAAS_NAV_ITEMS and nothing in useSettingsNavItems filtered it, so it rendered for every SaaS-mode deployment. Self-hosted enterprise installs run with OH_APP_MODE=saas and, by default, no OH_DAILY_CONVERSATION_LIMIT, so GET /api/quota/status returns daily_limit: null and the page only showed "Unlimited" plus the request-increase link.

Gating on the resolved limit rather than on deployment_mode keeps the page available for self-hosted deployments that set dailyConversationLimit in the Helm chart.

Notes

  • Unlimited SaaS users (including exempt orgs) also lose the entry, since the page has nothing actionable for them.
  • Direct navigation to /settings/quota is not redirected; nothing in the product links there when the quota is unlimited.

Validation

  • npx vitest run __tests__/hooks/use-settings-nav-items.test.tsx __tests__/routes/quota-settings.test.tsx — 28 passed
  • npm run typecheck — clean
  • npx eslint / npx prettier --check on the touched source files — clean
  • Pre-commit hook (lint-staged + backend pre-commit) — passed

Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-1460790

… unlimited

The Quota entry in the Settings navigation rendered for every SaaS-mode
deployment, including self-hosted enterprise installs where no daily
conversation limit is configured. The page then only showed "Unlimited"
plus a request-increase link.

Gate the nav item on the quota status: hide it when `daily_limit` is
null, keep it whenever a finite limit is in effect. The status query is
only enabled in SaaS mode so OSS builds never call the enterprise-only
endpoint from the navigation hook.

Includes regression tests for both the configured-limit and unlimited
cases.
@github-actions github-actions Bot added the type: fix A bug fix label Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

This PR does not seem to contain any modification to coverable code.

@hieptl
hieptl merged commit ef1defb into design-update Sep 10, 2026
13 of 14 checks passed
@hieptl
hieptl deleted the hieptl/ohe-3247 branch September 10, 2026 11:27
hieptl added a commit that referenced this pull request Sep 18, 2026
#174)

* feat(frontend): add OpenHands-Neo theme tokens and scoped UI root

Wire agent-canvas-style --oh-* / cool-grey tokens, AgentServerUIRoot, and neo palette application so the SaaS shell can share the same theme foundation.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add shared settings and form layout class helpers

Port agent-canvas layout utilities so settings-like pages can reuse the same form, list, and sidebar spacing classes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle settings navigation for OpenHands-Neo

Match agent-canvas settings chrome with tokenized nav links, logo header, bottom user menu, and settings-owned gutters.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize organization settings pages for neo theme

Restyle org management, members list, and git org rows with shared settings list/form tokens and updated mocks/tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize budgets and usage dashboard for neo theme

Replace hardcoded greys with base/surface/muted/primary tokens so budgets and usage monitoring match agent-canvas.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize shared chrome components for neo theme

Update spinners, badges, chips, context menus, and related shell controls to use --oh-* / muted tokens instead of hardcoded greys.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align toast handlers with agent-canvas

Use neo toast tokens, custom CircleX error layout, loading helper, and route call sites through the shared handlers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(openhands-ui): restyle toasterMessages for neo theme

Replace the pill toast chrome with agent-canvas-aligned surface, border, radius, and status icon colors.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: add neo theme component audit notes

Track remaining hardcoded hex surfaces for follow-up tokenization work.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align settings shell and neo theme chrome

Restyle the settings rail (sidebar, drawer, white brand mark), forms, integrations, and related surfaces to match OpenHands-Neo tokens and agent-canvas patterns.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): polish settings nav scope and continue neo UI work

Clarify Personal settings as org-scoped (This org chip), fold Integrations
and Skills into that section, and move User/Application to the bottom.
Continue settings shell, credits, MCP, and chrome alignment.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): refine neo skeletons and select-style dropdown toggle

Improve loading skeleton fidelity and stagger, and let non-searchable
dropdowns click-open/click-close like other selects.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): stop LLM profile rows clipping on mobile

Override the shared fixed list-row height and keep the Default badge
inline with the profile name so stacked mobile content no longer
overflows the overflow-hidden profiles list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): align settings tests with neo UI behavior

Update frontend tests for neo chrome (toasts, dropdowns, budgets, git settings) and show the org-wide badge on budgets/credits.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): rename settings nav brand label to Account

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): land on Agent Canvas instead of settings

Agent Canvas is served at /canvas next to the enterprise app, so the root
route (and therefore the default post-login destination) should open it
rather than the settings shell.

- replace the settings index redirect with a landing route that does a
  document-level replace to /canvas (a router redirect would bounce
  through the SPA's own canvas/* route and leave / in history)
- keep the route inside the root layout so auth, guards and the
  login_method callback still run before leaving the app
- keep invitation links (/?invitation_token=...) in the settings shell
  so the token is captured and auto-accepted instead of dropped

* fix: scope LLM API key query by organization ID (#282)

* fix: hide quota reset timer for unlimited quotas (#280)

* fix: honor ?org= deep link to sync the active org on settings pages (#281)

* fix(frontend): OHE-3216 display the user profile avatar in the settings nav (#307)

The settings-nav user menu rendered UserAvatar without the git user's
avatar_url or fetch state, so it always showed the placeholder icon even
when a profile picture was available. This restores the wiring dropped in
77bb8f2, matching the legacy sidebar: show the picture when present, the
placeholder otherwise, and a spinner while the profile is being fetched.

Extend the user-menu tests to cover the avatar, placeholder, and loading
states.

* fix(frontend): OHE-3247 hide quota settings entry when daily limit is unlimited (#343)

The Quota entry in the Settings navigation rendered for every SaaS-mode
deployment, including self-hosted enterprise installs where no daily
conversation limit is configured. The page then only showed "Unlimited"
plus a request-increase link.

Gate the nav item on the quota status: hide it when `daily_limit` is
null, keep it whenever a finite limit is in effect. The status query is
only enabled in SaaS mode so OSS builds never call the enterprise-only
endpoint from the navigation hook.

Includes regression tests for both the configured-limit and unlimited
cases.

* fix(frontend): OHE-3242 replace history entries on settings guard redirects (#342)

Loader redirects in the settings shell (the ?org= strip, the /settings ->
/settings/org-defaults hop and the permission fallback) were history
pushes, so entering Settings from Agent Canvas in the same tab and
pressing Back re-ran the loader and bounced forward again. They now use
React Router's replace() so one Back returns to the canvas.

* feat: add Test connection for MCP servers on cloud backends (#366)

* feat: add Test connection for MCP servers on cloud backends

* fix(mcp): harden the MCP test route and type its request body

Address review feedback on POST /api/v1/mcp/test:

- Reject probe targets that must never be reached from the app-server pod:
  only http/https URLs are accepted, and hosts that resolve to loopback,
  link-local (instance metadata), unspecified, multicast or reserved
  addresses, including IPv4-mapped IPv6 forms, are refused with 422.
  Private networks stay reachable because self-hosted deployments run
  their MCP servers there. MCP_TEST_ALLOW_LOCAL_TARGETS=true disables the
  address check for local development. The threat model is documented in
  the module docstring.
- Accept a typed MCPTestRequestBody so the OpenAPI schema documents the
  request and FastAPI validates the top-level fields; the server entry
  stays an untyped map so redacted secrets can be restored before the SDK
  validates it.
- Walk the secret dumps with zip(strict=True) and also scrub URL-encoded
  and JSON-escaped forms of restored secrets from the response text.
- Require a server URL explicitly in the frontend test hook and document
  the request type.
- Cover the new target guard, encoded-secret scrubbing, every failure
  kind's message, and the disabled buttons while a test is pending.

* chore: Remove PR-only artifacts [automated]

* chore: restore the design-update PR artifact this branch deleted

The "PR Artifacts" workflow's cleanup-on-approval job runs `git rm -rf .pr/`
on approval, so approving this PR deleted `.pr/neo-theme-component-audit.md`
(commit 1fcc5a4). That file is design-update's, inherited from the base
branch, not an artifact of this PR, and deleting it is unrelated to the MCP
test route. Restore it from design-update.

---------

Co-authored-by: allhands-bot <allhands-bot@users.noreply.github.com>

* fix(frontend): align budgets and user-actions tests with neo UI and quota polling

The budgets override test added on main selected the row action by its
old "Edit" text. The neo UI renders it as an icon button labelled
"Edit budget for <name>", so use that accessible name, matching the
sibling override test.

The user-actions menu close delay tests drained timers with
runAllTimersAsync. The settings nav hook now polls the quota status,
which puts a refetch interval in the UserActions tree, so draining all
timers never terminates. Flush only the pending timers instead.

* chore: Remove PR-only artifacts [automated]

* chore: re-trigger PR checks after automated artifact cleanup

The automated .pr/ cleanup commit was pushed with the workflow token, so
the pull_request_target title lint never ran on it and the required
check stayed unreported. This empty commit re-triggers it.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: hieptl <hieptl.developer@gmail.com>
Co-authored-by: Hiep Le <69354317+hieptl@users.noreply.github.com>
Co-authored-by: allhands-bot <allhands-bot@users.noreply.github.com>
hieptl added a commit that referenced this pull request Sep 21, 2026
* feat(frontend): add OpenHands-Neo theme tokens and scoped UI root

Wire agent-canvas-style --oh-* / cool-grey tokens, AgentServerUIRoot, and neo palette application so the SaaS shell can share the same theme foundation.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): add shared settings and form layout class helpers

Port agent-canvas layout utilities so settings-like pages can reuse the same form, list, and sidebar spacing classes.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): restyle settings navigation for OpenHands-Neo

Match agent-canvas settings chrome with tokenized nav links, logo header, bottom user menu, and settings-owned gutters.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize organization settings pages for neo theme

Restyle org management, members list, and git org rows with shared settings list/form tokens and updated mocks/tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize budgets and usage dashboard for neo theme

Replace hardcoded greys with base/surface/muted/primary tokens so budgets and usage monitoring match agent-canvas.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): tokenize shared chrome components for neo theme

Update spinners, badges, chips, context menus, and related shell controls to use --oh-* / muted tokens instead of hardcoded greys.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align toast handlers with agent-canvas

Use neo toast tokens, custom CircleX error layout, loading helper, and route call sites through the shared handlers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(openhands-ui): restyle toasterMessages for neo theme

Replace the pill toast chrome with agent-canvas-aligned surface, border, radius, and status icon colors.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: add neo theme component audit notes

Track remaining hardcoded hex surfaces for follow-up tokenization work.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): align settings shell and neo theme chrome

Restyle the settings rail (sidebar, drawer, white brand mark), forms, integrations, and related surfaces to match OpenHands-Neo tokens and agent-canvas patterns.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): polish settings nav scope and continue neo UI work

Clarify Personal settings as org-scoped (This org chip), fold Integrations
and Skills into that section, and move User/Application to the bottom.
Continue settings shell, credits, MCP, and chrome alignment.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): refine neo skeletons and select-style dropdown toggle

Improve loading skeleton fidelity and stagger, and let non-searchable
dropdowns click-open/click-close like other selects.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): stop LLM profile rows clipping on mobile

Override the shared fixed list-row height and keep the Default badge
inline with the profile name so stacked mobile content no longer
overflows the overflow-hidden profiles list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): align settings tests with neo UI behavior

Update frontend tests for neo chrome (toasts, dropdowns, budgets, git settings) and show the org-wide badge on budgets/credits.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontend): rename settings nav brand label to Account

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(frontend): land on Agent Canvas instead of settings

Agent Canvas is served at /canvas next to the enterprise app, so the root
route (and therefore the default post-login destination) should open it
rather than the settings shell.

- replace the settings index redirect with a landing route that does a
  document-level replace to /canvas (a router redirect would bounce
  through the SPA's own canvas/* route and leave / in history)
- keep the route inside the root layout so auth, guards and the
  login_method callback still run before leaving the app
- keep invitation links (/?invitation_token=...) in the settings shell
  so the token is captured and auto-accepted instead of dropped

* fix: scope LLM API key query by organization ID (#282)

* fix: hide quota reset timer for unlimited quotas (#280)

* fix: honor ?org= deep link to sync the active org on settings pages (#281)

* fix(frontend): OHE-3216 display the user profile avatar in the settings nav (#307)

The settings-nav user menu rendered UserAvatar without the git user's
avatar_url or fetch state, so it always showed the placeholder icon even
when a profile picture was available. This restores the wiring dropped in
77bb8f2, matching the legacy sidebar: show the picture when present, the
placeholder otherwise, and a spinner while the profile is being fetched.

Extend the user-menu tests to cover the avatar, placeholder, and loading
states.

* fix(frontend): OHE-3247 hide quota settings entry when daily limit is unlimited (#343)

The Quota entry in the Settings navigation rendered for every SaaS-mode
deployment, including self-hosted enterprise installs where no daily
conversation limit is configured. The page then only showed "Unlimited"
plus a request-increase link.

Gate the nav item on the quota status: hide it when `daily_limit` is
null, keep it whenever a finite limit is in effect. The status query is
only enabled in SaaS mode so OSS builds never call the enterprise-only
endpoint from the navigation hook.

Includes regression tests for both the configured-limit and unlimited
cases.

* fix(frontend): OHE-3242 replace history entries on settings guard redirects (#342)

Loader redirects in the settings shell (the ?org= strip, the /settings ->
/settings/org-defaults hop and the permission fallback) were history
pushes, so entering Settings from Agent Canvas in the same tab and
pressing Back re-ran the loader and bounced forward again. They now use
React Router's replace() so one Back returns to the canvas.

* feat: add Test connection for MCP servers on cloud backends (#366)

* feat: add Test connection for MCP servers on cloud backends

* fix(mcp): harden the MCP test route and type its request body

Address review feedback on POST /api/v1/mcp/test:

- Reject probe targets that must never be reached from the app-server pod:
  only http/https URLs are accepted, and hosts that resolve to loopback,
  link-local (instance metadata), unspecified, multicast or reserved
  addresses, including IPv4-mapped IPv6 forms, are refused with 422.
  Private networks stay reachable because self-hosted deployments run
  their MCP servers there. MCP_TEST_ALLOW_LOCAL_TARGETS=true disables the
  address check for local development. The threat model is documented in
  the module docstring.
- Accept a typed MCPTestRequestBody so the OpenAPI schema documents the
  request and FastAPI validates the top-level fields; the server entry
  stays an untyped map so redacted secrets can be restored before the SDK
  validates it.
- Walk the secret dumps with zip(strict=True) and also scrub URL-encoded
  and JSON-escaped forms of restored secrets from the response text.
- Require a server URL explicitly in the frontend test hook and document
  the request type.
- Cover the new target guard, encoded-secret scrubbing, every failure
  kind's message, and the disabled buttons while a test is pending.

* chore: Remove PR-only artifacts [automated]

* chore: restore the design-update PR artifact this branch deleted

The "PR Artifacts" workflow's cleanup-on-approval job runs `git rm -rf .pr/`
on approval, so approving this PR deleted `.pr/neo-theme-component-audit.md`
(commit 1fcc5a4). That file is design-update's, inherited from the base
branch, not an artifact of this PR, and deleting it is unrelated to the MCP
test route. Restore it from design-update.

---------

Co-authored-by: allhands-bot <allhands-bot@users.noreply.github.com>

* feat(mcp): run OAuth MCP installs from the app server

OAuth-based MCP servers (Atlassian Rovo, GitLab, Figma and ~20 more catalog
entries) could only be installed against a local agent-server. Its OAuth
client publishes a loopback redirect URI, http://localhost:<port>/callback,
and serves that callback from its own process, so a browser talking to a
hosted backend can never complete the handshake. Agent Canvas refused the
install outright with "OAuth authorization requires a reachable local
backend."

Add the hosted counterpart:

- POST /api/v1/mcp/oauth/start validates the candidate server exactly like
  POST /api/v1/mcp/test (redacted-secret restore, remote transports only,
  SSRF guard), then runs the SDK probe on a worker thread with an OAuth
  client whose redirect URI is this server's own public callback, and
  answers with the provider's authorization URL.
- GET /api/v1/mcp/oauth/status/{job_id} reports progress and, on success,
  the OAuth state the caller persists in settings. Unknown, expired and
  other users' jobs are indistinguishable 404s.
- GET /api/v1/mcp/oauth/callback receives the provider's redirect and hands
  the authorization code to the waiting probe. It is unauthenticated and
  allowlisted in SetAuthCookieMiddleware because the cross-site navigation
  carries no session cookie (production cookies are SameSite=strict); the
  single-use state parameter generated by the MCP client identifies the job.

Jobs live in Redis under a 15-minute TTL so the callback and the status polls
can land on any app server replica while the probe thread stays on the
replica that started it. The stored probe result carries OAuth tokens and is
encrypted at rest with the app server's JWT service.

Request preparation shared with the connection-test route moves into
prepare_probe_request; POST /api/v1/mcp/test behaviour is unchanged.

Part of OHE-3249.

* fix: remove .pr

---------

Co-authored-by: FraterCCCLXIII <panentheum@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: allhands-bot <allhands-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant