Repository navigation
fix(adapters): store omitted optional env vars on import (#1774) - #1804
Merged
helpcodeai merged 2 commits intoNov 20, 2026
Merged
Conversation
helpcodeai
approved these changes
Nov 20, 2026
helpcodeai
left a comment
Contributor
There was a problem hiding this comment.
Thank you, this looks good. Keep it for all optional variables, as you did: it is what the setup form stores, so an import by API and a form install now end up the same. I checked the change for auth, workspace scoping and outbound URLs and found nothing to change. I'll update the branch and merge it.
Contributor
|
Merged, thank you @GallaGit. It ships with v0.55.7 today. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #1774
What was wrong
When an adapter is imported through the API (or from a chat) with credentials but without one of its optional variables, the import only stored the variables that were sent. The setup form stores an optional field left blank as
'', andresolvableEnvVarsonly treats an optional variable as resolved when it is stored like that. So, for example, an MSSQL import withoutMSSQL_DOMAINkept{{MSSQL_DOMAIN}}in its auth config, the connector stayed atneeds_input("Still empty: MSSQL_DOMAIN") and its tools did not show up intools/list.What this changes
In
prepareConnector(packages/backend/src/adapters/adapters.service.ts), when the caller sends at least one credential, every optional variable of the adapter (and of its catalog entry) that was not sent is added as'', the same as the form does.withOperatorProvided) is applied before this step, so it is not replaced with''.undefinedor{}) stores nothing new, like before.Because
prepareConnectoris shared, the pre-save check andexerciseReadToolsnow see the same values as the import.Tests
adapters.service.spec.ts:MSSQL_DOMAINstores it as'', and the realcomputeSetupStatereportsready;MSSQL_DOMAINthat is sent is kept;envVars: null.secret-guard.flows.spec.ts: a Telegram import without the optionalTELEGRAM_DEFAULT_CHAT_IDnow stores it as''. That is what the form already stored, andapplyEnvDefaultsand the managed-bot code treat''as "not set".npx tsc --noEmit -p tsconfig.jsonpasses, andeslintreports nothing on the changed files.mainwithout this change (cloudflare.live,jwt-or-management-key.guard,ssrf.util,ee/learning/learning.database). They look environment-related to me (live API token, DNS, real database), but I have not looked into them further.Open question
About 170 catalog adapters declare
optionalEnvVars, and 36 of them use one inauthConfig(mostly OAuth refresh tokens). After this change they get''on an API import, which is what the dashboard form already sends. If you would rather limit this to variables that appear in a placeholder, I'm happy to change it.