Skip to content

feat(users): merge duplicate user profiles - #159889

Merged
steipete merged 2 commits into
mainfrom
steipete/users-merge
Sep 27, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/users-merge

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

One person can accumulate duplicate Gateway profiles, for example when Cloudflare Access logins use different emails, and administrators cannot currently merge an email-less profile.

Requested by Peter Steinberger for team.openclaw.ai. Today, only users.linkEmail triggers a merge when moving the source profile's last email; profiles without email aliases have no equivalent administrative path.

User Impact

Administrators can run openclaw users merge <source> --into <target> (with --json when needed), backed by the new operator.admin-only users.merge RPC. The target remains the surviving person; the source and its existing merge cohort become one-hop tombstones. An exact repeat succeeds without moving aliases again. Redirecting an already-retired source to a different target fails and names its current survivor. The shared Owner profile cannot participate in a merge.

The survivor retains its role, display name, primary identity, saved avatar, explicit preferences, and conflicting account selections. Email aliases, provider/channel identities, personal model accounts, GitHub connection state, and source-only preferences follow the existing merge owner's rules. A source avatar transfers only when the survivor lacks one; personal USER.md files require a manual move.

Historical attribution is unchanged: transcripts, creators, assigners, contributors, audit contexts, approvals, publication receipts, and session participants retain their original IDs. Previously captured authority for the retired profile fails closed. Affected connections are disconnected and their role caches invalidated; reconnect to use the survivor's current authority.

No database schema or protocol-version change, migration, or operator Gateway deployment. Release-note context: add explicit administrative merging of duplicate user profiles, including email-less profiles.

Why This Change Was Made

The CLI and RPC reuse the existing mergeUserProfiles owner through the SQLite write-worker path. Exact-ID validation prevents a stale administrative request from silently selecting a different person. Committed profile publications drive cache invalidation and disconnection, with the response held long enough to acknowledge a merge initiated by the retiring administrator.

Follow-ups from identity research: audit exact-ID session_members membership and suggestion ownership checks for alias-aware reads. This change preserves those historical records and does not broaden their access rules or transfer previously captured authority.

Evidence

  • Coordinator-reviewed commit; clean scoped Codex autoreview through P2. Rebased mechanically onto 66898a633464; git range-diff and stable patch IDs confirm the reviewed delta is unchanged.
  • pnpm test src/gateway/server-methods.users-merge.test.ts --maxWorkers=1: 5/5 passed; 100.89 seconds wrapper wall, 88.14 seconds Vitest (including fresh worker compilation).
  • pnpm test src/cli/users-cli.test.ts --maxWorkers=1: 6/6 passed; 5.23 seconds wrapper wall, 3.66 seconds Vitest.
  • node scripts/check-changed.mjs: core types, all 25 test-type shards, formatting, and earlier guards passed. The script unused-export scan failed on two pre-existing landing-tool exports; upstream 0d02ab7aaf657c1872a5dac32369e88504e3bd5c registers their actual CLI consumer. Incorporated that fix by a patch-identical rebase; failed and remaining check stages all passed when run directly from the native dry-run command list (including all three export scans, core lint, Android lint, schema, import-cycle, and auth guards).
  • pnpm openclaw --version: development build passed on Node 26.9.0; built head 59f5c9d0357c0a7e81a763711b01321644cedb6a.
  • git diff --check: passed. Rebase did not change protocol inputs or the dependency lockfile; existing dependencies remained usable.
  • Final PR head: b6af5be59aee3940580647cdf4fc8e52e494091c. Prior-head ClawSweeper review completed: no actionable findings, no security findings, no before-merge requests, and no Rank-up moves: section; no findings were skipped. The authorized refresh completed; refreshed-head ClawSweeper review found no actionable or security findings, and CI exposed the fixture mismatch corrected below. Exact-head CI run 36355831495 completed successfully (161 successful jobs, 16 skipped). ClawSweeper revision 6 explicitly resolved the method-order P2 and reported no actionable findings. Revision 7, published during native landing, raised a post-commit refresh P2; a post-merge source audit and independent check did not establish the claimed production throw path because the real refresh/publication owners already isolate these errors. The reasoned rejection, remaining callback-contract caveat, and existing shared issue are recorded in the post-merge review disposition. No claim is made that the shared issue is fixed. The native wrapper merged the reviewed head as b1694b364c65666e4b9e9d95814c281228d5c0bf. Initial CI run 36350689488 failed only in subagent-orphan-recovery.restart-integration.test.ts: four stale running assertions received the correct interrupted status; fail-fast cancelled other jobs. A single-file reproduction matched all four failures (23 other cases passed; 81.46 seconds wall). Upstream b459eb600f238d38f8b7156675e5868751f52c54 fixes the assertion after the earlier task-status-to-session-status migration. Incorporated that existing main fix by a patch-identical rebase and started fresh final-head CI; no profile-merge behavior changed.

