Skip to content

fix(gateway): owner profile follow-ups - #137022

Merged
steipete merged 8 commits into
mainfrom
claude/owner-profile-followups
Sep 3, 2026
Merged

steipete merged 8 commits into
mainfrom
claude/owner-profile-followups

Conversation

@steipete

@steipete steipete commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where administrators could merge the shared local owner profile with a personal profile or assign it an operator role, and where adding one identified person to an owner-only Gateway incorrectly activated multi-person catalog restrictions. The owner's Identity page also showed an empty Linked emails row and misleading GitHub retry instructions.

Related: #136819 (durable owner profiles for single-user Gateways).

Why This Change Was Made

The shared owner is attribution and display identity only. This follow-up keeps merge and role rejection at the profile store, maps its typed errors to INVALID_REQUEST, and applies the existing owner exclusion to catalog counts and visibility. The reserved ID now comes from the public Gateway protocol contract, shared by the store and Control UI.

Three follow-ups:

  1. Reject email links/merges into or out of the owner, including tombstoned targets, and reject operator-role assignment. An email attached by the old linkEmail path could later make GitHub sign-in attach an identity to the owner or merge it in either direction; the verified-identity writer now rejects that demonstrated path too.
  2. Count personal identities only and treat attached owner attribution as no sharing identity in catalog visibility/cache keys. Owner plus one person stays single-user; multi-person visibility and role caps remain enforced.
  3. Explain the GitHub-backed Cloudflare Access/Tailscale Serve sign-in path on the owner's Identity rows and omit Linked emails. Document the merge/role restrictions in the user model guide.

The first commit is behavior-neutral cleanup limited to the landed hunks: shorten the misleading personal-GitHub comment (src/gateway/server-methods/github-personal-authorization.ts:33) and consolidate two identical provider/owner test fixtures (src/gateway/server-methods/users.test.ts:178, used at :196 and :674). No database schema, migration, configuration option, authorization grant, sandbox, recovery, budget, baseline, or CLAUDE.md changes.

  1. Merged-owner state repair (commits 5 and 6). Unreleased main builds between feat(gateway): durable owner profile for single-user gateways #136819 and this PR let users.linkEmail merge gateway-owner into a person, after which generic profile resolution followed merged_into and a shared-secret reconnect inherited that person's role, catalog identity, and personal GitHub connection. Per repository policy, legacy persistent state is normalized only by Doctor: openclaw doctor --fix restores the raw owner row as its own head and re-points the gateway.local/owner identity (src/state/user-profiles-owner-migration.ts, sequenced beside the Tailscale identity migration; non-fix runs report the finding with the hint). At runtime ensureGatewayOwnerProfile never resolves through a merge: merged or misdirected owner rows raise a typed repair-required error, WebSocket and HTTP admission continue unidentified with a warning naming the doctor command, and no durable row is mutated on connect. The person keeps their emails, role, and GitHub identities. The email/role/GitHub guards now check both the raw requested id and the resolved id so the owner tombstone cannot be targeted while it exists. No schema change or version bump; no stable release contains the owner profile.

User Impact

Owner merge and role requests now return actionable invalid-request errors. Personal profiles retain their existing merge, role, and GitHub behavior. Solo Gateways keep their existing catalog visibility, and shared-owner Identity settings explain how personal GitHub identity becomes available.

Evidence

Retained final-effect trace (commit 98f7cc6ed4f, src/gateway/server/ws-connection/connect-device-pairing.test.ts): with seeded merged-owner state the pre-repair shared-token connection gets FORBIDDEN from users.github.status/users.github.authorize.start while the personal GitHub service spies record zero calls (line 191); sessions.list keeps the person's creator attribution while the caller stays identityless, system-owned, and unrestricted (206); users.setRole/users.linkEmail on gateway-owner return INVALID_REQUEST and users.list shows the person's role and emails unchanged (235); after the Doctor repair the same client reconnects as gateway-owner, GitHub status succeeds as disconnected for the owner only, and the person's state is preserved (280). The migration import in that test is static so the repo's Vitest filesystem module cache cannot mask it. 9/9 in the file; check-changed green; exact-head CI run 33737242523 success.

Main breakage fixed in passing (commit 6fd09a7f76f, test-only): #136952 started passing operatorRoleActor: { kind: "system" } for owner-sender update.run dispatch without updating two expectations, leaving checks-node-compact-small-4 and checks-node-compact-large-16 red on main; the expectations now include it.

