Skip to content

Env-plant: recognize a Settings-connected credential's provider - #436

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-7128-env-key-auto-plant-cannot-see-a-settings-connected
Aug 29, 2026
Merged

TheGreatAxios merged 3 commits into
mainfrom
cl-7128-env-key-auto-plant-cannot-see-a-settings-connected

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Fixes CL-7128 — https://linear.app/abklabs/issue/CL-7128

Problem

persistConnectorCredential (packages/connections/src/persist-credential.ts:117-138) names a Settings-connected credential after the connector's displayName ("Anthropic"). plantEnvProviderCredentials (packages/onboarding/src/plant-env-credentials.ts, findActiveCredential) checked for an existing plant only by matching inferenceCredentialName(provider) ("anthropic-default", packages/hub-client/src/seed.ts:998). A tenant that connected Anthropic in Settings, on a hub booted with ANTHROPIC_API_KEY, never matched that name — so every boot ran a live probe call to Anthropic and planted a second, redundant credential row.

Change

  • Added findProviderId: a read-only lookup of the provider row a curated provider's connections (env-plant and a Settings connect alike) both key their credential to (ensureProvider's own { name: provider } pair). It never creates the row, so a provider nobody has connected yet still reads back as "no active credential."
  • findActiveCredential now matches on providerId instead of the credential's own name, so it recognizes either naming convention.
  • The "skipped" log line now names the actual matched credential instead of assuming the env-plant's own naming.
  • Neither write path's naming changed — persistConnectorCredential and plantEnvProviderCredentials still name their rows exactly as before.
  • CL-6687's rule stays intact: the plant never overwrites an existing active credential.

Tests

Extended packages/onboarding/test/plant-env-credentials.test.ts: a new red/green case plants an active credential named "Anthropic" under the same provider and asserts booting with the env key makes no probe call and creates no second row. All 23 tests in the file pass, and bunx tsc --noEmit -p packages/onboarding is clean.

Note: the machine was under heavy load while this PR was prepared, so the full local bun run check gate was skipped (it was OOM-killed) — CI is the gate for this PR.

A tenant that connects a provider in Settings names the credential
after the connector's displayName ("Anthropic"), not this module's
own "anthropic-default" convention, so the existing name-only match
misses it. Covers the case: an active credential named "Anthropic"
under the same provider must stop the env-plant from probing or
creating a second row.
plantEnvProviderCredentials matched an existing plant only by the
literal name inferenceCredentialName(provider) ("anthropic-default"),
but a Settings-connected credential is named after the connector's
displayName ("Anthropic") instead. A tenant that connected Anthropic
in Settings, on a hub booted with ANTHROPIC_API_KEY, never matched -
a live probe call and a second credential row got planted on every
boot. Match on the provider row (providerId) both paths key their
credential to, resolved read-only so a provider nobody has connected
yet isn't planted just to check.

Fixes CL-7128.
…entials

findProviderId read only page one of the providers list, unlike its
sibling findActiveCredential, so a match on a later page was missed.
The active-credential match also ignored credential type, so a
non-inference row on the same provider could be mistaken for the
plant. Paginate findProviderId the same way, and restrict the match
to the types seedCatalog itself ever writes for an inference source
(api_key, oauth_token).
@TheGreatAxios
TheGreatAxios force-pushed the cl-7128-env-key-auto-plant-cannot-see-a-settings-connected branch from c42a534 to 2573f16 Compare August 29, 2026 04:46
@TheGreatAxios
TheGreatAxios merged commit e7646df into main Aug 29, 2026
5 checks passed
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