LOC split (added/deleted): production 236/7, tests and fixtures 444/0, docs 118/2, generated Kotlin method registration 1/0; total 799/9 across 23 files. No changelog edits.

Live proof uses a task-owned local Gateway on a free loopback port, isolated state under .artifacts/c2-live, token auth, synthetic profiles, and disabled channels/providers/schedulers. The email survivor and email-less provider profile were created through the existing ensureProfileForEmail and ensureProfileForTailscaleIdentity flows before startup; the channel identity was linked over the real RPC. No operator Gateway or real person data was used.

Prior CI failure and authorized refresh

Run 36351745576 on prior head ad141c2e757f863325e5ddb1a8777e1d2d77ee88 ended cancelled by fail-fast after checks-node-changed-extensions-bundle-34 (job 108712386321) failed. The actual failure is extensions/codex/src/app-server/native-subagent-completion-delivery.contention.test.ts:140, case rechecks retired-turn-receipt while completion delivery is in flight: vi.getTimerCount() returned 2 rather than 0. Both delivery-count and parent-pin-release assertions passed. The aggregate CI gate also failed.

This file, its completion owner, and its fixture harness are unchanged by the feature and current main. One single-file replay passed all 4 cases in 71.63 seconds wall time; that is not evidence of a fix. Shared fixture lifecycle timers are a hypothesis, and the exact ownership of the extra timers remains unproven. The two inspected completed scheduled-main runs (36348256572 and 36344472972) did not execute this test; newer scheduled run 36351907942 was still pending when inspected. No green-main proof for this test was established, so the work order's conditional single REST rerun was not used. The permitted CI-recovery rebase was already used to incorporate the proven orphan-recovery fix.

Maintainer follow-up classified this Codex fixture failure as an unrelated intermittent with a separate root-cause investigation and explicitly authorized a refresh instead of rerunning the old head. Rebased onto current main without changing the feature patch; git range-diff remains identical. On refreshed head db6c26d04f5cf0b772cb352717e4344150ad621f, the Gateway file passed 5/5 (70.50 seconds wrapper wall; 58.91 seconds Vitest), then the CLI file passed 6/6 (2.46 seconds wrapper wall; 1.31 seconds Vitest). Protocol generators were rerun for upstream protocol changes and left no tracked changes; git diff --check passed. Fresh exact-head CI run 36353844529 completed cancelled by fail-fast. The prior failing extension job passed; a different, PR-caused method-list test failure now blocks landing. No rerun, patch, or merge was attempted after that finding, per the maintainer stop rule. No admin bypass or assertion weakening.

Method-order fixture correction

On db6c26d04f5cf0b772cb352717e4344150ad621f, CI run 36353844529 failed job 108718416024 (checks-node-compact-small-11); fail-fast cancelled the remaining jobs and the aggregate gate failed. Two assertions in src/gateway/server-methods-list.test.ts fail: “appends new methods after model probing while preserving retained older method order” and “preserves the legacy advertised method order.” Production appends users.merge, but the expected suffix lists omit it. The feature also inserts users.merge into LEGACY_ADVERTISED_GATEWAY_METHODS in server-methods-list.test-fixtures.ts, treating the new method as historical. The maintainer subsequently authorized the correction in b6af5be59aee3940580647cdf4fc8e52e494091c (test(gateway): register users.merge as a current-release method): removed users.merge from the frozen legacy fixture and appended it to all three current-release suffix expectations, matching the existing canonical descriptor order. Production code and ordering assertions are unchanged.

The refreshed Gateway and CLI focused tests passed (5/5 and 6/6). ClawSweeper reviewed this exact SHA with no actionable findings, no security findings, no before-merge requests, and no Rank-up moves: section. That review did not override the CI failure; the fixture correction was separately tested and reviewed before publication.

Fixture-correction validation ran each file separately with pnpm test <file> --maxWorkers=1:

