Repository navigation
fix(ai): strip the provider key from ai.getDefaultModel for user sessions (review fixes for #1167) - #1172
Merged
HexaField merged 1 commit intoSep 26, 2026
Conversation
…ions ai.getDefaultModel returned db.get_model(id) as stored, and users hold AI_READ, so a user session still got the default model's provider key. It now goes through models_for_session, like ai.models. Also: - agent.updateProfile returns the error when the user's profile cannot be read, instead of treating it as "no DM language" and dropping it. - The MCP profile perspective update keeps the user's DM language instead of writing None. Implements review 5327106839 on #1167. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1167. Implements my review 5327106839 on it.
Changes:
ai.getDefaultModelreturns the provider key to users (blocking,ai_ws.rs:54). The result now goes throughmodels_for_session, likeai.models. Test:user_sessions_get_the_default_model_without_its_provider_keyinmodel_key_testscalls the handler and checks that a user session gets an emptyapiKeyand an operator session gets the key. It fails on fix(api): keep user sessions off node operations; sign as the user #1167's head (the user gotsk-provider-secret) and passes here.agent_ws.rs:254). It now returns the error, as the DM branch does.direct_message_language: None(same comment).update_agent_perspective(mcp/tools/profiles.rs:104) now keeps the stored DM language. I left:82as it is: that is the fallback for a user with no stored profile, so there is no DM language to keep. No new test for these two.Not done:
guards.rs:15, a user token passing the guard when multi-user mode reads as off. The choice is between merging fix(auth): fail closed when a token stops working #1168 first and readingsubin the guard, so it's your call.guards.rs:14, one helper shared with fix(events): keep app tokens, webhook secrets and other users' perspectives out of broadcasts #1164'srefuse_app_management_by_users. That's a cross-PR change for whichever PR merges second.guards.rs:14, guardinglanguage.remove,language.writeSettings,runtime.addTrustedAgents/deleteTrustedAgents,runtime.addFriends/removeFriends,runtime.add/removeLinkLanguageTemplatesandruntime.addHcAgentInfos. Which calls users may make is a product decision.agent_ws.rs:522,language.publish/applyTemplatesigning as the node for user sessions. The review marked it as a follow-up.Tests:
cargo test --release -p ad4m-executor --lib api::(326 passed), plusai_ws::(3),node_operation_tests(4) andprofile(1).🤖 Generated with Claude Code