Skip to content

Stop naming a provider for MCPJam's own swarm model limit - #5292

Merged
chelojimenez merged 1 commit into
mainfrom
fix/swarm-account-limit-code
Sep 17, 2026
Merged

chelojimenez merged 1 commit into
mainfrom
fix/swarm-account-limit-code

Conversation

@chelojimenez

@chelojimenez chelojimenez commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

What happened

A swarm running anthropic/claude-haiku-4.5 on MCPJam's credits hit the daily MCPJam model limit on 2 of 5 sessions. The run screen said:

Anthropic rate-limited this key. 2 sessions stopped. Retry again later or switch models.

Anthropic throttled nothing, and switching models doesn't lift this limit (BYOK or waiting does).

Why

The two stopped attempts were stored with:

errorCode:    rate_limited
errorMessage: Daily MCPJam model limit reached. Use BYOK or try again tomorrow. Try again in 621 minutes.

terminalForOutcome cleans up the raw message, which drops the backend's user_rate_limit code, and then saves the generic rate_limited. isAccountLimit finds no code in either field, so the banner treats the attempt as a provider throttle and names the provider from the session's model id.

Change

  • Runner (swarm-runner.ts): a rate_limited terminal keeps the account-limit code from the raw message (accountLimitCode) and falls back to rate_limited only when none is found. The whole-run stop already read that same code, so run behavior doesn't change. Only the stored errorCode does.
  • Shared (swarm-attempt-error.ts): new accountLimitCode(). isAccountLimit also matches the backend's Daily/Monthly MCPJam model limit reached sentence, so rows already saved in prod stop blaming a provider without a backfill.
  • Run screen (new-swarm-running-step.tsx): when a wave also has successful sessions, the run banner stays silent. Sessions stopped by the account limit now get their own amber line ("N sessions stopped at your MCPJam model limit." plus the backend's sentence) instead of no explanation. It is hidden when the run banner already shows the same message.

Not changed: account-limit denials that arrive as failed (billing codes) still store session_failed. That's a separate path, and the provider banner never reads it.

Tests

  • shared/__tests__/swarm-attempt-error.test.ts: accountLimitCode for the envelope, the (code, HTTP n) format, code preferred over message, and no code for a provider 429 or a cleaned-up sentence. Also a sentence saved under rate_limited is recognized as an account limit.
  • swarm-runner.test.ts: a rate-limited session whose raw message carries user_rate_limit is saved with that code.
  • new-swarm-running-step.rate-limit-card.test.tsx: the exact prod row gets no provider banner, a mixed wave shows the account-limit banner, and an all-limited wave shows only the run banner.

Local: vitest run on those three + client/src/components/swarms (52 files, 674 tests) pass.

🤖 Generated with Claude Code


Note

Medium Risk
Touches swarm terminal error persistence and run UI messaging for rate-limited outcomes; behavior change is scoped to limit classification but affects what users see and what codes are stored on attempts.

Overview
Fixes swarm runs that hit MCPJam’s model/credit limits being shown as provider throttles (e.g. “Anthropic rate-limited this key”) when the stored attempt used generic rate_limited after humanization dropped user_rate_limit.

The runner now persists the account-limit denial code from the raw agent error via new accountLimitCode, falling back to rate_limited only for true provider limits. isAccountLimit also recognizes legacy rows whose message is the “Daily/Monthly MCPJam model limit reached” sentence under a bare rate_limited code.

On the run screen, account-limited sessions get a dedicated amber new-swarm-running-account-limit banner when other sessions succeeded (so amber chips aren’t unexplained); that banner is suppressed when the whole-run failure banner already states the same limit.

Reviewed by Cursor Bugbot for commit 4675449. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Stops MCPJam's own model limit from being reported as a provider rate limit. Swarm attempts now retain the backend account-limit code, so the run screen no longer blames the provider or tells users to switch models; mixed waves get a dedicated explanation while all-limited runs keep the existing run-level message.

  • Existing attempts with only the Daily/Monthly MCPJam model limit reached sentence are recognized without a data migration.
  • Genuine provider throttles and failed billing denials keep their existing behavior.
  • Added runner, shared error-handling, and run-screen coverage for these cases.

Written for commit 4675449. Summary will update on new commits.

Review in cubic

A swarm attempt stopped by MCPJam's daily model limit was stored as
`rate_limited` with the humanized sentence, which had already dropped the
backend's `user_rate_limit` code. The run screen read that as the user's
provider throttling their key and printed "Anthropic rate-limited this
key. Retry again later or switch models." for a Haiku run on MCPJam's
own credits.

- The runner keeps the account-limit code from the raw message as the
  attempt's errorCode.
- isAccountLimit also recognizes the backend's "Daily/Monthly MCPJam
  model limit reached" sentence, so rows already written read correctly.
- The run screen explains account-limited sessions when other sessions
  in the wave succeeded, where the run banner stays silent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cursor

cursor Bot commented Sep 17, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_3faa7e74-9e9c-4db7-8cf6-50bc019cbb7b)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-17T14:04:47.296620Z 4675449 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chelojimenez

