Skip to content

chore: store session member access levels and add the Participate protocol - #204783

Merged
jalehman merged 1 commit into
mainfrom
participate-split/p1-access-storage
Nov 24, 2026
Merged

jalehman merged 1 commit into
mainfrom
participate-split/p1-access-storage

Conversation

@jalehman

@jalehman jalehman commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Related: #202552

Part 1 of 6 of the split of #202552 (invite someone to help in one session).

The six parts are meant to land in order. Review each part against the branch below it.

What Problem This Solves

Session sharing today only knows whether someone is a member of a session. #202552 lets a creator invite a person to one session at a level: can read, can suggest, or can send. That needs somewhere to store the level per member and protocol fields to carry it, before any of the behaviour that uses it can be reviewed on its own.

User Impact

User impact: none visible yet. This part only stores and transports member access levels. Nothing in the Gateway sets a level or reads one to make a decision until part 4. Existing sessions and memberships behave as they do today.

What does reach every upgraded Gateway, opted in or not:

  • Agent database migration 43 → 44. On first open, the agent database adds a nullable session_members.access column. Existing rows keep null, which means "no level set" and behaves exactly like membership today. The state database schema stays at 41.
  • Downgrade. As with every agent schema bump, an older build refuses the newer database. To roll back, stop writers and restore the scoped migration backup with openclaw database restore-migration-backup before opening the store with the older build.
  • Protocol. New optional fields and one new approval event phase (participant). Older clients ignore the optional fields. The Control UI change in this part (session-approval-projection.ts) makes the current UI ignore the participant phase; nothing emits it until part 3.
  • Access levels are refused, not ignored. session.members.add and chat mentions now accept an optional access field in the schema. Until part 4 enforces levels, the Gateway rejects a request that sets it, so a client cannot ask for a read-only invite and silently get full membership. Requests without access behave as before.

Why This Change Was Made

The storage and protocol layer has no behaviour of its own, so it can be reviewed and land first. That also reserves agent schema 44 early, which keeps later parts from having to renumber the migration. The level is written only by the existing membership writer, in the same sharing-worker transaction and through the same collaboration facts as other membership changes. Readers omit the access map entirely when no member has a level, so ordinary sharing payloads don't change.

All protocol schema for the stack is in this part, in one regeneration. It covers the session.members.setAccess parameters, member-access-changed evidence, mention access and inviteAccessOptions, session row invitedAccess and invitedPermission, chat.pendingInputs.own parameters, approval turnActor and canDecide, and the participant approval event. The approval-recipient capability itself is defined and advertised in part 3. Later parts then don't have to regenerate the protocol output on every rebase. The new request methods have protocol keys but no Gateway handlers until part 4, so calling them is refused the same way as any other unknown method.

Still inert until later parts:

  • part 2 enforces the limits on admitted runs (tools, exec, files, children, queued work, recovery);
  • part 3 routes a participant's exec approvals to the session creator;
  • part 4 is the opt-in: role config (sessions.maxInvitedAccess and related keys), the setAccess and evidence handlers, mention invitations and chat.send admission;
  • part 5 adds shared GitHub publication;
  • part 6 adds the Control UI.
Schema change checkpoint

Evidence

Existing data after the 43 → 44 upgrade

