provider-settings may store the boot-derived ARCHIE_PROVIDER_<hash> env name instead of the operator's secret reference #1325

Closed
opened 2026-10-27 13:39:56 +00:00 by sam · 1 comment
Owner

internal/app/archied/provider_secrets.go resolves each provider's api_key_ref at boot, exports the key under a process-local env var named by providerSecretEnvName (ARCHIE_PROVIDER__API_KEY), then clears provider.APIKey and sets provider.APIKeyEnv to that name. The stored provider-settings resource on a dev host reads exactly that shape: api_key_env = ARCHIE_PROVIDER_6986D5A05E1DF674_API_KEY, api_key_ref empty, for every provider. That suggests seedProviders (internal/app/controlplane/model_settings.go) ran over the already-resolved config, so the operator's source reference was never stored. Once the resource outranks the file, a later boot would have no reference to resolve and the derived env var would not exist in a fresh process, silently disabling every provider. Verify the ordering of the resolve step against the control-plane import, confirm with a boot test that drives the real import, and fix at the producer: seed from the unresolved config.

Acceptance criteria

A test boots with a provider whose key is a secret reference and asserts the stored provider-settings keeps that reference and no ARCHIE_PROVIDER_ name; existing stored documents with a derived name are handled (re-seeded or flagged).

Close reason

Fixed in 2485e671 (2026-09-25): provider resolution runs only in the daemon/gateway boot, so ImportConfig seeds the operator's secret reference, not the ARCHIE_PROVIDER_ name; regression test in provider_secrets_test.go.


Imported from beads archie-core-fxb6 · GitHub #1000 · type bug · priority P1 · created 2026-09-25 · closed 2026-09-26

internal/app/archied/provider_secrets.go resolves each provider's api_key_ref at boot, exports the key under a process-local env var named by providerSecretEnvName (ARCHIE_PROVIDER_<sha256 prefix>_API_KEY), then clears provider.APIKey and sets provider.APIKeyEnv to that name. The stored provider-settings resource on a dev host reads exactly that shape: api_key_env = ARCHIE_PROVIDER_6986D5A05E1DF674_API_KEY, api_key_ref empty, for every provider. That suggests seedProviders (internal/app/controlplane/model_settings.go) ran over the already-resolved config, so the operator's source reference was never stored. Once the resource outranks the file, a later boot would have no reference to resolve and the derived env var would not exist in a fresh process, silently disabling every provider. Verify the ordering of the resolve step against the control-plane import, confirm with a boot test that drives the real import, and fix at the producer: seed from the unresolved config. ### Acceptance criteria A test boots with a provider whose key is a secret reference and asserts the stored provider-settings keeps that reference and no ARCHIE_PROVIDER_ name; existing stored documents with a derived name are handled (re-seeded or flagged). ### Close reason Fixed in 2485e671 (2026-09-25): provider resolution runs only in the daemon/gateway boot, so ImportConfig seeds the operator's secret reference, not the ARCHIE_PROVIDER_<hash> name; regression test in provider_secrets_test.go. --- _Imported from beads `archie-core-fxb6` · GitHub #1000 · type bug · priority P1 · created 2026-09-25 · closed 2026-09-26_
sam added the highbug labels 2026-10-27 13:39:56 +00:00
sam self-assigned this 2026-10-27 13:39:56 +00:00
sam closed this issue 2026-10-27 13:39:56 +00:00
Author
Owner

sam wrote (originally 2026-09-25):

Producer fixed in 2485e671: the State Store no longer resolves provider keys, so ImportConfig seeds the operator's reference. Still open: stored provider-settings documents that already hold a derived ARCHIE_PROVIDER_ name (re-seed or flag), and a boot test that drives the real import.

_sam wrote (originally 2026-09-25):_ Producer fixed in 2485e671: the State Store no longer resolves provider keys, so ImportConfig seeds the operator's reference. Still open: stored provider-settings documents that already hold a derived ARCHIE_PROVIDER_ name (re-seed or flag), and a boot test that drives the real import.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1325