Test file Result Wrapper wall
src/gateway/server-methods-list.test.ts 34 passed 25.91 s
src/gateway/methods/registry.test.ts 10 passed 5.68 s
src/channels/plugins/registry.test.ts 11 passed 3.65 s
src/gateway/method-scopes.test.ts 177 passed 22.34 s
src/gateway/server-aux-methods.test.ts 1 passed 20.03 s
src/gateway/server-methods.users-merge.test.ts 5 passed 20.19 s
src/cli/users-cli.test.ts 6 passed 1.84 s

244 tests passed. The two CI-failing ordering assertions now pass; no assertions were weakened or removed. Targeted formatting and git diff --check passed. The correction is two files, +4/-1; pre-commit Codex autoreview was scoped-clean through P2. Commit-scoped Codex autoreview for b6af5be59aee3940580647cdf4fc8e52e494091c also returned scoped-clean through P2, with no accepted/actionable findings. Hosted CI also passed the repaired assertions: 34 method-list cases reported 0.093 seconds of test execution and all five merge cases reported 3.178 seconds. Their shared CI job completed in 491 seconds including setup and other files. The original isolated live proof remains valid because the correction changes only test expectations.

Live CLI transcript (token redacted)
Isolated loopback Gateway; synthetic profiles; explicit token authentication (redacted).
Head: 59f5c9d0357c0a7e81a763711b01321644cedb6a

$ pnpm openclaw gateway call users.linkChannelIdentity --params '{"profileId":"2c2a6c11-291a-4457-8450-5c5d052dee4c","identity":{"channelId":"discord","accountId":"synthetic-qa","senderId":"100000000000000001"}}' --json
{
  "profileId": "2c2a6c11-291a-4457-8450-5c5d052dee4c",
  "identity": {
    "channelId": "discord",
    "accountId": "synthetic-qa",
    "senderId": "100000000000000001"
  }
}
$ node scripts/run-node.mjs gateway call users.linkChannelIdentity --params '{"profileId":"2c2a6c11-291a-4457-8450-5c5d052dee4c","identity":{"channelId":"discord","accountId":"synthetic-qa","senderId":"100000000000000001"}}' --json --url ws://127.0.0.1:65116 --token [REDACTED]

exit=0

$ pnpm openclaw users list --json
{
  "profiles": [
    {
      "id": "1cd33cbb-93e1-4b73-92c0-167786c3e53d",
      "displayName": "Survivor",
      "avatarMime": null,
      "mergedInto": null,
      "createdAt": 1790541956598,
      "updatedAt": 1790541956601,
      "emails": [
        "[email protected]"
      ],
      "githubIdentity": null,
      "hasAvatar": false
    },
    {
      "id": "2c2a6c11-291a-4457-8450-5c5d052dee4c",
      "displayName": "Duplicate",
      "avatarMime": null,
      "mergedInto": null,
      "createdAt": 1790541956616,
      "updatedAt": 1790541956616,
      "emails": [],
      "githubIdentity": null,
      "hasAvatar": false
    },
    {
      "id": "0deb9abb-8837-4c63-8c84-b796e8974e11",
      "displayName": "other",
      "avatarMime": null,
      "mergedInto": null,
      "createdAt": 1790541956625,
      "updatedAt": 1790541956625,
      "emails": [
        "[email protected]"
      ],
      "githubIdentity": null,
      "hasAvatar": false
    }
  ]
}
$ node scripts/run-node.mjs users list --json --url ws://127.0.0.1:65116 --token [REDACTED]

exit=0

$ pnpm openclaw users merge 2c2a6c11-291a-4457-8450-5c5d052dee4c --into 1cd33cbb-93e1-4b73-92c0-167786c3e53d --json
{
  "profile": {
    "id": "1cd33cbb-93e1-4b73-92c0-167786c3e53d",
    "displayName": "Survivor",
    "avatarMime": null,
    "mergedInto": null,
    "createdAt": 1790541956598,
    "updatedAt": 1790542362742,
    "emails": [
      "[email protected]"
    ],
    "githubIdentity": null,
    "hasAvatar": false
  },
  "movedAliasKinds": [
    "provider",
    "channel"
  ]
}
$ node scripts/run-node.mjs users merge 2c2a6c11-291a-4457-8450-5c5d052dee4c --into 1cd33cbb-93e1-4b73-92c0-167786c3e53d --json --url ws://127.0.0.1:65116 --token [REDACTED]

exit=0