Copy link
Copy Markdown
Contributor Author

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@chelojimenez
chelojimenez merged commit 30643c5 into main Sep 17, 2026
26 of 27 checks passed
@chelojimenez
chelojimenez deleted the fix/swarm-account-limit-code branch September 17, 2026 14:02
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 484ac777-2fbe-4b0f-974e-512dca2e199b

📥 Commits

Reviewing files that changed from the base of the PR and between e05db5d and 4675449.

📒 Files selected for processing (6)
  • mcpjam-inspector/client/src/components/swarms/__tests__/new-swarm-running-step.rate-limit-card.test.tsx
  • mcpjam-inspector/client/src/components/swarms/new-swarm-running-step.tsx
  • mcpjam-inspector/server/services/sessionSimulation/__tests__/swarm-runner.test.ts
  • mcpjam-inspector/server/services/sessionSimulation/swarm-runner.ts
  • mcpjam-inspector/shared/__tests__/swarm-attempt-error.test.ts
  • mcpjam-inspector/shared/swarm-attempt-error.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review.


Walkthrough

The shared error module now extracts account-limit codes and detects humanized MCPJam model-limit messages. The session runner preserves these codes for rate-limited outcomes. The running-step UI aggregates account-limit failures and renders a dedicated banner when appropriate. Tests cover legacy messages, code normalization, server propagation, banner selection, and duplicate-card suppression.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 46754

No concrete merge-blocking issue was identified in the account-limit detection or banner behavior.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

chelojimenez pushed a commit that referenced this pull request Sep 17, 2026
One conflict, in `shared/__tests__/swarm-attempt-error.test.ts`. Both sides
ADD a case after the same anchor and neither replaces the other, so both are
kept:

  - main (#5292) covers a legacy attempt row stored under the generic
    `rate_limited` code, where the humanized sentence is all that is left to
    say MCPJam rather than a provider stopped the run;
  - this branch covers the three Ask MCPJam refusals as whole-run stops.

They are about different inputs to the same predicate and are both worth
having. Verified after resolving that main's own edits to
`ACCOUNT_LIMIT_CODE` kept this branch's three codes in the regex — that half
auto-merged, so it needed checking rather than assuming.

356 tests across every suite the merge touched (swarm-attempt-error,
swarm-runner, run-supervisor, session-rate-limit, mcpjam-limit, the agent
routes and the agent thread) pass, client typecheck is clean, and lint has
no errors on the resolved file.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HMbHn25hsRSEbw6oMACxog

This branch was successfully deployed

No deployments
preview-pr-5292 — 4675449d Deployed Sep 17, 2026 by chelojimenez via upsert-preview #21740
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.

1 participant