fix(sibling of core#3162): fail-CLOSED on readStoredModelSecret decrypt/read error #3166
Reference in New Issue
Block a user
Delete Branch "fix/read-stored-model-secret-fail-closed"
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?
What
Sister fix to core#3162 (PR#3165).
readStoredModelSecrethad the same fail-open shape asreadStoredProviderSecret: a transient decrypt/read error on an existing MODEL row collapsed into""and was treated as "unset". The cost is different but equally silent — if the secret store later recovered and returned a clean("", nil)on the NEXT provision,ensureConciergeModelwould re-seed the platform default and silently overwrite the customer's model pick without any error surfaced.The fix
readStoredModelSecretnow returns(string, error)and distinguishes the three observed states (identical contract toreadStoredProviderSecretafter core#3162):(value, nil)("", nil)sql.ErrNoRows(genuine unset)("", err)DecryptVersionederrorensureConciergeModelwas updated to handle the new signature: onreadErr != nilit logs and returns without seeding the platform default, so the next provision re-tries rather than losing the customer's pick.Why this scope (one sibling, no further batching)
readStored*Secrethelpers inplatform_agent.gowere the only places on this file path with the fail-open shape (verified by grep oninternal/handlers/).readStoredProviderSecret(PR#3165, core#3162) +readStoredModelSecret(this PR) — fully closes the fail-open family on workspace-server. No further helpers on this path have the bug.Tests (4 new)
TestEnsureConciergeModel_FailsClosedOnReadError/decrypt_error_on_existing_MODEL_row_fails_closed_(does_NOT_seed_default)— the primary regression: an unreadable existing MODEL row now fails closed (no default seed, noMOLECULE_MODELenv write).…/db_scan_error_(non-ErrNoRows)_on_MODEL_fails_closed— connection-level errors also fail closed.…/sql.ErrNoRows_(genuine_unset_MODEL)_proceeds_to_seed_(no_regression)— the fresh-boot seed path still fires.…/existing_stored_MODEL_is_respected_on_successful_read_(no_regression)— customer-pick path still wins.Full handler test suite passes (
go test ./internal/handlers/→ ok 39.230s).go build ./...andgo vet ./...clean.Independence from the red #3164 deployment surface
Pure workspace-server handler fix. No concierge / MCP / heartbeat / identity-gate / platform-side touched. Safe to merge on the core-lane (will stage behind the CTO qa/security gate per PM's standing rule).
Pair
This PR + PR#3165 close the
readStored*Secretfail-open family on workspace-server. After both merge, no other helper on this path has the bug (verified by grep oninternal/handlers/).Gate (per PM)
unit-tests+e2efor workspace-serverAPPROVE on
ca5f543d26(target=main).Security review:
CI: required own-head gate CI/all-required is green; E2E API Smoke, Platform Go, Handlers/Harness observed green where reported. Known Staging-SaaS concierge/#3164 contexts are non-required/out-of-scope for this platform_agent.go fail-closed fix.
APPROVE @ca5f543d265c5ad64a9743ffdea5e4adf308ef81
5-axis review:
readStoredModelSecretnow distinguishes unset (sql.ErrNoRows) from scan/decrypt failures, andensureConciergeModelfails closed on read errors instead of seeding/overwriting a customer model pick. Existing stored model and genuine empty-state seeding remain intact.readStored*Secretfamily no longer intentionally treats decrypt/scan errors as unset.CI/context read: target is
main; own-headCI / all-required,E2E API Smoke Test,Handlers Postgres Integration, qa/security/reserved-path review contexts are green onca5f543. Concierge/Staging-SaaS E2E noise is the known #3164 main-red/out-of-scope lane, not a blocker for this fail-closed fix. Local Go tests were not run here because this container has nogobinary.merge-queue: could not update this branch with
main— the update returned a merge conflict (HTTP 409) that the queue cannot auto-resolve (POST /repos/molecule-ai/molecule-core/pulls/3166/update -> HTTP 409: {"message":"merge failed because of conflict","url":"https://git.moleculesai.app/api/swagger"}). Appliedmerge-queue-holdto unblock the queue (HOL guard). Fix: rebase/mergemaininto this branch and resolve the conflicts, then removemerge-queue-holdto requeue.ca5f543d26to1f2b977b17New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
APPROVE on
1f2b977b17(target=main, molecule-core#3166).Re-confirmed on the rebased head: this is the same readStoredModelSecret fail-closed change previously reviewed, now mergeable on current main. The caller distinguishes genuine ErrNoRows from scan/decrypt errors; scan/decrypt errors fail closed without seeding the platform default model, while ErrNoRows still preserves the intended seed path. Tests cover decrypt-error fail-closed, scan-error fail-closed, ErrNoRows seeding, and existing-model preservation.
CI note at review time: current-head functional checks already green include handlers postgres, harness replays, E2E chat/canvas, secret scan, migration/diff/lint related checks; CI / Platform (Go) and template-delivery advisory were still pending when posted, and qa/security review gates were expectedly waiting on current-head approvals.
APPROVE @1f2b977b17d52e6a3777d615adc939e19d5fcd2b
Current-head re-review after rebase: diff matches the previously approved fail-closed
readStoredModelSecretchange.ensureConciergeModelnow distinguishes true unset (sql.ErrNoRows, seed preserved) from scan/decrypt errors (fail closed, no default overwrite), with regression coverage for corrupt ciphertext, scan error, genuine unset, and existing stored model.5-axis: correctness/security remain sound for the model-secret fail-open fix; availability tradeoff is acceptable because transient read/decrypt errors defer seeding rather than overwriting a customer model pick; performance/readability impact is minimal and consistent with the #3165 provider-secret sibling. Target is
main, PR is mergeable. Note: qa/security bot-gate contexts are being refired separately; this is the code-level approval for the current head, with merge still gated by the peer on required contexts going green.APPROVED on
1e4a21b39a.Per-head reconfirmation: current head targets main and is mergeable; local comparison against my previously approved
1f2b977bproduced no file diff. This is the same readStoredModelSecret fail-closed change I already reviewed: scan/decrypt errors now fail closed in ensureConciergeModel, ErrNoRows seeding semantics are preserved, and the availability tradeoff matches the approved #3165 provider-secret sibling. No new code issue found.APPROVE on
1e4a21b39a(target=main).Current-head re-confirmation for molecule-core#3166. Compared against previously approved head
1f2b977b17: this head is a single empty CI re-trigger commit with zero files changed, so the reviewed readStoredModelSecret fail-closed diff is byte-identical to the prior approved patch.Prior review still applies: scan/decrypt errors fail closed without seeding the platform default model; genuine ErrNoRows still allows the intended seed path; existing model selections remain respected.
1e4a21b39atoefaf2a5ed1APPROVE @efaf2a5ed159640b47616ebb05d74b9018aeaf70
Re-reviewed current head after rebase. Target is main; diff is the same readStoredModelSecret fail-closed change previously approved: platform_agent.go changes readStoredModelSecret to return (string, error), ensureConciergeModel fails closed on scan/decrypt errors, and ErrNoRows still seeds. platform_agent_test.go carries the decrypt-error, scan-error, ErrNoRows seed, and existing-model-respected coverage.
No new correctness/security/robustness/performance/readability blockers found on this head. Required contexts may still be re-running after synchronize; this is the code-level 2nd-genuine approval for the live SHA.
APPROVE on
efaf2a5ed1(target=main).Fresh re-stamp after rebase. The current diff is the same readStoredModelSecret fail-closed fix previously approved: platform_agent.go changes readStoredModelSecret to return (string, error), ensureConciergeModel fails closed on scan/decrypt error without seeding MODEL/MOLECULE_MODEL, and sql.ErrNoRows still follows the seed path. platform_agent_test.go keeps the four regression cases: decrypt error fails closed, scan error fails closed, ErrNoRows seeds, existing model is respected.
No new code concerns found on this head. Current required contexts are re-running; this is the code-review verdict for the live SHA.
efaf2a5ed1tofa39418da3APPROVE on
fa39418da3(target=main).Fresh re-stamp after rebase onto post-#3170 main. Diff is unchanged from the previously approved readStoredModelSecret fail-closed fix: ensureConciergeModel now fails closed on MODEL scan/decrypt errors without seeding MODEL/MOLECULE_MODEL, sql.ErrNoRows still seeds the default, and existing stored MODEL is respected. Tests cover decrypt error, scan error, ErrNoRows seed path, and existing-model no-regression.
No new code concerns found on this live SHA.
APPROVE @fa39418da33b47c540b5e0e440bb82bc76ce363b
Quick current-head re-stamp after rebase onto post-#3170 main. Verified target is main, mergeable=true, and the diff is unchanged in substance from the previously approved readStoredModelSecret fail-closed fix: only
workspace-server/internal/handlers/platform_agent.goandplatform_agent_test.gochange, with readStoredModelSecret returning(string, error), ensureConciergeModel failing closed on scan/decrypt errors, ErrNoRows preserving the seed path, and tests covering decrypt error, scan error, genuine unset seed, and existing model respected.No new correctness/security/robustness/performance/readability blocker found on this live SHA.
APPROVE @830934233dc6f1e6779481164f3c79d05b46a610
Final current-head re-stamp. Verified target main, mergeable=true, and the file diff is unchanged in substance from the prior approvals: only
workspace-server/internal/handlers/platform_agent.goandplatform_agent_test.gochange, withreadStoredModelSecretreturning(string, error),ensureConciergeModelfailing closed on scan/decrypt errors, ErrNoRows preserving the seed path, and tests covering decrypt error, scan error, genuine unset seed, and existing model respected.No new correctness/security/robustness/performance/readability blocker found on this frozen live SHA. CI/all-required and reserved-path are visible green; qa/security bot contexts are separate label-toggle gates.
APPROVE on
830934233d(target=main).Final re-stamp on frozen head after empty-commit/status re-fire. Diff is unchanged from prior approvals: readStoredModelSecret now returns (string, error), ensureConciergeModel fails closed on MODEL scan/decrypt errors without seeding MODEL/MOLECULE_MODEL, sql.ErrNoRows still seeds the default, and existing stored MODEL is respected. platform_agent_test.go still covers decrypt error, scan error, ErrNoRows seed path, and existing-model no-regression.
Verified mergeable=true and required code/status contexts green on this SHA: Platform (Go), ci/all-required, Secret scan, reserved-path-review. qa/security re-fire is separate and pending per coordination.