Merged-owner repair proof: seeded merged-owner state fails pre-fix (six runtime cases threw nothing; Doctor preview and sequencing never called the repair; the real-server reconnect returned users.self success instead of FORBIDDEN). Post-fix: src/state/user-profiles-owner-migration.test.ts 7 passed (fix, idempotent second fix, personal data preserved, alias cache invalidated), runtime fail-closed 6 passed, doctor preview/sequencing 71 passed, real-server reconnect stays unidentified until the repair runs and attaches gateway-owner afterwards. Rebased onto current main (516fbb224bf inlined the profile write-transaction wrapper); all branch commits use runOpenClawStateWriteTransaction with post-commit publication only after an actual write. Final focused run on the rebased head: 351 tests across 19 files; check-changed green.

The three requested commits and the additional type-only validation fix passed independent Codex autoreview at P0–P2 with no accepted/actionable findings. The validation fix is a fourth commit so the three requested commits remain intact without amending history. Production delta is +76/-38 (+38); tests are +378/-89 (+289); docs +1/-1. Production growth is the requested store exclusions/typed error, catalog exclusion, protocol export, and owner-specific UI copy/branching; no parallel runtime path was added. The initial changed-check found 712 counted lines in user-profiles.ts (limit 700); reusing the canonical protocol profile type removed duplicated type declarations and brought it within the 700-line limit without a suppression. That final type-only cleanup also passed independent autoreview, 83 focused profile-state tests, and the complete 650-test suite again.

Regression proof before each repair:

  • Store/count command: 13 failed, 8 passed. Twelve owner mutation cases failed because the operation did not throw; owner plus one person returned true for multiple identities. Cases cover new/existing email links, tombstoned targets, moving one of one/two owner aliases, assigning/clearing roles through direct/tombstoned IDs, and three GitHub attachment/merge directions using old state.
  • Gateway command: 5 failed, 56 passed. Two typed errors were reported as UNAVAILABLE instead of INVALID_REQUEST; owner-created catalog rows were listable/readable on multi-person Gateways; adding owner attribution invalidated settled enumeration. The error class was present for this isolated mapping proof, while the production mapping and catalog behavior remained unchanged.
  • UI command: 2 failed, 22 passed because owner-specific sign-in guidance was absent.

Exact commands and results:

# Deslop: 83 passed, 3 files.
node scripts/run-vitest.mjs src/gateway/server-methods/github-personal-authorization.test.ts src/gateway/github-personal-publication.test.ts src/gateway/server-methods/users.test.ts

# Pre-fix store/count: 13 failed, 8 passed, 2 files.
node scripts/run-vitest.mjs src/state/user-profiles.owner.test.ts src/state/user-profile-list.test.ts

# Pre-fix Gateway mapping/catalog: 5 failed, 56 passed, 2 files.
node scripts/run-vitest.mjs src/gateway/server-methods/users.test.ts src/gateway/server-methods/session-catalog-visibility.test.ts

# Repaired backend: 175 passed, 10 files.
node scripts/run-vitest.mjs src/state/user-profiles src/state/user-profile-list src/state/user-profile-aliases src/gateway/server-methods/users src/gateway/server-methods/session-catalog-visibility src/gateway/session-sharing src/gateway/operator-role-policy

# Pre-fix UI: 2 failed, 22 passed, 2 files.
node scripts/run-vitest.mjs ui/src/pages/profile/identity-section.test.ts ui/src/pages/profile/profile-page.test.ts

# Final requested suite + deslop/alias coverage: 650 passed, 21 files.
node scripts/run-vitest.mjs src/state/user-profiles src/state/user-profile-list src/gateway/server-methods/users src/gateway/server-methods/session-catalog-visibility src/gateway/session-sharing src/gateway/operator-role-policy src/gateway/server/ws-connection/connect-device-pairing.test.ts src/infra/host-account-name src/gateway/server-methods/users-github ui/src/pages/profile ui/src/components/app-sidebar src/gateway/server-methods/github-personal-authorization.test.ts src/gateway/github-personal-publication.test.ts src/state/user-profile-aliases

# Type-only validation fix: 83 passed, 4 files.
node scripts/run-vitest.mjs src/state/user-profiles src/state/user-profile-list src/state/user-profile-aliases
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/state/user-profiles.ts

