Skip to content

fix(matrix): move avatar setup into account config#61437

Merged
gumadeiras merged 7 commits into
mainfrom
codex/fix-matrix-avatar-account-promotion
Apr 5, 2026
Merged

fix(matrix): move avatar setup into account config#61437
gumadeiras merged 7 commits into
mainfrom
codex/fix-matrix-avatar-account-promotion

Conversation

@gumadeiras

Copy link
Copy Markdown
Member

Summary

  • Problem: adding a second Matrix account could leave channels.matrix.avatarUrl at the top level instead of moving it into channels.matrix.accounts.default, and the account-add setup path had to treat avatarUrl as an ad hoc field.
  • Why it matters: default-account promotion could split one account's profile config across shared and account-scoped keys, and the shared setup contract did not accurately model Matrix setup input.
  • What changed: Matrix add-account onboarding now uses the Matrix-local promotion helper, avatarUrl is part of shared ChannelSetupInput, setup persists input.avatarUrl, and focused regressions now cover onboarding, setup, and CLI account add.
  • What did NOT change (scope boundary): promotion stays Matrix-local by design; no broader generic promotion refactor.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: Matrix account promotion in onboarding used the generic single-account mover, while Matrix-specific fields like avatarUrl belong to Matrix-local promotion rules. Separately, shared setup input omitted avatarUrl, so Matrix had to smuggle it through setup as an ad hoc field.
  • Missing detection / guardrail: there was no regression covering avatarUrl during second-account promotion or matrix account add --avatar-url.
  • Contributing context (if known): the rest of the Matrix auth/profile fields already moved correctly, which made the straggler easy to miss.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/matrix/src/onboarding.test.ts, extensions/matrix/src/setup-core.test.ts, extensions/matrix/src/cli.test.ts
  • Scenario the test should lock in: promoting a legacy top-level Matrix account moves avatarUrl into accounts.default, and matrix account add --avatar-url forwards the avatar through setup and profile sync.
  • Why this is the smallest reliable guardrail: these three focused tests pin the exact setup, onboarding, and CLI seams where the bug could regress without needing broader Matrix runtime coverage.
  • Existing test that already covers this (if any): none for avatarUrl specifically.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • Adding a second Matrix account now moves avatarUrl into channels.matrix.accounts.default with the rest of the promoted default-account fields.
  • openclaw matrix account add --avatar-url ... now uses the typed shared setup contract instead of a Matrix-only ad hoc path.

Diagram (if applicable)

Before:
[add second Matrix account] -> [promote top-level default config] -> [avatarUrl stays at channels.matrix.avatarUrl]

After:
[add second Matrix account] -> [Matrix-local promotion] -> [avatarUrl moves to channels.matrix.accounts.default.avatarUrl]

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22 + pnpm
  • Model/provider: N/A
  • Integration/channel (if any): Matrix
  • Relevant config (redacted): channels.matrix with legacy top-level default account plus a new named account

Steps

  1. Configure Matrix with a single top-level account and channels.matrix.avatarUrl.
  2. Add a second Matrix account through onboarding or matrix account add.
  3. Inspect the resulting Matrix config.

Expected

  • avatarUrl moves with the rest of the promoted default-account config into channels.matrix.accounts.default.

Actual

  • avatarUrl stayed behind at channels.matrix.avatarUrl.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: focused Matrix regressions for onboarding promotion, setup persistence, and CLI account add avatar forwarding.
  • Edge cases checked: named account id normalization for --name, trimmed avatar URL input.
  • What you did not verify: full Matrix onboarding test file; there is a known unrelated pre-existing failure in the internal-http homeserver prompt path outside this scope.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: Matrix promotion and shared setup typing could drift again if a future profile/setup field is added in one place only.
    • Mitigation: regression coverage now pins onboarding promotion, setup persistence, and CLI forwarding for avatarUrl.

Copilot AI review requested due to automatic review settings April 5, 2026 16:44
@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix size: S maintainer Maintainer-authored PR labels Apr 5, 2026
@greptile-apps