Released Gateway → this branch, same state directory. I installed the published [email protected] from npm. Its build info matches tag v2026.11.8 (2d4ab29); the release ships agent schema 38 and state schema 36. I built this branch at 06079d0, then ran both through their real CLI and Gateway entry points on one isolated state directory. Only the model provider was a loopback mock (the repository's scripts/e2e/mock-openai-server.mjs). Setup used ordinary onboarding, config set, an owner and a separate non-admin member (operator.read and operator.write only), and authenticated Gateway RPCs. There were no SQL fixture writes.

  • On 2026.11.8: the owner created a session and added the member with session.members.add. The member sent a turn and got a completed model reply. The owner added a cron job. Then the Gateway shut down cleanly.

  • On this branch: startup migrated the agent database 38 → 44 and the state database 36 → 41 through the normal chain, keeping the previous files:

    [state/upgrade] Upgrading state to 2026.11.8: state/openclaw.sqlite v36, agents/main/agent/openclaw-agent.sqlite v38
    [state/upgrade] State upgraded to 2026.11.8 by migration chain; previous files kept as *.pre-2026.11.8-06079d0f5182-…
    [state/agent-admission] agent database recovered after background inspection and preparation
    
  • Stored membership row (read-only PRAGMA and SELECT after each clean shutdown): user_version 38 → 44, integrity_check ok both times. The row keeps the same identity_id, added_by and added_at, and gains access: null.

  • API behaviour is unchanged:

    • session.members.list returns the same member array as on 2026.11.8, with no access key.
    • The member's chat.history has the same message objects as before (deep-equal).
    • The session is still listed, and the non-admin member sent another turn that completed.
    • The retained cron job ran to status: ok, completionStatus: succeeded.
    • Health returned ok: true.
  • Settings: the models, agents, gateway, browser and cron settings are deep-equal before and after. The config file as a whole is not byte-identical, because startup Doctor adds its usual migration bookkeeping.

Fresh store on this branch. The same flow on an empty state directory with only this build creates agent schema 44 directly. integrity_check is ok, the new member row has access: null, and member read and send, restart and cron completion all pass.

Migration tests in this PR:

  • SQLite: src/state/openclaw-agent-member-access-migration.test.ts checks the 43 → 44 step. It commits and rolls back atomically without changing existing grants, restores the scoped predecessor backup without losing unrelated writes, and registers an exact consecutive PostgreSQL migration.
  • PostgreSQL: src/state/openclaw-agent-db-engine.postgres.test.ts upgrades a populated store and reads the existing member with access: null. It also checks that the constraint rejects invalid levels. Its case "upgrades v42 pending-input endings (absent optional table: false)" passed against a real PostgreSQL server in this head's "PostgreSQL conformance (3/4)" CI job.

Not covered: a restored downgrade to the older build, and an upgrade on a live PostgreSQL deployment.

Other checks

Checked on this branch, rebased onto main 91d0339 (head 06079d0):

  • Migration: SQLite 43 → 44 commits and rolls back atomically without changing existing grants. Restoring the scoped backup keeps unrelated writes. The PostgreSQL step is registered as an exact consecutive migration. Older-schema fixtures (cold navigation, memory revision, pending inputs, schema 21) still converge.
  • Storage: setting a member's level persists through the sharing worker and is published to session collaboration facts and actor memory. Ordinary members without a level round-trip unchanged.
  • Protocol: the new parameter, row, mention and approval schemas validate, and the method list and validation contract tests pass with the new request keys and no descriptors.
  • Typechecks: core, UI, scripts, core test shards, extension tests and root tests.
  • Repository checks: lint and format on changed files; regenerated protocol, Control UI validators, PostgreSQL catalogs, worker inventory and session schema baseline (all reproduce byte-for-byte); import cycles; Vitest inventory ownership.
  • Refusals: session.members.add with access and a mention with access are both rejected; plain adds and mentions still work.
  • Test-line budget: +518 net test lines. config/test-lines-allocations/204783-participate-member-access-storage.txt covers the 118 over the allowance (migration on both engines, worker persistence and publication, actor memory, protocol contracts, and the two refusals).
  • Dead exports: the member-access writers have no production caller until part 4, so config/knip.config.ts gets a temporary, commented exception for the two sharing-store files. Part 4 removes it.
  • Review: an independent review looked for P0–P2 issues and for behaviour changes for people who don't opt in. It found two, both fixed here. First, two perf scripts used row fields from a later part, which broke the scripts typecheck; those lines moved to part 4. Second, an access field was accepted but ignored; it is now refused. With those fixes, the review found no other change for non-opt-in users beyond the migration.

Inherited CI failures at 06079d0 (run 45460456609). The three failed jobs, plus the openclaw/ci-gate aggregate, are not caused by this branch:

  • checks-node-changed-compact-small-3: test/scripts/ci-node-test-plan.test.ts "prices serial Gateway server measurements…" fails the same way on scheduled main at 91d0339 (run 45459852166) and locally on that base.
  • checks-node-changed-compact-large-16-2: chat-send-session-binding.test.ts "grants skill authoring to the first message typed after a Control UI reconnect" fails the same way on scheduled main at 46530a3 (run 45448509942) and locally on base 91d0339.
  • checks-node-changed-16: test/gateway-restart-resume.e2e.test.ts "restart markers survive graceful shutdown" depends on shutdown timing. On base 91d0339 its sibling case fails at the next shutdown checkpoint; on this head both cases pass locally.

None of these tests, or the code they test directly, are changed here.

Local checks, also inherited from main: repository-wide lint fails on max-lines in two untouched files (extensions/crabbox/src/crabbox-worker-node-enrollment.test.ts and src/gateway/server-methods/chat-send-session.ts). The dead-export scan flags three untouched extensions/beam exports.

Size: 111 files, +12,892 / −11,482. Most of that is regenerated output: protocol predicates and validators (including the Control UI copies), PostgreSQL catalogs and the worker inventory. predicates.js alone accounts for about 21k changed lines, because new patterns renumber its lookup table. Without generated files, the change is 96 files, +1,427 / −207.

PostgreSQL tests skip locally without a database; CI runs them.

🦞 Made with OpenClaw

@clawsweeper

clawsweeper Bot commented Nov 24, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts commands Command implementations size: XL labels Nov 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature 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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 24, 2026
@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds nullable per-member access storage and protocol fields for later participation enforcement.

Example: An existing membership for reader is upgraded from agent schema 43 to 44.

  • Before: The row stores identity, inviter, and invitation time.
  • After: Those values remain intact, with access null preserving existing membership behavior.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Coherent storage groundwork with supported upgrade compatibility, intentionally delivering only part of the linked participation feature.
Proof confidence 🐚 platinum hermit (4/6) The maintainer-authored prerequisite is outside the ordinary contributor proof gate; its body supplies exact-head CLI/Gateway upgrade logs and fresh-store results, while the inspected linked screenshots concern other changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Partial
User problem: Session creators need to invite a teammate at a particular participation level within one conversation.
Reason: The maintainer-authored direction authorizes this independently reviewable prerequisite and its migration tradeoff; the broader feature is correctly linked with Related.

Merge readiness

✅ Ready for maintainer review

Keep this PR open as useful, maintainer-directed groundwork for session participation; source review found no concrete introduced correctness defect.

Priority: P2
Reviewed head: 06079d0f5182a25130c13b33b8ffeb31afa648d9

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway sharing handlers use the existing collaboration worker to update agent storage and publish committed membership facts to session actors and Gateway projections.

flowchart LR
  A[Gateway clients] --> B[Sharing handlers]
  B --> C[Collaboration worker]
  C --> D[Agent database]
  C --> E[Session actors]
  C --> F[Membership projections]
Loading

Technical review

Best possible solution:

Land the storage prerequisite through the existing membership owners, leaving participation enforcement and controls to the later stack stages.

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

This is a staged feature addition; current main lacks per-member access storage, and this read-only review ran no target code.

Is this the best way to solve the issue?

A nullable column carried through existing membership transactions, actors, and committed facts is a coherent foundation without a competing authority owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 79ad8cc adds src/gateway/session-membership-projection.ts:73 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 79ad8cc6e7e3; files: src/gateway/session-membership-projection.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

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
Persisted contract Agent schema 43 → 44; state schema stays 41 Adds one nullable session_members.access column to every upgraded agent store, including stores that never enable participation.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Useful groundwork for optional session collaboration without a demonstrated urgent runtime regression.
  • merge-risk: 🚨 compatibility: The explicitly accepted schema bump requires backup restoration before an older binary can reopen an upgraded agent store.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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.

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-24T17:17:37.691Z sha 9397909 :: blocked before merge. :: none

Reviewed November 24, 2026, 2:16 PM ET / 19:16 UTC (Revision 2).

@openclaw-barnacle openclaw-barnacle Bot reopened this Nov 24, 2026
…tocol

Part 1 of 6 of the split of #202552. Adds agent schema v44 with a
nullable session_members.access column, member-access storage through
the sharing worker, actor memory and collaboration facts, and all
Participate protocol schema. Levels are not enforced yet, so member add
and mentions refuse an access field until the admission part lands.
@jalehman

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 24, 2026
@jalehman
jalehman merged commit 5e5ecba into main Nov 24, 2026
278 of 283 checks passed
@jalehman
jalehman deleted the participate-split/p1-access-storage branch November 24, 2026 19:44
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

@obviyus

obviyus commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Withdrawn: no change to #204783 is needed. The reader-floor rule in #204956 will treat a nullable column whose CHECK accepts NULL as additive. Then step 44 does not raise min_reader, and an older reader can open it without a copy. That PR adds a test that uses step 44 itself.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…tocol (openclaw#204783)

Part 1 of 6 of the split of openclaw#202552. Adds agent schema v44 with a
nullable session_members.access column, member-access storage through
the sharing worker, actor memory and collaboration facts, and all
Participate protocol schema. Levels are not enforced yet, so member add
and mentions refuse an access field until the admission part lands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui commands Command implementations 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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.

2 participants