pnpm ui:i18n:baseline
pnpm ui:build
pnpm build
node --import ./scripts/tsx.mjs scripts/check-control-ui-performance.mts
node scripts/check-changed.mjs
git diff --check

Final suite split: 83 state tests, 195 Gateway tests, 14 host-account tests, and 358 UI tests. UI build and performance checks passed: startup JS 348,405 B gzip / 8 requests, enforcement limit 350,141 B / 18 requests, headroom 1,736 B; startup CSS 43.6 KiB gzip, limit 45.0 KiB. i18n baseline regeneration found 79 raw-copy entries and 6,204 source keys; no baseline file changed.

node scripts/check-changed.mjs passed (exit 0), including core/core-test/UI typechecks, all dead-export scans (zero entries), changed-file lint, storage guards, and runtime import cycles (zero). Both git diff --check and the full committed-range whitespace check are clean.

Visual evidence uses real isolated Chromium and the source Control UI with a mocked Gateway, synthetic owner data, one users.self request per capture, and zero page errors. Both screenshots were inspected before attachment; this is mocked Gateway browser proof, not live Cloudflare/Tailscale authentication.

Before After
Shared owner Identity before Shared owner Identity after

Deslop findings retained for the author:

  • src/gateway/server/ws-connection/connect-user-profile.ts:28: removing the non-null assertion safely requires expressing the caller's owner/identified-input relation. A new guard changes failure behavior; another cast would only hide it.
  • src/infra/host-account-name.ts:5, :28, :54: keep cached-failure, login-name suppression, and platform fallback contracts.
  • src/gateway/server-methods/sessions-compaction-checkpoints.ts:119 and src/gateway/session-recovery-service.ts:275: keep comments explaining inherited sandbox isolation.
  • src/state/user-profiles.owner.test.ts:189: preserve the existing provider-identity reuse behavior. This PR prevents new contamination and rejects GitHub mutations through old owner aliases; it does not reconstruct owner profiles already merged into another ID. Repairing such pre-existing state is separate work.

The GitHub path was traced through applyVerifiedGitHubIdentity, prepareUserProfileGitHubMerge, both merge callers, and the verified alias producers. Clean owner creation has only the gateway.local/owner identity. Personal GitHub OAuth remains a separate credential connection and does not create a sign-in identity.

Exact-head CI run 33717942940 completed skipped at c72b822d7f0539d31cf19bbc8382efe514a9b7f9; all 31 jobs were skipped. .github/workflows/ci.yml skips draft pull requests. The requested watcher returned NO-RUN-ATTACHED (exit 13); a skipped run is not executed proof. The PR was confirmed MERGEABLE and remains draft.

node scripts/watch-pr-ci.mjs 137022 c72b822d7f0539d31cf19bbc8382efe514a9b7f9 --attach-timeout 60 --timeout 120 --interval 15

This PR intentionally remains draft for maintainer review. No merge or landing was performed.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 5:18 AM ET / 09:18 UTC.

ClawSweeper review

What this changes

Repairs shared Gateway owner-profile merge state, prevents the owner from being treated as a personal identity, and documents the Doctor recovery path.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: this is a bounded, maintainer-directed repair for an unreleased Gateway owner-profile regression, with a fail-closed runtime path and Doctor-owned recovery.

Priority: P1
Reviewed head: 98f7cc6ed4fb2998c4f615f04231297ce4c32438

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A well-scoped state-boundary repair with strong focused Gateway proof and a deliberately limited legacy-state contract.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The added real Gateway server/WebSocket scenario injects the malformed persisted state, verifies rejection before personal GitHub service I/O, and verifies observable recovery after Doctor repair.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The added real Gateway server/WebSocket scenario injects the malformed persisted state, verifies rejection before personal GitHub service I/O, and verifies observable recovery after Doctor repair.
Evidence reviewed 6 items Introduced repair owner: The PR adds a Doctor-owned repair that detects merged or misdirected canonical owner rows and restores the canonical local identity in one state write transaction.
Fail-closed connection behavior: Gateway profile resolution catches owner-profile failure and continues without an attached profile rather than resolving through a personal profile.
Authority-boundary proof: The introduced real Gateway WebSocket test seeds merged owner state, verifies personal GitHub service methods are not called before repair, then verifies canonical owner recovery after Doctor repair.
Findings None None.
Security None None.

How this fits together

Gateway admission attaches a durable profile to an authenticated connection; that profile then informs role policy, personal GitHub actions, and session visibility. This change keeps the shared-secret owner separate from personal profiles and sends malformed prior state to Doctor for repair.

