Skip to content

fix: keep connected apps tied to approving ID membership - #196276

Merged
joshavant merged 1 commit into
mainfrom
fix/connected-app-membership-authority
Nov 9, 2026
Merged

joshavant merged 1 commit into
mainfrom
fix/connected-app-membership-authority

Conversation

@joshavant

@joshavant joshavant commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Connected apps approved through OpenClaw ID can outlive the approving membership when the same person also has a local Gateway role.

User Impact

New ID-origin app approvals stay tied to the original membership and approving device listing. Removing that member or key ends the app’s access and retained work, including approvals made through that app. Independent local roles and approvals through other sign-in paths keep their own lifetimes.

Before rollout, revoke and reapprove any older ID-origin grants that lack this binding; their original sign-in source cannot be inferred from the stored profile. No live grants or service settings were changed for this PR.

Why This Change Was Made

Core captures the authenticated caller’s original admission and checks it through the existing membership authority when binding or restoring a grant. MCP relay preserves that opaque source locally without exposing it in relay metadata or display replies. The same binding supplies RPC, browser, and retained-work authority, while normal profile and named-role checks remain in force.

This adds no membership manager, removal hook, SDK subpath, or UI change. Production code grows by 197 lines; the exact 454-line regression allocation covers signed removal, transitive and independent approvals, restored source checks, and grant-state reloads.

Evidence

  • The real Gateway/plugin regression fails on base: signed removal closes the member socket but the app RPC still succeeds. With the fix, original and transitive app RPCs fail, the app browser closes, reconstruction is refused, and an independently approved app for the same profile continues working. Membership uses signed SQLite state and private Unix ingress; only external relay transport is synthetic.
  • An isolated full Gateway with a real agent/runtime and deterministic local Responses SSE provider passed a write-positive-control, then canceled active and queued app-origin runs after signed SQLite removal. The queued input never reached the provider, the app owner remained active, and attempted late delivery produced no file writes. An independent ordinary person app observed the results through real Gateway methods.
  • Focused core and plugin tests passed, including recovery and operator-run siblings. Production, Gateway-test, and extension-test typechecks, targeted lint/format, full build, affected-plugin import profiling, SDK export checks, docs MDX checks, test-line ratchet, and diff checks passed. Post-lint corrections were covered by focused regression and plugin replays.
  • A supplemental final-effect proof passed on the same head: the live agent write parsed from the local Responses stream and a real host-capability write under a restored serialized app-run snapshot were held at the existing filesystem admission hook. Both had successful write controls. Signed removal persisted before either hook resumed; both original files remained unchanged, restored execution refused with tool invocation authority is no longer active, fresh restore was refused, and the independent person app remained usable. The app owner stayed active and the removal receipt reported runsCancelled: 0. One test passed (7.98 seconds test time; 20.69 seconds with the prepared runner).
  • Local autoreview against base abe2e7af7a82b38f522478cf73522d622926bf63, covering the complete candidate committed as 78b4d953dbd8985eba02bea7d3f112b987c53056, reported scoped-clean at P0–P2 with no actionable findings. The reviewer assessed the supplied diff and owner context without executing project tests. Local ClawSweeper was unavailable. Hosted ClawSweeper follow-up reviewed the same head against main d7f88abfaacfab0cecdf064c98853bf6be3ea3b1, accepted the live/restored final-effect evidence and preview rollout, and reported no findings or remaining before-merge requests. The review run completed successfully. It did not execute target code.
  • Exact-head CI succeeded. All PR checks settled without failures; no source changes followed local review or CI.

Selected output from the final-effect proof (synthetic fixtures; identifiers omitted):

{
  "realAgentPositiveWrite": true,
  "liveParsedWriteReachedFilesystemAdmission": true,
  "restoredSerializedRealRunSnapshot": true,
  "restoredPositiveWrite": true,
  "restoredPreparedWriteReachedFilesystemAdmission": true,
  "signedRemovalPersistedBeforeResumption": true,
  "appOwnerStillActive": true,
  "liveOriginalBytesPreserved": true,
  "restoredOriginalBytesPreserved": true,
  "restoredRefusal": "Error: tool invocation authority is no longer active",
  "freshRestoreRefused": true,
  "independentPersonStillUsable": true,
  "removalRunsCancelled": 0
}

Upgrade scope: OpenClaw ID is an internal preview with an explicit revoke/reapprove rollout for old ID-origin grants. A latest-stable migration is outside this change's agreed scope. No SQLite schema or configuration fields change. Existing owner/person grant parsing and relay identity behavior remain; the passing state suite covers their store reloads, and the new delegated grant also survives a store reload. This is store/reconstruction evidence, not a latest-stable upgrade claim.

Runtime limits: the agent proofs used direct core app binding; plugin consent and persisted grants were covered separately. Restored final-effect execution used the real host capability and reconstructed serialized app-run authority rather than a restarted agent process. Only admission timing uses an existing fs-safe test hook; the tool executor, membership owner, signed removal service, and filesystem authority guard are unmodified. The earlier provider-held proof established cancellation and queue withdrawal; the additional proof reaches filesystem admission before removal and resumes after removal. No deployed Gateway, Discovery, live OIDC, QUIC, or full process-restart proof. Recovery coverage recreates and hydrates the authority and reloads serialized grants; it does not claim a deployed restart.