$ pnpm openclaw users list --json
{
  "profiles": [
    {
      "id": "1cd33cbb-93e1-4b73-92c0-167786c3e53d",
      "displayName": "Survivor",
      "avatarMime": null,
      "mergedInto": null,
      "createdAt": 1790541956598,
      "updatedAt": 1790542362742,
      "emails": [
        "[email protected]"
      ],
      "githubIdentity": null,
      "hasAvatar": false
    },
    {
      "id": "2c2a6c11-291a-4457-8450-5c5d052dee4c",
      "displayName": "Duplicate",
      "avatarMime": null,
      "mergedInto": "1cd33cbb-93e1-4b73-92c0-167786c3e53d",
      "createdAt": 1790541956616,
      "updatedAt": 1790542362742,
      "emails": [],
      "githubIdentity": null,
      "hasAvatar": false
    },
    {
      "id": "0deb9abb-8837-4c63-8c84-b796e8974e11",
      "displayName": "other",
      "avatarMime": null,
      "mergedInto": null,
      "createdAt": 1790541956625,
      "updatedAt": 1790541956625,
      "emails": [
        "[email protected]"
      ],
      "githubIdentity": null,
      "hasAvatar": false
    }
  ]
}
$ node scripts/run-node.mjs users list --json --url ws://127.0.0.1:65116 --token [REDACTED]

exit=0

$ pnpm openclaw gateway call users.listChannelIdentities --params '{"profileId":"1cd33cbb-93e1-4b73-92c0-167786c3e53d"}' --json
{
  "links": [
    {
      "profileId": "1cd33cbb-93e1-4b73-92c0-167786c3e53d",
      "identity": {
        "channelId": "discord",
        "accountId": "synthetic-qa",
        "senderId": "100000000000000001"
      }
    }
  ]
}
$ node scripts/run-node.mjs gateway call users.listChannelIdentities --params '{"profileId":"1cd33cbb-93e1-4b73-92c0-167786c3e53d"}' --json --url ws://127.0.0.1:65116 --token [REDACTED]

exit=0

$ pnpm openclaw users merge 2c2a6c11-291a-4457-8450-5c5d052dee4c --into 1cd33cbb-93e1-4b73-92c0-167786c3e53d --json
{
  "profile": {
    "id": "1cd33cbb-93e1-4b73-92c0-167786c3e53d",
    "displayName": "Survivor",
    "avatarMime": null,
    "mergedInto": null,
    "createdAt": 1790541956598,
    "updatedAt": 1790542362742,
    "emails": [
      "[email protected]"
    ],
    "githubIdentity": null,
    "hasAvatar": false
  },
  "movedAliasKinds": []
}
$ node scripts/run-node.mjs users merge 2c2a6c11-291a-4457-8450-5c5d052dee4c --into 1cd33cbb-93e1-4b73-92c0-167786c3e53d --json --url ws://127.0.0.1:65116 --token [REDACTED]

exit=0

$ pnpm openclaw users merge 2c2a6c11-291a-4457-8450-5c5d052dee4c --into 0deb9abb-8837-4c63-8c84-b796e8974e11 --json
{
  "ok": false,
  "error": {
    "type": "cli_error",
    "message": "source profile 2c2a6c11-291a-4457-8450-5c5d052dee4c is already merged into 1cd33cbb-93e1-4b73-92c0-167786c3e53d"
  }
}
$ node scripts/run-node.mjs users merge 2c2a6c11-291a-4457-8450-5c5d052dee4c --into 0deb9abb-8837-4c63-8c84-b796e8974e11 --json --url ws://127.0.0.1:65116 --token [REDACTED]
[openclaw] The CLI command failed.
[openclaw] Reason: source profile 2c2a6c11-291a-4457-8450-5c5d052dee4c is already merged into 1cd33cbb-93e1-4b73-92c0-167786c3e53d
[openclaw] Debug: set OPENCLAW_DEBUG=1 to include the stack trace.
[openclaw] Try: openclaw doctor
[openclaw] Help: openclaw --help
[ELIFECYCLE] Command failed with exit code 1.

exit=1

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: android App: android app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes size: L labels Sep 27, 2026
@steipete
steipete marked this pull request as ready for review September 27, 2026 21:09
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: b6af5be59aee3940580647cdf4fc8e52e494091c
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/methods/core-profile-access.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 7:15 PM ET / 23:15 UTC (Revision 7).

ClawSweeper review

What this changes