flowchart LR
  A[Shared-secret connection] --> B[Gateway admission]
  B --> C[Owner profile lookup]
  C --> D{State is valid?}
  D -->|yes| E[Owner-scoped session and GitHub behavior]
  D -->|merged or misdirected| F[Unidentified connection and repair hint]
  F --> G[Doctor repair]
  G --> C
Loading

Before merge

  • Resolve merge risk (P1) - The repair adds a net-positive persistent-state safety boundary: roughly production +294/-52 lines before discounting extraction, justified by moving all malformed-owner mutation to Doctor and retaining fail-closed admission.
  • Resolve merge risk (P1) - Doctor can rewrite only unreleased main/nightly owner-profile state from the feat(gateway): durable owner profile for single-user gateways #136819 window; the supplied maintainer decision intentionally leaves an indistinguishable UUID-only legacy binding unchanged.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +242, Tests +872, Docs +2. Total +1116 across 30 files.

View PR surface stats
Area Files Added Removed Net
Source 15 294 52 +242
Tests 13 969 97 +872
Docs 2 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 30 1266 150 +1116

Review metrics

Metric Value Why it matters
Production versus test delta production +294/-52; tests and test support +969/-97; docs +3/-1 The net production growth is primarily the canonical Doctor repair owner, state guards, and profile-policy exclusions; test growth exercises the migration and Gateway boundary.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor/repair-sequencing.ts, migration/backfill/repair: src/commands/doctor/shared/preview-warnings.ts, migration/backfill/repair: src/state/user-profiles-owner-migration.ts, migration/backfill/repair: src/state/user-profiles-owner.ts, migration/backfill/repair: src/state/user-profiles-schema.ts, unknown-data-model-change: src/state/user-profiles-owner-migration.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #136819
Summary: This PR is the candidate repair for malformed owner-profile state introduced during the owner-profile feature rollout.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the bounded main-only repair (recommended)
    Accept Doctor-mediated normalization of the unreleased owner-profile state while retaining the documented UUID-only legacy limitation.

Technical review

Best possible solution:

Keep Doctor as the sole writer for malformed owner state and preserve the fail-closed connection path with the existing canonical-owner regression coverage.

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

Yes: the introduced production Gateway WebSocket test creates the malformed owner state, observes rejected personal-profile actions before repair, and observes canonical-owner recovery after Doctor repair.

Is this the best way to solve the issue?

Yes: the repair normalizes invalid persistent state at Doctor while connection admission remains fail closed, matching the stated maintainer decision and avoiding a runtime compatibility alias.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 74ade6f54c87.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The added real Gateway server/WebSocket scenario injects the malformed persisted state, verifies rejection before personal GitHub service I/O, and verifies observable recovery after Doctor repair.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The added real Gateway server/WebSocket scenario injects the malformed persisted state, verifies rejection before personal GitHub service I/O, and verifies observable recovery after Doctor repair.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The repair addresses an active main/nightly path where a shared-secret connection could inherit a personal profile's behavior before recovery.
  • merge-risk: 🚨 compatibility: Doctor changes existing main/nightly profile rows and connection behavior for malformed owner state, even though no stable release contains this feature.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The added real Gateway server/WebSocket scenario injects the malformed persisted state, verifies rejection before personal GitHub service I/O, and verifies observable recovery after Doctor repair.
  • proof: sufficient: Contributor real behavior proof is sufficient. The added real Gateway server/WebSocket scenario injects the malformed persisted state, verifies rejection before personal GitHub service I/O, and verifies observable recovery after Doctor repair.

Evidence

What I checked:

