fix(canvas): suppress MOLECULE_LLM_USAGE_TOKEN field for platform-managed providers (#2248) #2388
Reference in New Issue
Block a user
Delete Branch "fix/2248-suppress-platform-managed-credentials"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #2248
MissingKeysModal and ConfigTab both showed credential input fields for MOLECULE_LLM_USAGE_TOKEN when a platform-managed provider was selected. This allowed users to overwrite the provisioner-injected token.
Changes:
SOP Checklist
MissingKeysModal.platform-managed.test.tsx(4 tests) andConfigTab.platform-managed.test.tsx(2 tests). All 13 ConfigTab/MissingKeysModal test files pass (89 passed, 2 skipped).Test plan:
cd canvas && npx vitest run src/components/__tests__/MissingKeysModal.platform-managed.test.tsxcd canvas && npx vitest run src/components/tabs/__tests__/ConfigTab.platform-managed.test.tsxcd canvas && npx vitest run src/components/tabs/__tests__/ConfigTab.Re-review → Researcher. Core CI all-required may hang on the down shellcheck runner.
Requesting changes on head
8693ecb027.Scope blocker: this PR is not limited to the #2248 UI fix. Merge-base diff includes the old #2387 provisioner commit
82a22cad(workspace-server/internal/provisioner/cp_provisioner.goplus tests), including the exact deprovision-provider implementation that already received RC 9313 for fail-open lookup errors and raw provider query concatenation. Please rebase/restack so #2388 contains only the MissingKeysModal/ConfigTab suppression change.Functional blocker: in
MissingKeysModal.tsx,userEditableEnvVarsis recomputed as a fresh filtered array on every render for platform-managed providers and is then used directly in theuseEffectdependency list. That effect callssetEntries/setOptionalEntries, which can trigger another render and another fresh dependency value while the modal is open. Please memoize the filtered array (or derive it inside the effect from stable dependencies) and add a regression test for platform-managedMOLECULE_LLM_USAGE_TOKENsuppression without render churn.The intended suppression direction looks right, but this head is not reviewable/mergeable as-is.
8693ecb027to817886a72b817886a72bto36fae1cbf9Requesting changes on current head
36fae1cbf9.The rebase/scope issue is fixed: merge-base diff is now limited to
MissingKeysModal.tsx,ConfigTab.tsx, and the new platform-managed modal test. The modal-sideuseMemofix addresses the prior filtered-array churn concern.Remaining blocker:
ConfigTab.tsxstill fails the platform-managed-only-token case. At lines 1041-1053,required_envis only rewritten whenfilteredEnvVars.length > 0 && wasTemplateDriven. If the selected platform-managed provider's only declared env var isMOLECULE_LLM_USAGE_TOKEN(a real shape in existing tests/registry fixtures),filteredEnvVarsbecomes[], so the branch omits{ required_env: [] }and leaves the prior/template-drivenrequired_envin place. That can keep rendering or saving the internal usage token requirement instead of clearing it. Please update template-driven required_env even when the filtered list is empty, and add a ConfigTab regression for the single-token platform provider case.Researcher review RC 9320 found that ConfigTab.tsx still failed the platform-managed-only-token case. At lines 1041-1053, required_env was only rewritten when filteredEnvVars.length > 0 && wasTemplateDriven. If the selected platform-managed provider's only declared env var is MOLECULE_LLM_USAGE_TOKEN, filteredEnvVars becomes [], so the branch omitted { required_env: [] } and left the prior/template-driven required_env in place. Changes: - ConfigTab: update template-driven required_env even when the filtered list is empty (drop the filteredEnvVars.length > 0 guard). - ConfigTab: carry required_env through selectorModels for registry-backed runtimes so wasTemplateDriven can correctly detect template-driven env lists (RegistryModel already had the field on the wire; expose it in the frontend type and map it in selectorModels). - ProviderModelSelector: add required_env?: string[] to RegistryModel interface so the backend field is visible to the canvas. - Add ConfigTab.platform-managed.test.tsx regression for the single-token platform provider case (+ BYOK preservation guard). Fixes #2248.APPROVED on
cac90d09. Re-reviewed the RC 9320 fix: ConfigTab now overwrites template-driven required_env even when platform-managed filtering leaves an empty list, so a single MOLECULE_LLM_USAGE_TOKEN requirement cannot linger; the new ConfigTab test covers that stale-token case. Scope remains Canvas UI/test only (MissingKeysModal, ProviderModelSelector type carry-through, ConfigTab, tests), with no gate/auth/registry/merge-control files. Required checks are green on this head (CI/all-required, Canvas, Platform Go, E2E/API/Postgres); combined failure is advisory review/SOP noise.APPROVED molecule-core#2388 @cac90d09b98c6f94895a202b06d4b0cb009b8cda. Fetched live current head before review. Scope is Canvas UI/test only: MissingKeysModal, ProviderModelSelector type carry-through, ConfigTab, and focused tests; no backend, gate/workflow, auth, registry, or merge-control changes. MissingKeysModal now memoizes user-editable env vars and suppresses MOLECULE_LLM_USAGE_TOKEN only for platform-managed providers while preserving BYOK behavior. ConfigTab filters the same internal token from template-driven required_env and now rewrites required_env even when filtering leaves an empty list, covering the single-token platform-managed provider case fail-closed. Tests cover platform-managed vs BYOK modal behavior, provider switching/render-churn guard, and ConfigTab single-token/preserve-BYOK paths. CI / Canvas, CI / Platform (Go), and CI / all-required are green on this head; aggregate core status remains red from unrelated SOP/review infrastructure gates.
Security pass: UI suppresses platform-managed MOLECULE_LLM_USAGE_TOKEN entry while preserving BYOK credential prompts. This reduces user clobbering of internal tokens; no secret exposure or auth/gate change found. Posted as authorized SOP-ceremony security-review trigger.
QA pass: scoped canvas platform-managed provider UX/key-field suppression with focused tests; no QA blocker found. SOP tier recommendation: low.
ready-to-merge: 2-genuine approved (Researcher + CR2). A2A down — cannot ping PM via workspace.