The branch adds an administrator-only Gateway request and openclaw users merge command to combine duplicate person profiles, including profiles without email aliases.

Merge readiness

⛔ Blocked before merge - 3 items remain

The feature remains useful because current main cannot explicitly merge an email-less profile. The prior method-order finding is fixed and the live proof covers the central flow, but the new RPC can report failure after its SQLite merge has committed if connection refresh throws.

Priority: P2
Reviewed head: b6af5be59aee3940580647cdf4fc8e52e494091c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong real Gateway proof supports a useful implementation, but the newly identified post-commit response defect limits merge readiness.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): An isolated token-authenticated loopback Gateway and real openclaw users merge CLI merged an existing synthetic email-less profile, showed transferred provider and channel aliases, accepted an exact repeat, and rejected redirection; registered-dispatch tests additionally deny a non-admin before the SQLite write and reject captured retired authority. This proof does not cover the separate throwing-refresh finding. The branch changes no stored-data format or schema contract.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): An isolated token-authenticated loopback Gateway and real openclaw users merge CLI merged an existing synthetic email-less profile, showed transferred provider and channel aliases, accepted an exact repeat, and rejected redirection; registered-dispatch tests additionally deny a non-admin before the SQLite write and reject captured retired authority. This proof does not cover the separate throwing-refresh finding. The branch changes no stored-data format or schema contract.
Evidence reviewed 10 items Current main lacks explicit merge: Current main registers users.linkEmail but not users.merge; its CLI has link-email without a merge command. The older path cannot select an email-less source for an administrative merge.
Introduced merge owner: The new operation validates exact source and target IDs, rejects the shared Owner, permits only an exact repeat, and invokes the existing SQLite merge owner.
Admin and live-authority boundary: The method requires operator.admin; the handler carries its current-authority assertion into worker admission and invalidates affected connections after committed publication. The registered-handler test denies a non-admin request without a stored redirect and checks that captured retired-profile authority fails.
Findings 1 actionable finding [P2] Return the committed merge result when refresh fails
Security None None.

How this fits together

The Gateway maps sign-ins and channel identities to durable person profiles in SQLite. An administrator's CLI request reaches the Gateway, which commits a profile merge through the state write worker and then refreshes connected clients.

flowchart LR
  A[Administrator CLI] --> B[Gateway request]
  B --> C[Admin and profile checks]
  C --> D[State write worker]
  D --> E[SQLite profile merge]
  E --> F[Committed profile publication]
  F --> G[CLI result and refreshed connections]
Loading

Decision needed

Question Recommendation
After users.merge commits, should a connection-refresh failure still return the surviving profile as success? Return committed success: Return the survivor result after commit, record refresh failure separately, and add a fault-injection regression for the new RPC.

Why: The same terminal-response contract is under an open maintainer product decision for users.linkEmail; choosing a warning or partial-completion response affects what operators can safely infer and retry.

Before merge

  • Return the committed merge result when refresh fails (P2) - Late discovery on code unchanged since the earlier reviewed head: mergeCanonicalUserProfiles can commit, then refreshConnectedProfile or the broadcast can throw inside this catch and make the RPC return UNAVAILABLE. The operator is told the merge failed even though the source was retired; the open users.linkEmail report documents this same failure mechanism. Separate the durable result from fallible post-commit refresh and cover a throwing refresh.
  • Complete next step (P2) - Resolve the committed-merge response behavior with the profile owner and add a throwing-refresh regression before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P2] Return the committed merge result when refresh fails — src/gateway/server-methods/users.ts:253-257
Agent review details

Security

None.

PR surface

Source +229, Tests +444, Docs +116, Other +1. Total +790 across 23 files.

View PR surface stats
Area Files Added Removed Net
Source 15 236 7 +229
Tests 3 444 0 +444
Docs 4 118 2 +116
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 23 799 9 +790

Review metrics

Metric Value Why it matters
Production versus test growth production +236/-7; tests +444/0 The added code supplies the CLI, protocol, Gateway, and worker path; the larger test addition exercises merge and authority behavior.
New operator surface 1 admin RPC, 1 CLI command, 0 schema versions added The feature exposes the existing merge owner without adding a second storage format.

Technical review

Best possible solution:

Keep the existing SQLite merge owner as the sole writer and make the committed survivor result authoritative, isolating fallible connection refresh from the RPC outcome.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a feature-absence reproduction: current main has no explicit email-less merge path, and the PR supplies a live run of the new flow. The post-commit response finding is source-proven and matches an existing focused report.