@clawsweeper

clawsweeper Bot commented Nov 9, 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 gateway Gateway runtime plugin: mcp-relay labels Nov 9, 2026
@joshavant
joshavant marked this pull request as ready for review November 9, 2026 21:50
@joshavant

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

Please review the current head, including original ID admission across connected-app approvals, transitive approvals, live bindings and restored work, while preserving independent local roles and approvals.

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR binds connected-app approvals to the original OpenClaw ID membership across delegated approvals, active access, and restored work.

Example: The relay-member account approves an app while its profile also has a local admin role, then its ID membership is removed.

  • Before: The app can retain access through the surviving local role.
  • After: The original app and apps it approved lose access, while an independently approved app for the same profile remains usable.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused authority repair with meaningful boundary regressions and sufficient live/restored final-effect evidence; accepted preview reapproval and unchanged legacy parsing resolve the previous upgrade request.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The isolated full Gateway exercised a real agent/runtime with a local Responses SSE provider, successful write controls, and signed membership removal; supplemental output shows live and restored prepared writes refused at filesystem admission while independent access survives, resolving the prior final-effect request. Restored proof reconstructs serialized authority rather than restarting an agent process; inspected screenshots belong to precursor PRs and add no current-path coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Removing an approving ID membership can leave its connected apps authorized through an independent local role.
Reason: This restores the intended principal-bound authorization contract, and the maintainer-authored direction explicitly accepts the preview rollout.

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete authorization-lifetime bug and remains worth merging; no actionable source defects were found, and the new evidence resolves the previous final-effect and rollout concerns.

Priority: P2
Reviewed head: 78b4d953dbd8985eba02bea7d3f112b987c53056

Before merge

None.

Findings

None.

Agent review details

How this fits together

MCP relay stores app consent and supplies principals to Gateway ingress; core combines those principals with live membership, profile, role, and grant authority before RPC, browser access, and retained effects.

flowchart TD
  A[Authenticated ID caller] --> B[Core admission capture]
  B --> C[Relay grant store]
  C --> D[Live binding or recovery]
  E[Membership authority] --> D
  D --> F[Gateway RPC and browser]
  D --> G[Retained execution and final effects]
Loading

Technical review

Best possible solution:

Retain the original admission in local consent and reuse core membership checks throughout live and restored execution, with the documented revoke/reapprove preview rollout.

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

Current-main source loses the approving membership in relayCaller, and the supplied base regression reports successful app RPC after signed member removal; this read-only review did not execute target code.

Is this the best way to solve the issue?

The patch restores the missing authority link at consent capture and composes the existing membership owner into live and restored access without introducing a competing membership manager.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d7f88abfaacf.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d46497e adds extensions/mcp-relay/src/caller.ts:40 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d46497e0f67c; files: extensions/mcp-relay/src/caller.ts)
  • Josh Lehman: Raw commit 59b8a11 adds src/gateway/server/client-identity-types.ts:49 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 59b8a114bf6d; files: src/gateway/server/client-identity-types.ts)
  • RoboClaw: Raw commit 56753f7 adds src/gateway/operator-run-recovery.ts:128 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 56753f7762a7; files: src/gateway/operator-run-recovery.ts)

PR surface

Source +197, Tests +454, Docs +25, Other +2. Total +678 across 20 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 11 242 45 +197
Tests 6 539 85 +454
Docs 2 25 0 +25
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 20 808 130 +678

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus regression growth Production +242/-45; tests and support +539/-85 The net production growth carries original admission through existing owners; distinct consent, revocation, recovery, persistence, and disclosure boundaries justify the regression growth.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: 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:

  • P2: The defect affects optional connected-app authorization after ID membership removal when independent local authority survives.
  • merge-risk: 🚨 compatibility: The SDK adds a delegated-person principal and capture helper; older hosts reject that principal, while the maintainer accepts explicit reapproval for legacy preview grants.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-09T22:06:19.267Z sha 78b4d95 :: needs real behavior proof before merge. :: none

Reviewed November 9, 2026, 5:18 PM ET / 22:18 UTC (Revision 2).

@joshavant

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

The current head is unchanged. The PR body now includes the completed live/restored final-effect proof and selected runtime output: both prepared writes reached filesystem admission before signed membership removal and resumed afterward; original bytes were preserved and restored execution refused before I/O. Allowed controls passed, the app owner stayed active, and an independent approval remained usable.

Please reassess the final-effect attention item against that evidence. The body also clarifies the agreed internal-preview rollout and the existing owner/person store-reload proof. A latest-stable migration is outside the maintainer-selected scope; no schema or configuration fields change. Full process-restart and deployed-service qualification remain explicit limits.

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 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. labels Nov 9, 2026
@joshavant
joshavant merged commit a477dfd into main Nov 9, 2026
261 checks passed
@joshavant
joshavant deleted the fix/connected-app-membership-authority branch November 9, 2026 22:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: mcp-relay proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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