Skip to content

fix(meet): recognize backend capacity gate and surface an actionable message#4221

Merged
senamakel merged 4 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/mascot-streaming-capacity-exhausted-4151
Jun 29, 2026
Merged

fix(meet): recognize backend capacity gate and surface an actionable message#4221
senamakel merged 4 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/mascot-streaming-capacity-exhausted-4151

Conversation

@M3gA-Mind

@M3gA-Mind M3gA-Mind commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

The meet capacity-gate detection in meetCallService.ts compared the backend error text for exact equality against the frontend SERVER_OVERLOADED_MESSAGE constant. That constant was changed to friendlier copy and no longer equals the backend's actual wording ('Mascot streaming capacity is exhausted. Please try again later.' — backend src/utils/paidPlan.ts), and the shared apiClient strips errorCode (only forwards error/message). So the check never fired and the raw, generic backend string ("…try again later.") leaked to users on the Send-to-Google-Meet panel instead of the tailored, actionable copy — the issue's main complaint (#4151).

Fix

  • Add isCapacityGateMessage() — a case-insensitive substring match on the backend wording (streaming capacity / capacity is exhausted), resilient to minor wording drift on either side.
  • Surface the tailored SERVER_OVERLOADED_MESSAGE ("…try again in a few minutes") whenever the gate is recognized, in both joinMeetingViaMascotBot and the meet panel's two error paths (MeetingBotsCard.tsx).
  • Update the unit test to mock the real backend message (which would have caught the mismatch) and add direct coverage for the matcher.

Scope note

The active capacity gate and the trigger ultimately live in the backend (the openhuman desktop meet path — core RPC agent_meetings_join → backend bot:join — is currently open-access). This PR fixes the openhuman-side capacity-gate detection + message contract so that whenever the gate is surfaced the user sees an informative, actionable notice rather than the raw generic text. Fully re-scoping the gate so it never trips for fresh/zero-session users is a backend concern (tinyhumansai/backend paidPlan/routes/mascots) outside this repo.

Closes #4151

Summary by CodeRabbit

  • Bug Fixes
    • Improved meeting-bot error handling so capacity-related failures now show a clearer “server overloaded” message instead of a generic error.
    • Made the overload detection more flexible, helping it recognize capacity issues even when the backend wording varies.
  • New Features
    • Added a new localized message for server-overload situations in multiple languages.

The meet capacity-gate detection compared the backend error text for exact
equality against the frontend SERVER_OVERLOADED_MESSAGE constant. That
constant was changed to friendlier copy and no longer equals the backend's
actual wording ('Mascot streaming capacity is exhausted. Please try again
later.'), and apiClient strips errorCode — so the check never fired and the
raw, generic backend string leaked to users on the Send-to-Google-Meet panel.

Add isCapacityGateMessage() (case-insensitive substring match on the backend
wording), surface the tailored actionable copy when gated, and apply the same
mapping in the meet panel's two error paths. Update the unit test to mock the
REAL backend message (which would have caught the mismatch) plus direct
coverage for the matcher.

Closes tinyhumansai#4151
@M3gA-Mind M3gA-Mind requested a review from a team June 26, 2026 16:46
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The meeting-bots flow now treats backend capacity-gate responses as a special case, shows a localized overload message in the card, and adds the new translation key across locales. Tests cover the helper and updated join error handling.

Changes

Meeting bot capacity-gate handling

Layer / File(s) Summary
Service capacity-gate detection and wrapping
app/src/services/meetCallService.ts, app/src/services/__tests__/joinMeetingViaMascotBot.test.ts
joinMeetingViaMascotBot now uses isCapacityGateMessage to classify backend capacity text, and tests cover the helper plus the updated capacity-gating path.
MeetingBotsCard error copy
app/src/components/skills/MeetingBotsCard.tsx
MeetingBotsCard swaps backend error text for skills.meetingBots.serverOverloaded in both the error state effect and submit catch path.
Locale message maps
app/src/lib/i18n/*.ts
Adds skills.meetingBots.serverOverloaded to the localized message maps across supported languages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • tinyhumansai/openhuman#3597: Shares the MeetingBotsCard.tsx join/error flow that this PR updates with capacity-gate detection and localized overload text.

Suggested reviewers

  • sanil-23
  • oxoxDev

Poem

I thump when the bot is a little too full,
But now it says “try later” in every tongue.
I twitch my nose at the server’s hum,
Then hop along when the message is sung.
🐰✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR improves the capacity-gate message, but it doesn't address the reported first-use/on-load trigger or stale capacity state. Investigate and fix why the capacity check fires on initial load or from stale state, so only real post-usage limits trigger the banner.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately describes the main change: recognizing backend capacity gate errors and surfacing a better message.
Out of Scope Changes check ✅ Passed All changes support the meet capacity-gate fix, localization, and tests; no unrelated scope creep is evident.

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88d5124d77

ℹ️ 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".

const raw = meetError?.trim() || t('skills.meetingBots.failedToStart');
// A capacity-gate error carries the backend's terse "…try again later."
// wording; show the tailored, actionable copy instead (#4151).
const message = isCapacityGateMessage(raw) ? SERVER_OVERLOADED_MESSAGE : raw;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use i18n for capacity-gate copy

For capacity-gated joins in non-English locales, this new branch surfaces the hard-coded English SERVER_OVERLOADED_MESSAGE in both the inline alert and toast instead of going through useT(). The repo AGENTS.md i18n rule requires all UI text to use translation keys with locale entries, so this bypass will leave localized builds showing English precisely on the new error path.

Useful? React with 👍 / 👎.

@M3gA-Mind M3gA-Mind self-assigned this Jun 26, 2026
The capacity-gate branch surfaced the hard-coded English SERVER_OVERLOADED_MESSAGE
in the inline alert and toast, bypassing useT() — localized builds would show
English on this error path. Add skills.meetingBots.serverOverloaded (with real
translations in all 14 locales) and route both error paths through t().

Addresses @chatgpt-codex-connector on app/src/components/skills/MeetingBotsCard.tsx:268
Wrap the BACKEND_CAPACITY_MESSAGE literal to satisfy format:check (the failing
Frontend Checks CI step).
@M3gA-Mind

Copy link
Copy Markdown
Collaborator Author

pnpm review: flagged unlocalized capacity-gate copy + a prettier violation — routed the copy through i18n with full locale parity (13e7e05) and applied prettier (5663570). i18n:check passes (0 missing/extra), 80/80 unit tests. CI re-running.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/components/skills/MeetingBotsCard.tsx (1)

264-300: 🎯 Functional Correctness | 🟠 Major

Propagate the overload signal through joinMeetViaBackendBot()
handleSubmit only gets Core rejected the agent_meetings_join request., so isCapacityGateMessage() never sees the backend overload text here and skills.meetingBots.serverOverloaded can’t be shown on this path. Surface the backend’s overload message or a dedicated flag from the core RPC layer instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/components/skills/MeetingBotsCard.tsx` around lines 264 - 300,
Propagate the backend overload signal through joinMeetViaBackendBot so
handleSubmit can recognize it and show skills.meetingBots.serverOverloaded.
Right now the catch path in MeetingBotsCard.tsx only receives a generic Core
rejected the agent_meetings_join request message, so isCapacityGateMessage()
never matches; update the core RPC result/error handling to preserve the
backend’s overload text or return a dedicated flag, and then use that in
handleSubmit before calling setError/onToast.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@app/src/components/skills/MeetingBotsCard.tsx`:
- Around line 264-300: Propagate the backend overload signal through
joinMeetViaBackendBot so handleSubmit can recognize it and show
skills.meetingBots.serverOverloaded. Right now the catch path in
MeetingBotsCard.tsx only receives a generic Core rejected the
agent_meetings_join request message, so isCapacityGateMessage() never matches;
update the core RPC result/error handling to preserve the backend’s overload
text or return a dedicated flag, and then use that in handleSubmit before
calling setError/onToast.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 33059cde-2ebf-4911-a6e1-9c1c9f2f6e3b

📥 Commits

Reviewing files that changed from the base of the PR and between 56af7ec and 5663570.

📒 Files selected for processing (17)
  • app/src/components/skills/MeetingBotsCard.tsx
  • app/src/lib/i18n/ar.ts
  • app/src/lib/i18n/bn.ts
  • app/src/lib/i18n/de.ts
  • app/src/lib/i18n/en.ts
  • app/src/lib/i18n/es.ts
  • app/src/lib/i18n/fr.ts
  • app/src/lib/i18n/hi.ts
  • app/src/lib/i18n/id.ts
  • app/src/lib/i18n/it.ts
  • app/src/lib/i18n/ko.ts
  • app/src/lib/i18n/pl.ts
  • app/src/lib/i18n/pt.ts
  • app/src/lib/i18n/ru.ts
  • app/src/lib/i18n/zh-CN.ts
  • app/src/services/__tests__/joinMeetingViaMascotBot.test.ts
  • app/src/services/meetCallService.ts

@M3gA-Mind M3gA-Mind removed their assignment Jun 26, 2026
@senamakel senamakel merged commit 3cc9e35 into tinyhumansai:main Jun 29, 2026
15 checks passed
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.

bug: "Mascot streaming capacity is exhausted" shown on first use of Google Meet integration

2 participants