GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(mothership): fix superagent credentials by Sg312 · Pull Request #4185 · simstudioai/sim Conversation
Contributor
SummaryFix credential injection for superagent Type of Change
TestingManual Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Greptile SummaryThis PR fixes credential injection for Copilot/Superagent tool execution via two changes: (1) Confidence Score: 5/5Safe to merge — both findings are P2 style/consistency issues that do not affect runtime correctness. The core credential-injection fix is logically sound: the schema correctly marks apps/sim/lib/copilot/vfs/serializers.ts (credentialId still says required: false) and apps/sim/tools/index.ts (normalizeCopilotCredentialParams lacks scope guard). Important Files Changed
Sequence DiagramsequenceDiagram
participant LLM as Copilot / Superagent LLM
participant Schema as createUserToolSchema surface=copilot
participant Exec as executeTool
participant Norm as normalizeCopilotCredentialParams
participant Enforce as enforceCopilotCredentialSelection
participant Token as OAuth Token API
LLM->>Schema: request tool definitions
Schema-->>LLM: schema with credentialId required
LLM->>Exec: tool call with credentialId and params
Exec->>Norm: normalize params unconditional
Norm-->>Exec: params.credential set from credentialId
Exec->>Enforce: check copilotToolExecution and oauth.required
alt no credential selector found
Enforce-->>Exec: throw Error must pass credentialId
Exec-->>LLM: success false with error message
else credential found
Enforce-->>Exec: ok
Exec->>Token: fetch access token for credential
Token-->>Exec: accessToken
Exec-->>LLM: success true with output
end
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| function normalizeCopilotCredentialParams(params: Record<string, unknown>): void { | ||
| const credentialId = typeof params.credentialId === 'string' ? params.credentialId.trim() : '' | ||
| if (credentialId && !params.credential && !params.oauthCredential) { | ||
| params.credential = credentialId | ||
| } | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Missing scope guard, inconsistent with sibling function
normalizeCopilotFileParams guards with if (!scope.copilotToolExecution) return before doing anything. normalizeCopilotCredentialParams has no such guard and runs unconditionally for every tool execution. In practice this is a no-op for non-copilot paths (since credentialId won't be in contextParams), but the inconsistency is a readability and maintenance hazard.
| function normalizeCopilotCredentialParams(params: Record<string, unknown>): void { | |
| const credentialId = typeof params.credentialId === 'string' ? params.credentialId.trim() : '' | |
| if (credentialId && !params.credential && !params.oauthCredential) { | |
| params.credential = credentialId | |
| } | |
| } | |
| function normalizeCopilotCredentialParams(params: Record<string, unknown>, scope: ToolExecutionScope): void { | |
| if (!scope.copilotToolExecution) { | |
| return | |
| } | |
| const credentialId = typeof params.credentialId === 'string' ? params.credentialId.trim() : '' | |
| if (credentialId && !params.credential && !params.oauthCredential) { | |
| params.credential = credentialId | |
| } | |
| } |
And update the call site to pass scope as a second argument.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…mat, logs performance improvements fix(csp): add missing analytics domains, remove unsafe-eval, fix workspace CSP gap (#4179) fix(landing): return 404 for invalid dynamic route slugs (#4182) improvement(seo): optimize sitemaps, robots.txt, and core web vitals across sim and docs (#4170) fix(gemini): support structured output with tools on Gemini 3 models (#4184) feat(brightdata): add Bright Data integration with 8 tools (#4183) fix(mothership): fix superagent credentials (#4185) fix(logs): close sidebar when selected log disappears from filtered list; cleanup (#4186)
a88c7268
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.