greptile-apps Bot commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug where avatarUrl was left behind at channels.matrix.avatarUrl instead of being moved into channels.matrix.accounts.default.avatarUrl when adding a second Matrix account. The fix adds avatarUrl to the shared ChannelSetupInput type, includes it in the Matrix-local account promotion key sets (MATRIX_SINGLE_ACCOUNT_KEYS_TO_MOVE and MATRIX_NAMED_ACCOUNT_PROMOTION_KEYS), switches the onboarding add-account path to use the Matrix-local promotion helper (moveSingleMatrixAccountConfigToNamedAccount), and threads avatarUrl through applyMatrixSetupAccountConfig. Three focused regression tests lock in the onboarding promotion, setup persistence, and CLI forwarding paths.

Confidence Score: 5/5

Safe to merge — targeted bug fix with full regression coverage and no API-breaking changes.

All findings are P2 or lower. The fix is narrowly scoped, correctly adds avatarUrl to both promotion key sets, and the three new regression tests exercise the exact failure paths described in the root cause. No data-loss, security, or correctness issues observed.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(matrix): move avatar setup into acco..." | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Matrix account promotion/setup so avatarUrl is treated as a first-class setup field and correctly migrates from legacy top-level config into channels.matrix.accounts.default when adding a second account.

Changes:

  • Extend shared ChannelSetupInput to include avatarUrl.
  • Update Matrix setup + onboarding promotion to move/persist avatarUrl under the appropriate account.
  • Add focused regressions covering setup persistence, onboarding promotion, and CLI forwarding for --avatar-url.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/channels/plugins/types.core.ts Adds avatarUrl to the shared setup input contract used across CLI/onboarding/setup adapters.
extensions/matrix/src/setup-config.ts Persists input.avatarUrl into Matrix account config and uses Matrix-local promotion helper.
extensions/matrix/src/onboarding.ts Switches add-account onboarding promotion to Matrix-local promotion logic so Matrix-specific fields (like avatarUrl) move correctly.
extensions/matrix/src/setup-core.test.ts Adds regression ensuring setup stores a trimmed avatarUrl on the target account.
extensions/matrix/src/onboarding.test.ts Adds regression ensuring legacy top-level avatarUrl is promoted into accounts.default.
extensions/matrix/src/cli.ts Removes ad hoc typing; CLI now passes avatarUrl via the shared setup input type.
extensions/matrix/src/cli.test.ts Adds regression ensuring --avatar-url is forwarded through setup and profile sync.

Comment thread extensions/matrix/src/setup-config.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec3d6a0ec9

ℹ️ 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".

Comment thread extensions/matrix/src/setup-config.ts Outdated
@gumadeiras gumadeiras self-assigned this Apr 5, 2026
@gumadeiras
gumadeiras force-pushed the codex/fix-matrix-avatar-account-promotion branch from ec3d6a0 to a3f819f Compare April 5, 2026 18:00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3f819f3c9

ℹ️ 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".

Comment thread extensions/matrix/src/onboarding.ts
@gumadeiras
gumadeiras force-pushed the codex/fix-matrix-avatar-account-promotion branch from f20d1bd to 96560a2 Compare April 5, 2026 18:55
@gumadeiras
gumadeiras force-pushed the codex/fix-matrix-avatar-account-promotion branch from 96560a2 to 4dd887a Compare April 5, 2026 18:57
@gumadeiras
gumadeiras merged commit cac40c0 into main Apr 5, 2026
9 checks passed
@gumadeiras
gumadeiras deleted the codex/fix-matrix-avatar-account-promotion branch April 5, 2026 18:57
@gumadeiras

Copy link
Copy Markdown
Member Author

Merged via squash.

Thanks @gumadeiras!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4dd887a474

ℹ️ 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".

Comment thread extensions/matrix/src/onboarding.ts
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
Merged via squash.

Prepared head SHA: 4dd887a
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Merged via squash.

Prepared head SHA: 4dd887a
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
Merged via squash.

Prepared head SHA: 4dd887a
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Merged via squash.

Prepared head SHA: 4dd887a
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants