Repository navigation
chore: store session member access levels and add the Participate protocol - #204783
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesAdds 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.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Partial 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. Preflight sourceSource 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
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 24, 2026, 2:16 PM ET / 19:16 UTC (Revision 2). |
…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.
9397909 to
06079d0
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…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.
Related: #202552
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:
session_members.accesscolumn. Existing rows keep null, which means "no level set" and behaves exactly like membership today. The state database schema stays at 41.openclaw database restore-migration-backupbefore opening the store with the older build.participant). Older clients ignore the optional fields. The Control UI change in this part (session-approval-projection.ts) makes the current UI ignore theparticipantphase; nothing emits it until part 3.session.members.addand chat mentions now accept an optionalaccessfield 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 withoutaccessbehave 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.setAccessparameters,member-access-changedevidence, mentionaccessandinviteAccessOptions, session rowinvitedAccessandinvitedPermission,chat.pendingInputs.ownparameters, approvalturnActorandcanDecide, 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:
sessions.maxInvitedAccessand related keys), thesetAccessand evidence handlers, mention invitations andchat.sendadmission;Schema change checkpoint
ALTER TABLE session_members ADD COLUMN access TEXT CHECK (access IS NULL OR access IN ('read','suggest','send'))(PostgreSQL: same column withCOLLATE "C"). No other table is touched. There is no rewrite, backfill or new index.session_membersonce. That table holds one row per invited person per session, so it is small even on large deployments.session_membersand the version markers.mainbefore pushing. No merged change claims agent schema 44. feat: notify users when they arrive or leave, using device location updates #200867 (open, unmerged) also proposes 44; whichever lands second renumbers.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 tagv2026.11.8(2d4ab29); the release ships agent schema 38 and state schema 36. I built this branch at06079d0, 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'sscripts/e2e/mock-openai-server.mjs). Setup used ordinary onboarding,config set, an owner and a separate non-admin member (operator.readandoperator.writeonly), 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:
Stored membership row (read-only
PRAGMAandSELECTafter each clean shutdown):user_version38 → 44,integrity_checkokboth times. The row keeps the sameidentity_id,added_byandadded_at, and gainsaccess: null.API behaviour is unchanged:
session.members.listreturns the same member array as on 2026.11.8, with noaccesskey.chat.historyhas the same message objects as before (deep-equal).status: ok,completionStatus: succeeded.ok: true.Settings: the
models,agents,gateway,browserandcronsettings 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_checkisok, the new member row hasaccess: null, and member read and send, restart and cron completion all pass.Migration tests in this PR:
src/state/openclaw-agent-member-access-migration.test.tschecks 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.src/state/openclaw-agent-db-engine.postgres.test.tsupgrades a populated store and reads the existing member withaccess: 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
main91d0339(head06079d0):session.members.addwithaccessand a mention withaccessare both rejected; plain adds and mentions still work.config/test-lines-allocations/204783-participate-member-access-storage.txtcovers the 118 over the allowance (migration on both engines, worker persistence and publication, actor memory, protocol contracts, and the two refusals).config/knip.config.tsgets a temporary, commented exception for the two sharing-store files. Part 4 removes it.accessfield 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 theopenclaw/ci-gateaggregate, 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 scheduledmainat91d0339(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 scheduledmainat46530a3(run 45448509942) and locally on base91d0339.checks-node-changed-16:test/gateway-restart-resume.e2e.test.ts"restart markers survive graceful shutdown" depends on shutdown timing. On base91d0339its 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 onmax-linesin two untouched files (extensions/crabbox/src/crabbox-worker-node-enrollment.test.tsandsrc/gateway/server-methods/chat-send-session.ts). The dead-export scan flags three untouchedextensions/beamexports.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.jsalone 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