Repository navigation
refactor(googlechat,zalouser): declare single-account config promotion keys - #112367
wangmiao0668000666 wants to merge 3 commits into
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
dafe405 to
7023181
Compare
|
Codex review: needs real behavior proof before merge. Reviewed September 10, 2026, 12:16 AM ET / 04:16 UTC (Revision 26). ClawSweeper reviewWhat this changesAdds Google Chat and Zalo User plugin declarations that tell Doctor which legacy settings to move into default-account configuration. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 6 items remain This PR remains useful and is not implemented on main. The previous findings and proof-refresh request are addressed, but two Google Chat setup regressions remain outside the packaged Doctor scenario. Priority: P2 Review scores
Verification
How this fits togetherChannel plugins declare migration rules consumed by both Doctor and interactive setup. Those flows write account configuration that subsequently controls webhook authentication and outbound Google Chat credentials. flowchart TD
A[Legacy channel settings] --> C[Promotion rules]
B[Plugin setup declarations] --> C
C --> D[Doctor migration]
C --> E[Interactive setup]
D --> F[Saved account configuration]
E --> F
F --> G[Webhook and API authentication]
Before merge
Findings
Agent review detailsSecurityNeeds attention: Credential promotion can leave a replaced Google Chat identity authoritative for later outbound authentication. PR surfaceSource +33, Tests +81, Config +6. Total +120 across 7 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the plugin declarations while preserving the default identity's audience during setup and retiring promoted credentials atomically when that identity is replaced. Do we have a high-confidence way to reproduce the issue? Yes, from source: configure an existing named Google Chat account beside root credentials and audience settings, or promote a root credential and then rotate the default account. The respective owners deterministically lose the default audience or select the old credential; these paths were not executed in this review. Is this the best way to solve the issue? No, not yet: the declarations fit the existing SDK, but both Doctor and interactive setup consume them, and the latter's destination and credential-write semantics need to preserve existing identities. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 421245a6068d. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (25 earlier review cycles; latest 8 shown)
|
7023181 to
06ccabb
Compare
|
Added real behavior proof: focused test execution showing the config-promotion declarations are accessible to the doctor migration path, plus declaration and manifest verification. Rebased onto latest @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
06ccabb to
03e60d4
Compare
|
@clawsweeper re-review
Head: |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
03e60d4 to
08c3cbe
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The named-account credential P1 is fixed on Root cause confirmed: Fix (reviewer-recommended shape): Coverage:
Packaged Doctor proof rerun on this head (full Persisted after
One boundary note: the doctor promotion path only engages when an |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
9edb78e to
a89a62f
Compare
…n keys Declare singleAccountKeysToMove on both channel setup adapters and add configPromotion setupFeature to their package manifests, completing the per-channel migration started in openclaw#112293. Co-Authored-By: Claude <[email protected]>
a89a62f to
8b621fe
Compare
|
@clawsweeper re-review Rebased onto current The previous review's proof still holds, with one behavioral refinement now documented in the updated PR body: the packaged Focused suites on the new head: googlechat setup 32/32 (LANG=C), zalouser channel.setup 2/2, doctor legacy-config migrations 91/91 (includes the new named-account restriction test). Promotion-seam files are untouched by main movement since the rebase base. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Splitting this PR: the zalouser half landed as #143860 ( The googlechat half is closed here rather than reworked. ClawSweeper's latest review of
Both findings were verified against source ( The zalouser opt-out declaration has no promotion surface for either finding (empty |
What Problem This Solves
Part 2 of #112238 follow-up. The googlechat and zalouser channel plugins were missed in #112293, which moved hardcoded single-account promotion keys into per-channel plugin declarations. Both plugins use
createPatchedAccountSetupAdapter(the same pattern as other channels that were already migrated) but lackedsingleAccountKeysToMovedeclarations andsetupFeatures.configPromotionin their package manifests.Why This Change Was Made
singleAccountKeysToMoveon the googlechat setup adapter (serviceAccount,serviceAccountFile,audienceType,audience,webhookPath,webhookUrl) and the zalouser setup adapter (empty array — opt-out from legacy key promotion).namedAccountPromotionKeyson the googlechat setup adapter (audienceType,audience,webhookPath,webhookUrl,dmPolicy,allowFrom,groupPolicy,groupAllowFrom). Google Chat service-account credentials are per-identity:mergeGoogleChatAccountConfigstripsserviceAccount/serviceAccountFilefrom named accounts, so they must not be flattened intoaccounts.defaultonce named accounts exist.setupFeatures.configPromotion: trueto bothpackage.jsonfiles so doctor can read the declarations from the lightweight bundled setup artifact.User Impact
Single-account migration for googlechat and zalouser channels now moves only the declared account-scoped keys into
accounts.default. Named-account configs no longer risk flattening channel-root policy keys alongside account credentials, and googlechat credentials stay at the channel root where they are consumed. No runtime behavior, config shape, or credential handling changes.Evidence
All proof below was re-run on the rebased head
8b621fed2d0f6f9b344f39d1dfda30c586cd2d26(rebased ontoorigin/main8cc90fe5d7457a, 2026-09-10). The promotion seam (src/channels/plugins/setup-promotion-{helpers,keys,discovery}.ts,src/commands/doctor/shared/legacy-config-core-normalizers.ts,extensions/{googlechat,zalouser}) is untouched by8cc90fe5d74..origin/mainmovement since the rebase.Packaged
openclaw doctor --fixproof (exact head, 2026-09-10)The exact head
8b621fed2d0f6f9b344f39d1dfda30c586cd2d26was built into a packaged dist (build-external-plugin-local-dist.mts+plugins:assets:copy+runtime-postbuild,buildId 2026.9.3-8b621fed2d0f-2026-09-10T03-46-01.296Z); both bundled manifests indist/extensions/{googlechat,zalouser}/package.jsoncarrysetupFeatures.configPromotion: trueandsetupEntry: ./setup-entry.js. The packaged CLI (dist/index.js) then randoctor --fix --yes --no-coloragainst a fully isolated state dir (OPENCLAW_STATE_DIR+OPENCLAW_WORKSPACE_DIRunder/tmp) with a synthetic legacy config: root-level single-account keys plus one namedworkaccount and nodefaultaccount for both channels. All values below are synthetic (fake user IDs,proof.invalid,/tmppaths); nothing operator-real was used.Legacy input config:
{ "channels": { "googlechat": { "enabled": true, "serviceAccount": { "source": "file", "provider": "proof-file", "id": "/channels/googlechat/serviceAccount" }, "serviceAccountFile": "/tmp/oc112367/gsa.json", "audienceType": "project-number", "audience": "123456789012", "webhookPath": "/googlechat-webhook", "webhookUrl": "https://proof.invalid/googlechat", "dmPolicy": "allowlist", "allowFrom": ["users/1234567890"], "accounts": { "work": { "audienceType": "project-number", "audience": "999999999999" } } }, "zalouser": { "enabled": true, "dmPolicy": "allowlist", "allowFrom": ["+84000000000"], "profile": "/tmp/oc112367/zalo-profile", "accounts": { "work": { "profile": "/tmp/oc112367/zalo-profile-work" } } } } }Control — main-line packaged dist (build stamp
dfa8b7df9e6f; for the promotion surface its build sources matchorigin/main: thedfa8b7df9e6googlechat/zalouser setup adapters contain nosingleAccountKeysToMove/namedAccountPromotionKeysand nosetupFeatures.configPromotion, their manifest deltas vsorigin/mainare version/formatting only, and the promotion resolver files are untouched by either range). Same input config, same command:Doctor changescontains no channel promotion lines; instead main-line doctor reports the default-account-routing gap:channels.googlechat: accounts.default is missing and no valid account-scoped binding exists for configured accounts (work).channels.googlechatkeeps all 10 root keys (allowFrom,audience,audienceType,dmPolicy,enabled,serviceAccount,serviceAccountFile,webhookPath,webhookUrl) and noaccounts.default;channels.zalouserkeepsallowFrom,dmPolicy,profileat root with noaccounts.default. Promotion defers because neither plugin advertises a promotion surface.After — PR-head packaged dist. Same input config, same command. Doctor output contains:
Persisted config after the run:
{ "channels": { "googlechat": { "enabled": true, "serviceAccount": { "source": "file", "provider": "proof-file", "id": "/channels/googlechat/serviceAccount" }, "serviceAccountFile": "/tmp/oc112367/gsa.json", "accounts": { "work": { "audienceType": "project-number", "audience": "999999999999", "dmPolicy": "allowlist", "allowFrom": ["users/1234567890"] }, "default": { "audienceType": "project-number", "audience": "123456789012", "webhookPath": "/googlechat-webhook", "webhookUrl": "https://proof.invalid/googlechat", "dmPolicy": "allowlist", "allowFrom": ["users/1234567890"] } } }, "zalouser": { "enabled": true, "profile": "/tmp/oc112367/zalo-profile", "accounts": { "work": { "profile": "/tmp/oc112367/zalo-profile-work", "dmPolicy": "allowlist", "allowFrom": ["+84000000000"] }, "default": { "dmPolicy": "allowlist", "allowFrom": ["+84000000000"] } } } } }This demonstrates both plugin contracts end-to-end through the packaged migration, including the named-account restriction this PR adds:
namedAccountPromotionKeysmembers move.audienceType,audience,webhookPath,webhookUrl(declared) plusdmPolicy,allowFrom(common policy) promoted intoaccounts.default; the pre-existing namedworkaccount kept its own values and only inherited the rootdmPolicy/allowFrompolicy keys.serviceAccountandserviceAccountFilestayed at the channel root because they are not innamedAccountPromotionKeys— Google Chat strips per-account credentials viamergeGoogleChatAccountConfig, so flattening them intoaccounts.defaultwould fabricate a config the plugin then discards.profilekey stays at root (explicit emptysingleAccountKeysToMove= authoritative no-promotion policy for channel-specific keys), while common policy keys (dmPolicy,allowFrom) promoted intoaccounts.defaultinstead of deadlocking the whole channel section behind a defer.Real behavior proof (focused test execution on current head)
Locale note: under this machine's
zh_CN.UTF-8locale, the pre-existing main-lane testgooglechat setup > configures service-account auth and webhook audiencefails because main's wizard i18n translates the prompt toService account JSON 路径while the test matches the exact English string. The same file passes 32/32 underLANG=C. The failure is unrelated to this PR — the PR diff tosetup.test.tsonly adds the config-promotion declaration test.Doctor migration seam semantics
The new migration test
restricts promotion to named-account keys when named accounts exist(insrc/commands/doctor-legacy-config.migrations.test.ts) uses a syntheticnamed-restricted-demoplugin registry whose adapter declaressingleAccountKeysToMove: ["appToken", "streaming"]andnamedAccountPromotionKeys: ["streaming"]. With a named account present,appTokenstays at root and onlystreamingmoves intoaccounts.default; without named accounts, both declared keys move. This pins the resolver contract this PR relies on:resolveSingleAccountPromotionfilterskeysToMovethroughnamedAccountPromotionKeyswhen named accounts exist, andhasPromotionDeclarationskeeps an undeclared custom root key from deferring the whole channel once declarations exist.Declaration verification
The doctor migration resolver reads these declarations from each channel's setup artifact surface during
openclaw doctor --fix. Both manifests enableconfigPromotionso the doctor migration can discover the declarations through the lightweight bundled setup artifact.extensions/googlechat/src/setup.test.ts— the new config-promotion declaration test failed before the production change becausegooglechatSetupAdapter.singleAccountKeysToMovewasundefined.extensions/googlechat/src/setup.test.ts— 32 passed (31 existed before, 1 new) with the fix.extensions/zalouser/src/channel.setup.test.ts— 2/2 passed including the new declaration test.src/commands/doctor-legacy-config.migrations.test.ts— 91/91 passed including the named-account restriction test.oxfmt --checkpassed for all changed source files.Scope