Is this the best way to solve the issue?

The existing SQLite merge owner is the right implementation path, but the new handler must separate a committed merge result from later refresh failures before the solution is complete.

Full review comments:

  • [P2] Return the committed merge result when refresh fails — src/gateway/server-methods/users.ts:253-257
    Late discovery on code unchanged since the earlier reviewed head: mergeCanonicalUserProfiles can commit, then refreshConnectedProfile or the broadcast can throw inside this catch and make the RPC return UNAVAILABLE. The operator is told the merge failed even though the source was retired; the open users.linkEmail report documents this same failure mechanism. Separate the durable result from fallible post-commit refresh and cover a throwing refresh.
    Confidence: 0.93
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6b890a5e01ec.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded administrator feature with a concrete, limited-blast-radius response defect to resolve before merge.
  • merge-risk: 🚨 session-state: Profile IDs retire while historical session memberships keep their original IDs, an explicit scope choice documented by the maintainer-authored PR.
  • merge-risk: 🚨 security-boundary: The new admin operation transfers identity aliases across profiles and must retire captured authority and affected live connections.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): An isolated token-authenticated loopback Gateway and real openclaw users merge CLI merged an existing synthetic email-less profile, showed transferred provider and channel aliases, accepted an exact repeat, and rejected redirection; registered-dispatch tests additionally deny a non-admin before the SQLite write and reject captured retired authority. This proof does not cover the separate throwing-refresh finding. The branch changes no stored-data format or schema contract.
  • proof: sufficient: Contributor real behavior proof is sufficient. An isolated token-authenticated loopback Gateway and real openclaw users merge CLI merged an existing synthetic email-less profile, showed transferred provider and channel aliases, accepted an exact repeat, and rejected redirection; registered-dispatch tests additionally deny a non-admin before the SQLite write and reject captured retired authority. This proof does not cover the separate throwing-refresh finding. The branch changes no stored-data format or schema contract.

Evidence

What I checked:

  • Current main lacks explicit merge: Current main registers users.linkEmail but not users.merge; its CLI has link-email without a merge command. The older path cannot select an email-less source for an administrative merge. (src/gateway/methods/core-descriptors.ts:165, 6b890a5e01ec)
  • Introduced merge owner: The new operation validates exact source and target IDs, rejects the shared Owner, permits only an exact repeat, and invokes the existing SQLite merge owner. (src/state/user-profiles.ts:401, b6af5be59aee)
  • Admin and live-authority boundary: The method requires operator.admin; the handler carries its current-authority assertion into worker admission and invalidates affected connections after committed publication. The registered-handler test denies a non-admin request without a stored redirect and checks that captured retired-profile authority fails. (src/gateway/server-methods/users.ts:232, b6af5be59aee)
  • Post-commit response defect: The new handler refreshes connected profiles and broadcasts after the awaited durable merge, but those calls remain inside the catch that converts an exception to an unavailable response. (src/gateway/server-methods/users.ts:253, b6af5be59aee)
  • Related open defect: The open report at users.linkEmail can return failure after the profile merge committed #127545 documents a deterministic refresh exception after users.linkEmail commits, producing the same misleading unavailable response. It carries a maintainer and product-decision signal.
  • Live behavior proof: The current PR body matches the captured SHA-256 0ea71f58a592dafc977bf737ee97dbf252ba5b5bbbbccbafca193fbf09d018f8. Its redacted transcript records a token-authenticated loopback Gateway merging an email-less synthetic profile, moving provider and channel aliases, accepting an exact repeat, and rejecting a conflicting redirect; it does not exercise a throwing refresh. (b6af5be59aee)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve the committed-result contract and add a registered-RPC test where connection refresh throws after a successful merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-27T21:23:12.665Z sha 438fe842bf1a114318f24e18b52044a941254ede :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T21:34:00.574Z sha ad141c2e757f863325e5ddb1a8777e1d2d77ee88 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T21:40:20.697Z sha ad141c2e757f863325e5ddb1a8777e1d2d77ee88 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T22:07:47.286Z sha db6c26d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-27T22:23:54.703Z sha db6c26d :: needs changes before merge. :: [P2] Keep the legacy method prefix frozen and update suffix expectations
  • reviewed 2026-09-27T22:43:41.783Z sha b6af5be :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/users-merge branch from 438fe84 to ad141c2 Compare September 27, 2026 21:26
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Final head: ad141c2e757f863325e5ddb1a8777e1d2d77ee88. The prior completed review found no actionable issues. This is a patch-identical rebase incorporating the upstream orphan-recovery test correction b459eb600f238d38f8b7156675e5868751f52c54; git range-diff still maps the original reviewed feature commit unchanged. The initial CI failure and its single-file reproduction are recorded in the PR body. Fresh exact-head CI is run 36351745576.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
Expose the existing profile merge owner through the admin-only users.merge
RPC and openclaw users merge <source> --into <target>. Support email-less
duplicates, exact-repeat success, and exact head validation. Preserve merge
semantics and historical attribution without changing database or protocol
versions. Reuse worker admission/publication and retire affected live authority.

