Repository navigation
Use the chat organization for Claude Web - #1126
sebastianelsner wants to merge 3 commits into
Conversation
Accounts linked to the Anthropic Console list an API-only organization first. claude.ai answers chat_conversations for it with a permission_error object, which crashed init() with "s.map is not a function". Prefer the organization with the chat capability and turn a non-array conversations response into a readable error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Organization selection src/services/clients/claude/index.mjs, tests/unit/services/clients/claude.test.mjs |
The client selects the first organization with chat capability, or the first organization when none match. The fetch-sse.mjs import now includes its file extension. Tests cover both selection cases. |
Conversation response errors src/services/clients/claude/index.mjs, tests/unit/services/clients/claude.test.mjs |
getConversations() throws the API-provided error message when the response is not an array, or the serialized response otherwise. Tests cover a permission error and a non-list response. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: josstorer
Merge Risk: 
Minimal · up to 462a0
-
No actionable merge-blocking risk is established for this change.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
PR Summary by QodoSelect the chat-capable organization for Claude Web
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryClaude Web now prefers an organization with chat access and keeps the first organization as a fallback.
Reviews (3) · Last reviewed commit: "Report the raw conversations response in..." · Reviewed by Greptile |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Prefer a chat-capable organization in
Claude.init()—organizations[0].uuidbecomesorganizations.find((org) => org.capabilities?.includes('chat')) || organizations[0], so accounts whose first organization is the API-only one no longer target an org that claude.ai denies chat access to. The|| organizations[0]fallback preserves prior behavior whencapabilitiesis absent. - Fail readably when conversations are denied —
getConversations()now throwsnew Error(json?.error?.message || 'failed to load conversations')for non-array bodies instead of lettingjson.mapraise aTypeError. This also makesstartConversation'sthis.recent_conversations.map(...)safe, sincerecent_conversationscan no longer be set to a non-array. - Test-runner resolution — the
fetch-sseimport gains its.mjsextension so the client loads undernode:test. Webpack resolves both forms, so no bundle change. - New unit tests —
tests/unit/services/clients/claude.test.mjscovers chat-org preference, fallback withoutchat, and the denied-conversations error message via afetchmock that rejects unexpected routes.
I verified the new tests pass (3/3) with the browser shim, and eslint/prettier are clean on both files. The change is well-scoped to Claude Web and does not alter behavior for single-organization accounts or those whose first organization already reports chat.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix preserves fallback behavior, includes targeted regression coverage, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes Claude Web initialization for accounts linked to Anthropic Console by selecting an organization with chat access rather than an API-only organization.
Changes:
- Prefer an organization with
chatcapability, retaining the first-organization fallback. - Report service errors when conversation responses are not arrays.
- Add regression tests and an explicit
.mjsimport for Node test compatibility.
| File | Description |
|---|---|
tests/unit/services/clients/claude.test.mjs |
Tests chat organization selection, fallback behavior, and error propagation. |
src/services/clients/claude/index.mjs |
Updates organization selection, validates conversation responses, and fixes the import extension. |
Review effort: Balanced
With a single organization the fallback test could not tell whether init() picks the first entry. Add a second organization without chat capability so the assertion proves the first one is used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The delta since the prior pullfrog review (a031c94) is confined to the Claude client's unit tests; the source files are unchanged.
- Strengthened the no-chat fallback test — the test is renamed to "falls back to the first organization when none has chat capability" and now supplies two non-chat organizations (
first-orgwith nocapabilities,second-orgwith['api']), so it proves the|| organizations[0]fallback selects the first organization rather than merely the only one. This also addresses cubic's P2 ordering finding.
Verified the suite still passes (node --import ./tests/setup/browser-shim.mjs --test tests/unit/services/clients/claude.test.mjs → 3/3).
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 23dd3f8 |
When claude.ai returns a non-list without an error message, show the response itself instead of a new hard-coded English message, so no untranslated user-facing string is added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The delta since the prior pullfrog review (23dd3f8) is small and well-covered.
- Raw response in the non-array error —
getConversations()now falls back toJSON.stringify(json)instead of the hardcoded'failed to load conversations', so arbitrary non-array bodies surface their actual content rather than a fixed label.JSON.stringifyis safe in this path:response.json()cannot returnundefined, and a parsed body cannot be circular. - New test for the raw-response path — a fourth test feeds
{ data: [] }and asserts the thrown message is'{"data":[]}', exercising the branch the commit added.
Verified the suite passes (node --import ./tests/setup/browser-shim.mjs --test tests/unit/services/clients/claude.test.mjs → 4/4). The commit_id below reflects 462a0e8.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Summary
Claude.ai (Web) fails with
s.map is not a functionfor accounts linked to the Anthropic Console./api/organizationslists the API-only organization first (capabilities["api", "customer_terms:standard"]), andClaude.init()always tookorganizations[0]. claude.ai answerschat_conversationsfor that organization with apermission_errorobject instead of a list:The client's
fetch-sseimport also gets its.mjsextension so the module loads under the Node test runner. Webpack resolves both forms the same way.Evidence
Before: the new tests run against the old
init():In the extension, every Claude.ai (Web) question ends with the error
s.map is not a function.After:
Claude.ai (Web) answers normally again in Firefox for the affected account.
Validation:
npm test(1110 pass),npm run lint,npm run pretty:checkandnpm run buildare clean. Manually tested in Firefox with an affected account, using a build that also carried #996; the Claude client code is identical to this PR. Not manually tested in Chromium.Merge Danger
Door: two-way
Blast Radius: Claude Web only
Accounts with a single organization, or whose first organization already has
chat, keep the organization they used before. If claude.ai stops reportingchatincapabilities, the client falls back to the oldorganizations[0]behavior.🤖 Generated with Claude Code
Summary by CodeRabbit