Likely related people:

  • unknown: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (7 earlier review cycles)
  • reviewed 2026-09-03T05:18:54.086Z sha c72b822d7f0539d31cf19bbc8382efe514a9b7f9 :: blocked before merge. :: [P1] Migrate owner profiles already merged into a person
  • reviewed 2026-09-03T06:02:32.159Z sha c72b822d7f0539d31cf19bbc8382efe514a9b7f9 :: blocked before merge. :: [P1] Repair owner profiles already merged into a person
  • reviewed 2026-09-03T06:40:07.472Z sha 2d6997d677aa7a2d20704278edb91266d4ecc7db :: blocked before merge. :: [P1] Move legacy owner repair out of connection admission
  • reviewed 2026-09-03T07:51:57.681Z sha f7f1c4709ec09fe0c48e3ccc1080b333187f3edd :: needs real behavior proof before merge. :: [P1] Canonicalize legacy owner IDs before attaching them
  • reviewed 2026-09-03T08:01:03.496Z sha f7f1c4709ec09fe0c48e3ccc1080b333187f3edd :: needs real behavior proof before merge. :: [P1] Reject or normalize noncanonical owner identities
  • reviewed 2026-09-03T08:18:28.827Z sha e8532d1 :: needs real behavior proof before merge. :: [P1] Canonicalize legacy owner identities before attaching them
  • reviewed 2026-09-03T08:43:37.990Z sha 6fd09a7 :: needs real behavior proof before merge. :: none