Document transfer rules and add registered RPC, CLI, and authority boundary
coverage. Regenerate the Android method enum with the protocol generators.

Validation: five merge RPC tests (16.55s test time, 79.99s wrapper wall), six
CLI tests (3.46s wrapper wall), and three sibling administration tests pass.
The Gateway/CLI test graphs and core production types pass. Codex review is
scoped-clean through P2. The initial changed-file assertion failure was fixed
with runtime validation; remaining native checks were continued separately.
Broader test types and core lint encounter two unchanged base-fixture errors
already fixed upstream by 0b6f02f (#159836).
@steipete
steipete force-pushed the steipete/users-merge branch from ad141c2 to db6c26d Compare September 27, 2026 22:00
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@steipete
steipete merged commit b1694b3 into main Sep 27, 2026
247 checks passed
@steipete
steipete deleted the steipete/users-merge branch September 27, 2026 23:18
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor Author

Post-merge review disposition for the late P2 “Return the committed merge result when refresh fails”:

The review was published while the native merge workflow was in progress. It was found during post-merge verification, after the wrapper had merged the exact CI-green head. I inspected the landed source and obtained an independent source check. I am not accepting this as a demonstrated production defect in users.merge:

  • users.merge passes the worker-prepared display to refreshConnectedProfile, so the helper's default display/database read is not executed (src/gateway/server-methods/users.ts:240–253).
  • The actual context owner isolates identity acquisition in prepareGatewayRecipientProfile and per-client display/presence updates in refreshConnectedUserProfile (src/gateway/expected-profile.ts:19–32; src/gateway/server-request-context.ts:389–443).
  • The presence publisher synchronously increments a counter and schedules publication; fallible preparation and broadcasting happen asynchronously inside its catch (src/gateway/server/presence-events.ts:19–59; src/gateway/server/health-state.ts:120–123).
  • broadcastChatMetadataChanged already catches broadcast failures (src/gateway/server-chat-metadata-lifecycle.ts:21–25).

These owner implementations are identical in the reviewed head and landed commit. Replacing the entire trusted refresh callback with a throwing stub bypasses the production isolation above. That demonstrates handler sensitivity to a hypothetical callback-contract violation, but does not establish the claimed escaping production refresh/broadcast failure. The callback type is not a formal no-throw guarantee; broader terminal-response policy and sibling paths remain tracked in #127545. This disposition does not close or claim to fix that issue, and no additional production change was made.

The method-order P2 is fixed in b6af5be59aee3940580647cdf4fc8e52e494091c; all 244 selected tests passed. Exact-head CI run 36355831495 passed, and the native wrapper verified merge commit b1694b364c65666e4b9e9d95814c281228d5c0bf.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
* feat(users): merge duplicate user profiles

Expose the existing profile merge owner through the admin-only users.merge
RPC and openclaw users merge <source> --into <target>. Support email-less
duplicates, exact-repeat success, and exact head validation. Preserve merge
semantics and historical attribution without changing database or protocol
versions. Reuse worker admission/publication and retire affected live authority.

Document transfer rules and add registered RPC, CLI, and authority boundary
coverage. Regenerate the Android method enum with the protocol generators.

Validation: five merge RPC tests (16.55s test time, 79.99s wrapper wall), six
CLI tests (3.46s wrapper wall), and three sibling administration tests pass.
The Gateway/CLI test graphs and core production types pass. Codex review is
scoped-clean through P2. The initial changed-file assertion failure was fixed
with runtime validation; remaining native checks were continued separately.
Broader test types and core lint encounter two unchanged base-fixture errors
already fixed upstream by 00b1e27 (openclaw#159836).

* test(gateway): register users.merge as a current-release method

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant