Repository navigation
refactor(line,mattermost): declare single-account config promotion keys - #112474
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 |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 2:19 PM ET / 18:19 UTC. ClawSweeper reviewWhat this changesThis PR declares Line and Mattermost account-scoped legacy settings and makes Doctor discover that metadata from installed channel plugins during config migration. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep open: the central Doctor migration gap remains on current main, but this branch now conflicts with a newer promotion-policy design and needs reconciliation before merge. Priority: P1 Review scores
Verification
How this fits togetherDoctor converts legacy channel-root settings into per-account configuration when named accounts already exist. It consumes lightweight plugin setup metadata to decide which settings move and which remain channel-wide. flowchart LR
A[Legacy channel settings] --> B[Doctor migration]
B --> C[Plugin setup metadata]
C --> D[Promotion policy]
D --> E[Default account settings]
D --> F[Channel-root settings]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +70, Tests +246, Config +6. Total +322 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase onto current main, retain its preserve-root policy while adding the missing Line/Mattermost external-plugin metadata path, then prove the exact merge head preserves named accounts, root enabled settings, and declared-empty/deferred cases. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible: current main lacks declarations for Line-specific credential keys and Mattermost baseUrl, and the shared migration helper defers uncovered keys when named accounts exist. I did not execute the untrusted branch. Is this the best way to solve the issue? No, not mergeable as-is: its owner-boundary approach is sound, but it must be rebased into the newer preserve-root promotion protocol rather than replace it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 01ea77ec3dae. LabelsLabel justifications:
EvidenceWhat 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 (17 earlier review cycles; latest 8 shown)
|
8c6a294 to
d1ee2f0
Compare
|
Rebased onto latest |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d1ee2f0 to
fd948bd
Compare
|
@clawsweeper re-review
Head: |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
fd948bd to
b91df4b
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Addressed the packaged-path P1:
Head: |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
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]>
…alled channel plugins Doctor single-account promotion consulted only bundled setup surfaces, so external channel plugins (Mattermost, imessage) deferred promotion forever on packaged installs. Compose the same read-only installed-plugin discovery doctor already uses with the bundled lookup as last-ditch fallback. Refs openclaw#112474.
Wizard copy is localized at module evaluation time, so prompt assertions failed on machines with a zh locale. Pin OPENCLAW_LOCALE=en via vi.hoisted (before imports) and restore afterwards.
013ef29 to
d465268
Compare
|
@clawsweeper re-review Addressed the setupContract P1 on a rebased branch:
Head: |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Closing this in favor of the declarations-only slice: #136045. Why: since this branch was written, main landed the preserve-root promotion protocol (#132226, #133948) and What remains unique to this PR: doctor reading promotion declarations from externally installed channel plugins (npm packaged installs, where line/mattermost — like the external channels declared in #112293 — ship outside the |
What Problem This Solves
Part 2 of #112238 follow-up. The line and mattermost channel plugins were missed in #112293, which moved hardcoded single-account promotion keys into per-channel plugin declarations. Both plugins have channel-specific config keys that need explicit declaration for single-account promotion but lacked
singleAccountKeysToMoveandsetupFeatures.configPromotionin their package manifests.Why This Change Was Made
singleAccountKeysToMoveon the line setup adapter (channelAccessToken,channelSecret,tokenFile,secretFile) and the mattermost setup adapter (botToken,baseUrl).defineChannelSetupContractforwards these declarations onto the publishedsetupContract, so they stay visible after both channels moved from the legacysetupadapter to the owned setup contract.setupFeatures.configPromotion: trueto bothpackage.jsonfiles so doctor can read the declarations from the lightweight bundled setup artifact.openclaw doctorprocesses never load the runtime plugin registry, so declarations from externally installed channel plugins were invisible and single-account promotion deferred forever on packaged installs (Mattermost ships outside the npmopenclawpackage). The doctor promotion path now composes the same read-only installed-plugin discovery the rest of doctor uses, with the bundled lookup as last-ditch fallback. Discovery resolves the promotion surface with the samesetupContract ?? setupprecedence the channel contract, the runtime registry lookup (setup-promotion-helpers.ts), and the bundled lookup (setup-promotion-bundled.ts) already use — so current plugins that publish onlysetupContract(as line and mattermost do on main) are seen correctly, and legacysetup-only plugins keep working. An installed plugin's setup surface is authoritative for its channel id — when it declares no promotion keys, promotion stays deferred (fail-closed) rather than borrowing bundled declarations the installed plugin did not sanction.Follows the same pattern as the channels migrated in #112293 (slack, signal, irc, imessage, nextcloud-talk, tlon, whatsapp, zalo, telegram, matrix) and the follow-up #112367 (googlechat, zalouser).
User Impact
Single-account migration for line and mattermost channels now correctly identifies all account-scoped keys for promotion into
accounts.default. Named-account configs won't risk flattening channel-root policy keys alongside account credentials. No runtime behavior, config shape, or credential handling changes.Evidence
PR branch rebased onto current
origin/main(d8a1ebbb492); exact-head proof below was run after the rebase on headd4652683b7e.Packaged external-install Doctor proof (post-fix, packaged path, npm install semantics)
Built the npm tarball from this head (
scripts/package-openclaw-for-docker.mjs; notedist/extensions/mattermost/**is excluded from the published package, so on real installs Mattermost only exists as an externally installed plugin), installed it into an isolated prefix with an isolated$OPENCLAW_HOME, built the Mattermost plugin npm runtime from this branch (scripts/check-plugin-npm-runtime-builds.mts --package extensions/mattermost) and installed it viaopenclaw plugins install npm-pack:<tarball>— real npm install semantics, so the plugin's runtime dependencies (zod,ws) resolve from its own package exactly like a registry install — then ran the packagedopenclaw doctor --fixagainst a legacy config with leftover root keys plus an existing named account:Verified the installed plugin artifact actually carries the declaration before running doctor:
Root
botToken/baseUrl/dmPolicymoved intoaccounts.default, the existingaccounts.workis preserved, andenabledstays at root. This run exercises the exact packaged path the earlier review flagged — declarations discovered from the externally installed plugin through its publishedsetupContract, not from bundled artifacts and not from the legacysetupfield — and supersedes the older bundled-layout transcript below.Real behavior proof (focused test execution on current head)
Discovery precedence regression coverage (new)
src/channels/plugins/setup-promotion-discovery.test.tscovers the installed-plugin contract surface directly: a plugin publishing onlysetupContractresolves its declared keys;setupContractwins when both surfaces exist; the deprecatedsetupadapter still resolves when no contract exists; an installed surface with no declarations stays authoritative (fail-closed deferral); bundled fallback still covers channels with no installed setup entry.src/commands/doctor-legacy-config.migrations.test.tsexercises the full normalizer path with an externally installed plugin whose declaration arrives viasetupContract(promote) and with an empty contract (defer).Doctor migration proof (actual resolver with real setup adapters)
The PR's declarations are consumed by the real doctor single-account promotion resolver (
src/channels/plugins/setup-promotion-helpers.ts). Running the resolver with representative legacy channel configs and the actual bundled setup adapters:accounts.default; channel-root policy keys likeenabledremain at root; migration is not deferred.accounts.default; channel-root policy stays at root; migration is not deferred.End-to-end Doctor migration proof (
openclaw doctor --fix)Installed Node 24.18.0 and ran the packaged Doctor migration against a representative legacy config with named accounts plus leftover single-account root keys:
This confirms the full packaged Doctor path: artifact discovery, resolver key selection, and persisted config write all preserve channel-root policy while moving only the declared account-scoped keys into
accounts.default.Declaration verification
The doctor migration resolver reads
singleAccountKeysToMovefrom each channel's setup artifact surface duringopenclaw doctor --fix. Line declares 4 account-scoped keys; Mattermost declares 2. Both manifests enableconfigPromotionso the doctor migration can discover these declarations through the lightweight bundled setup artifact.defineChannelSetupContractforwards the adapter declarations ontolineSetupContract/mattermostSetupContract, which is the only setup surface these plugins publish on current main.extensions/mattermost/src/setup.test.ts— declaration test passes (1 new, 14 passed).extensions/line/src/setup-surface.test.ts— declaration test passes (1 new, 13 passed; 1 pre-existing wizard timeout failure unchanged).oxfmt --checkpassed for all 4 changed source files.Scope
setupContract ?? setupwith the same precedence as the existing runtime and bundled lookups, plus focused unit/migration tests.OPENCLAW_LOCALE=enin the line/mattermost setup surface tests so wizard-copy assertions do not depend on the developer machine's locale.