@steipete
steipete marked this pull request as ready for review September 3, 2026 05:23
@steipete
steipete requested a review from a team as a code owner September 3, 2026 05:23
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 3, 2026
@steipete
steipete force-pushed the claude/owner-profile-followups branch from c72b822 to d078e7c Compare September 3, 2026 06:17
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Sep 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XL and removed size: L labels Sep 3, 2026
@steipete
steipete force-pushed the claude/owner-profile-followups branch from d8949ab to f7f1c47 Compare September 3, 2026 07:43
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision on the merged-owner state (ClawSweeper's "Decision needed" and the four "before merge" items):

Doctor owns the repair; the connection path fails closed. Owner rows that unreleased main builds merged into a person (via users.linkEmail between #136819 and this PR) are restored by openclaw doctor --fix through src/state/user-profiles-owner-migration.ts, sequenced beside the Tailscale identity migration; a non-fix run reports the finding with the fix hint. At runtime ensureGatewayOwnerProfile never resolves through merged_into: merged or misdirected owner rows raise a typed repair-required error, the WebSocket and HTTP admission paths continue unidentified with a warning that names the doctor command, and no durable row is mutated on connect. The person keeps their emails, role, and GitHub identity in every case.

Scope: this state can only exist on nightly/main installs from the window above; no stable release tag contains the owner profile, so no schema change or schema-version bump is involved. The one remaining ambiguity, a legacy uuid owner binding that an old merge already repointed with no canonical row present, cannot be told apart from a valid legacy binding by the schema and is documented as out of scope.

CI: the only failing job on the current head is check-lint-core-4, which rejects src/node-host/runner.test.ts on main itself (1,103 lines against the 1,000 limit; byte-identical to main). Fixes are in flight in #137149 and #137159; this PR will be rebased once one of them lands.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Sep 3, 2026
Unreleased owner-profile builds allowed email linking to merge gateway-owner
into a person and move gateway.local/owner to that person. Generic profile
resolution then followed merged_into, so shared-secret reconnects inherited
the person's role, catalog identity, and personal GitHub connection. Guards
that checked only resolved IDs also missed the owner tombstone.

Restore the raw canonical owner and its provider identity in one profile-write
transaction. Reuse a legacy UUID owner only when it is unmerged; otherwise
create the canonical owner. Leave the person's emails, role, and GitHub state
untouched, invalidate cached aliases after commit, and warn once per repair.
Check both raw and resolved IDs at email, role, and verified GitHub mutations.
This repairs unreleased state without schema changes or a Doctor migration.

Proof: 10 new state regressions failed before the fix; the real-server
reconnect regression also reproduced successful tombstone linking and leaked
person ID, policy, and GitHub account. All 39 focused owner/reconnect tests
now pass. The requested state, gateway, and UI suites pass 270 tests across
16 files. Update the user-model owner paragraph with next-connect repair
behavior. Follow-up repair for #137022.

Preserve the requested reuse of raw, unmerged legacy UUID bindings. If an old
merge already repointed that binding and no canonical owner row exists, the
schema has no authoritative original-owner ID to distinguish it from a valid
legacy binding; this historical ambiguity remains outside this repair.

Validation: node scripts/check-changed.mjs passed, including core/test/UI
types, changed-file lint, full-tree dead exports, storage guards, and zero
runtime import cycles. git diff --check is clean.
Earlier unshipped owner merges left gateway-owner pointing at a person and
moved its local identity. Connection-time recovery repaired durable profile
rows during authentication, contrary to the runtime/Doctor ownership boundary.

Apply the maintainer decision for #137022: Doctor --fix owns the idempotent
repair, while non-fix Doctor reports the finding and recovery hint. Restore
the raw canonical owner and local identity atomically, preserve personal
emails, roles, and GitHub identities, and invalidate aliases after commit.
Reuse an unmerged legacy UUID only when no canonical owner exists.

Runtime rejects merged or misdirected owner rows with a typed repair-required
error naming openclaw doctor --fix. Existing WS and HTTP catches warn and
continue unidentified. Preserve missing-owner creation, name adoption, and
all earlier merge, role, GitHub, and canonical-ID guards. No schema change.

Proof: pre-change runtime cases returned instead of throwing; Doctor preview
and repair sequence omitted the finding/repair; real-server reconnect allowed
users.self instead of FORBIDDEN. The requested state/gateway/UI suites plus
Doctor preview pass 352 tests across 19 files. The seven migration tests also
pass with alias assertions before any runtime writer. Real reconnect proves
absent authenticated profile and presence user, the logged Doctor hint, and
canonical identity after explicit repair with the person's state preserved.

Validation: node scripts/check-changed.mjs, pnpm build, git diff --check,
and independent Codex autoreview at P0-P2. Docs describe Doctor repair and
reconnect. The existing historical ambiguity of an unmerged UUID identity
already repointed to a person with no canonical row remains unchanged.
@steipete
steipete force-pushed the claude/owner-profile-followups branch from f7f1c47 to e8532d1 Compare September 3, 2026 08:09
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 3, 2026
Main's #136952 minted the system actor for owner-sender dispatch without
updating these expectations, leaving checks-node-compact-small-4 and
checks-node-compact-large-16 red on main. Fixed here because this PR is
landing on that main.
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 3, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 3, 2026
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer response to the current ClawSweeper items (head after the retained-trace commit):

Final-effect trace (real behavior proof): the real-server regression in src/gateway/server/ws-connection/connect-device-pairing.test.ts now seeds the merged-owner state, connects with the shared token, and asserts at the service boundary that the pre-repair connection cannot reach personal GitHub (users.github.status FORBIDDEN, no personal service handler invoked for the person), cannot act as the person in the catalog (owner-equivalent visibility, no creator attribution to the person's session), and cannot mutate the owner tombstone (users.setRole / users.linkEmail on gateway-owner rejected with INVALID_REQUEST; the person's role and emails unchanged via users.list). After the Doctor repair runs in-test, the same client reconnects as gateway-owner and users.github.status succeeds with no personal connection. Exact assertions and counts are in the PR body's Evidence section.

Data-model compatibility: no schema change and no schema-version bump. The Doctor repair only updates existing rows in user_profiles (merged_into, updated_at) and user_profile_identities (profile_id for gateway.local/owner); it is idempotent (second run is a no-op) and creates nothing that older readers do not already understand. Runtime never writes during admission. No stable release tag contains the owner profile, so the affected state exists only on nightly/main installs from the #136819 window; downgrading leaves the rows inert.

Production LOC (+242 net across the branch): the growth is the two owner-boundary modules, src/state/user-profiles-owner.ts (runtime ensure that fails closed on merged or misdirected rows) and src/state/user-profiles-owner-migration.ts (Doctor-owned idempotent repair), plus the raw-and-resolved id guards, the protocol constant, and owner-specific Identity copy. The connect-time repair introduced mid-branch was removed again in favor of the single Doctor owner, so there is one canonical repair flow and one canonical guard set; the remaining size is the price of keeping runtime read-only for legacy state instead of a smaller mutate-on-connect path.

@steipete
steipete merged commit 7eaaeaf into main Sep 3, 2026
213 checks passed
@steipete
steipete deleted the claude/owner-profile-followups branch September 3, 2026 09:40
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

obviyus added a commit that referenced this pull request Sep 3, 2026
Collapses the model-list cleanup (#135912) and the provider-login branch into
one change rebased onto main.

- models.list reads one closed catalog source (gateway, prepared, published);
  the CLI `models list` and chat `/models` consume the prepared catalog directly.
- Prepared model runtime: owners publish one curated build, live discovery runs
  only in the catalog worker, and secret-free provider-auth facts captured at
  build time replace native readiness reobservation and auth-mode flags.
- Provider login: one login runtime shared by the CLI, chat `/login`, Telegram,
  and the Control UI; `openclaw.setup.auth.start` owns interactive sign-in.
- First-run setup inference saves the credential, confirms the in-memory
  candidate with one tool-free turn, and commits config only on success.
- xai catalog derives from the manifest; Codex native auth probes the CLI;
  doctor repairs legacy model refs and session routes.

Integration with main: keeps the worker discovery plan (#137063), worker plugin
scoping (#135486), auth order and profile identity (#132450, #137022), the
plugin-owned Codex/Claude login readers, and the built-artifact preference for
setup revalidation (#136036). Drops main's readiness reobservation (#134524)
and stale-refresh catalog mode (#136915): the prepared build already carries
the provider-auth facts those paths re-derived.

Claude-Session: https://claude.ai/code/session_01CnvVXNnjjQGMrBLYjq29RP
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
* chore(gateway): deslop owner profile change

* fix(gateway): keep the owner profile out of merges, roles, and catalog counts

* fix(ui): explain GitHub rows for the shared owner profile

* refactor(state): reuse protocol user profile types

* fix(state): restore a merged owner profile on connect

Unreleased owner-profile builds allowed email linking to merge gateway-owner
into a person and move gateway.local/owner to that person. Generic profile
resolution then followed merged_into, so shared-secret reconnects inherited
the person's role, catalog identity, and personal GitHub connection. Guards
that checked only resolved IDs also missed the owner tombstone.

Restore the raw canonical owner and its provider identity in one profile-write
transaction. Reuse a legacy UUID owner only when it is unmerged; otherwise
create the canonical owner. Leave the person's emails, role, and GitHub state
untouched, invalidate cached aliases after commit, and warn once per repair.
Check both raw and resolved IDs at email, role, and verified GitHub mutations.
This repairs unreleased state without schema changes or a Doctor migration.

Proof: 10 new state regressions failed before the fix; the real-server
reconnect regression also reproduced successful tombstone linking and leaked
person ID, policy, and GitHub account. All 39 focused owner/reconnect tests
now pass. The requested state, gateway, and UI suites pass 270 tests across
16 files. Update the user-model owner paragraph with next-connect repair
behavior. Follow-up repair for openclaw#137022.

Preserve the requested reuse of raw, unmerged legacy UUID bindings. If an old
merge already repointed that binding and no canonical owner row exists, the
schema has no authoritative original-owner ID to distinguish it from a valid
legacy binding; this historical ambiguity remains outside this repair.

Validation: node scripts/check-changed.mjs passed, including core/test/UI
types, changed-file lint, full-tree dead exports, storage guards, and zero
runtime import cycles. git diff --check is clean.

* fix(state): repair merged owner profiles through doctor

Earlier unshipped owner merges left gateway-owner pointing at a person and
moved its local identity. Connection-time recovery repaired durable profile
rows during authentication, contrary to the runtime/Doctor ownership boundary.

Apply the maintainer decision for openclaw#137022: Doctor --fix owns the idempotent
repair, while non-fix Doctor reports the finding and recovery hint. Restore
the raw canonical owner and local identity atomically, preserve personal
emails, roles, and GitHub identities, and invalidate aliases after commit.
Reuse an unmerged legacy UUID only when no canonical owner exists.

Runtime rejects merged or misdirected owner rows with a typed repair-required
error naming openclaw doctor --fix. Existing WS and HTTP catches warn and
continue unidentified. Preserve missing-owner creation, name adoption, and
all earlier merge, role, GitHub, and canonical-ID guards. No schema change.

Proof: pre-change runtime cases returned instead of throwing; Doctor preview
and repair sequence omitted the finding/repair; real-server reconnect allowed
users.self instead of FORBIDDEN. The requested state/gateway/UI suites plus
Doctor preview pass 352 tests across 19 files. The seven migration tests also
pass with alias assertions before any runtime writer. Real reconnect proves
absent authenticated profile and presence user, the logged Doctor hint, and
canonical identity after explicit repair with the person's state preserved.

Validation: node scripts/check-changed.mjs, pnpm build, git diff --check,
and independent Codex autoreview at P0-P2. Docs describe Doctor repair and
reconnect. The existing historical ambiguity of an unmerged UUID identity
already repointed to a person with no canonical row remains unchanged.

* test(agents): expect the system actor on owner update dispatch

Main's openclaw#136952 minted the system actor for owner-sender dispatch without
updating these expectations, leaving checks-node-compact-small-4 and
checks-node-compact-large-16 red on main. Fixed here because this PR is
landing on that main.

* test(gateway): trace merged-owner effects before and after doctor repair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant