Repository navigation
fix(channels): scope wizard credentials to the selected account - #110969
Conversation
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(channels): scope wizard credentials to the selected account This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27f4c13617
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| return { cfg: next, accountId }; | ||
| return { cfg: accountScope.restore(next), accountId }; |
There was a problem hiding this comment.
Preserve defaults written by top-level setup wizards
When a declarative wizard intentionally writes defaultAccount during setup, this unconditional restore deletes it if the field was absent before setup. Nostr provides a concrete regression: extensions/nostr/src/setup-adapter.ts:10-14 writes the selected non-default account, and extensions/nostr/src/channel.test.ts:335-347 expects an override of work to persist as defaultAccount; the new scope snapshots undefined, then restore removes the value written by the callback. As a result, Nostr setup with a named account loses its routing identity after returning, so restoration must distinguish its temporary assignment from a callback's intentional update or be limited to account-map plugins.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 5:44 PM ET / 21:44 UTC. Summary PR surface: Source +71, Tests +365. Total +436 across 3 files. Reproducibility: yes. from source: configure Nostr with a named account such as Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep temporary callback scoping for legacy account-map plugins, but restore only the temporary default-account override without overwriting a callback’s explicit final Do we have a high-confidence way to reproduce the issue? Yes, from source: configure Nostr with a named account such as Is this the best way to solve the issue? No. Temporary selected-account scoping is a reasonable boundary for the reported overwrite, but unconditional restoration is not the narrowest safe solution because it overwrites intentional callback output. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fa9ae68c3423. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +71, Tests +365. Total +436 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Merged via squash.
|
…claw#110969) * fix(channels): scope wizard credentials to selected account * fix(channels): migrate empty accounts map in wizard scope guard * test(channels): guard resolved account id in empty-map regression
…claw#110969) * fix(channels): scope wizard credentials to selected account * fix(channels): migrate empty accounts map in wizard scope guard * test(channels): guard resolved account id in empty-map regression
What Problem This Solves
Fixes #79553. When an operator with an existing channel account selected "Add a new account" in the channel setup wizard, plugins using the accounts schema (observed with the WeCom plugin; the same class applies to any legacy accounts-schema plugin) pre-filled credentials from the existing account and — after answering "No" to "already configured. Keep it?" — overwrote the existing
accounts.maincredentials instead of writing the new account. That is silent configuration corruption of a working account.Why This Change Was Made
Root cause:
buildChannelSetupWizardAdapterFromSetupWizardselected anaccountIdbut passed unscoped config to the plugin setup callbacks. Legacy accounts-schema callbacks that ignoreaccountIdresolve credentials throughdefaultAccount, which still pointed at the existing account — so both the "already configured" inspection and the credential writes hit the wrong account.The fix scopes the wizard run at the owning boundary (
src/channels/plugins/setup-wizard.ts): before invoking plugin callbacks it promotes any legacy root-level credentials into the accounts map, pointsdefaultAccountat the selected account for the duration of the callbacks (immutably — no shared-state mutation), and restores the operator's originaldefaultAccounton the returned config. An existing-but-emptyaccounts: {}map is treated as account-scoped too, so lingering root credentials are migrated rather than left stale.botId/secretwere added to the generic single-account promotion keys. Telegram's adapter already patches account-aware and is unchanged.User Impact
Evidence
src/channels/plugins/setup-wizard.test.ts(new, 6 tests): no-prefill/no-overwrite on add-new, mixed-root promotion, selected-account-only replacement, nameddefaultaccount, first named account, empty-accounts-map migration. All pass.setup-helpers.test.ts+helpers.test.ts: 12 tests pass.gpt-5.6-sol, xhigh): clean, "patch is correct (0.87)". An earlier autoreview pass surfaced the empty-accounts-map edge; it is fixed and covered by the regression suite.git diff --checkclean; branch rebased onto currentorigin/main.