Repository navigation
feat: let invited people read, suggest or send in your session within role limits - #204899
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 changesThis PR lets session creators grant individual invitees read, suggest, or bounded send access within their role limits. Example: Alice has operator.sessions.read and an invited role capped at send.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review This PR provides a useful, maintainer-approved invitation capability that current main still lacks; no concrete blocking code defect was established. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway authorization combines authenticated identity, role policy, session membership, and connection scopes to admit bounded agent turns and session interactions. flowchart TD
A[Authenticated client] --> B[Method scope admission]
C[Role policy and membership] --> D[Session access resolution]
B --> D
D --> E[Captured participation ceiling]
E --> F[Agent and queued work]
D --> G[Session reads and collaboration]
Technical reviewBest possible solution: Keep bounded admission in the existing sharing and run-authority owners, preserving ordinary membership behavior and the separately staged UI and publication work. Do we have a high-confidence way to reproduce the issue? This is a feature addition; current-main source independently confirms that explicit invitation levels are still refused. Is this the best way to solve the issue? The coherent admission stage reuses existing membership storage and participant enforcement, with distinct coverage for scopes, cancellation, recovery, children, and ordinary-user compatibility. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 71b629c5f86e. 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 (7 earlier review cycles)
Reviewed November 25, 2026, 5:37 AM ET / 10:37 UTC (Revision 8). |
8522540 to
ed48a7c
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
6c74d16 to
3aa15c8
Compare
ed48a7c to
0fabada
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
CI attribution for head
Both should clear when the stack is rebased onto current Data-model compatibility: the PR body's "Upgrade from the released 2026.11.8" section covers this. It ran the published
This PR adds no schema; the |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…ot found (#205698) #204899 routes chat.send from a session-read personal profile through session participation, which refuses a session the person can no longer join with the hidden not-found error instead of a missing operator.write scope. The test still expected the scope refusal and failed on main.
… role limits (openclaw#204899) * feat: let invited people read, suggest or send in your session within role limits * chore: name the test-line allocation after its pull request * test: give Talk handler fixture clients their connection scopes * docs: list only the participant tools available before shared publication * test: select replayed participant approvals the way the session runtime does * test: build participant lifetime fixtures with a turn grant * test: import system turn authority from its admission owner * test: expect the shared-publication requester to refuse participants before part 5 * test: prove stored roles and unlevelled members keep their sharing behavior
…ot found (openclaw#205698) openclaw#204899 routes chat.send from a session-read personal profile through session participation, which refuses a session the person can no longer join with the hidden not-found error instead of a missing operator.write scope. The test still expected the scope refusal and failed on main.
…#208578) The maintainer approved the turn-scoped Stop cascade on 2026-11-29. ## Problem Pressing Esc in the TUI, Stop on the Wear app, or Stop on a Workboard card without a recorded run stopped the agent's turn, but the subagents that turn had started kept running and spending. These clients send `chat.abort` with only a session key. On main, that call never cancels descendants. Only an exact-run `chat.abort`, `/stop` and `sessions.abort` do. The docs disagreed with each other. `docs/tools/subagents/nesting.md` promised that explicit cancellation cascades through the descendant tree. The RPC pages (`rpc-session-control.md`, `subagents/operations.md`, `control-ui/chat.md`, `session-controller.md`) documented the run-less exception, which #122909 and #133076 kept to limit the blast radius: "broad session cleanup violates sibling ownership". ## What changes A `chat.abort` without a `runId` now cancels the descendants of the runs it actually stops, the same way an exact-run Stop cancels its turn's descendants (#122909). - **Children of the stopped turn:** cancelled. Native harness children are tied to their turn's exec custody, which is captured for every selected run before any parent stops; registry children keep their spawning turn id and are selected after the runs stop. - **Work the call did not stop keeps its children:** a `/btw` side run kept by `preserveSideRuns`, another person's run, a worker run the call does not cancel, and children an earlier, finished turn started. `sessions.abort` and `/stop` still stop all of those. - **A yielded parent or a dormant child:** no turn is running, so a run-less `chat.abort` stops nothing there, as before. `sessions.abort` stops that paused work. - **Invited participants:** a participant may stop only their own runs (#204899). Their Stop, run-less or exact-run, now also cancels those runs' children, and never another member's. Before this change a participant's Stop never cancelled children, even with an exact run id. - **`/stop` and `sessions.abort`** keep their whole-session cascade. When it is blocked (for example, while a hidden run is active), they now stop at least the stopped turns' children instead of none. - **Permissions:** unchanged. Anyone who could stop a run before still can, and the cascade reaches only the descendants of runs that caller stopped. The owner is `abortChatRunsForSessionKeyWithPartials`. For an explicit user Stop (`announceRunStopped`) that is not a whole-session Stop, it captures the exec custody of every run the plan selected, stops the runs, then runs the exact-run descendant cancellation for each run that actually stopped. Native harness children follow their turn's exec custody, which ends when the turn unwinds, so it is captured before any parent stops. Worker-placement reclaim, session drain and queued-input discard do not mark an explicit Stop, so they cancel no descendants. There is no protocol, schema or config change. Docs: the four RPC pages and `nesting.md` now say the same thing. A run-less Stop is turn-scoped; `sessions.abort` and `/stop` are whole-session. ## Evidence Tests at the Gateway handler boundary, with real registry children: - `chat.abort-cascade.test.ts`, "a run-less Stop cancels only the children of the turn it stops": `preserveSideRuns` with a live `/btw`, the stopped turn's child, a child of a worker run the call does not stop, and an earlier turn's child. Only the stopped turn's child is cancelled; the `/btw` is not aborted. **Red on main, green here.** The exact-run case is the control (green on both). - `chat.abort-cascade.test.ts`, invited member, run-less and exact-run: the member's Stop cancels the child of their own turn and leaves the child of another member's turn running. **Red on main for both, green here.** - `chat.abort-cascade.test.ts`, native children: a run-less Stop that stops two live turns cancels the native harness children of both. **Red without the custody capture, green here.** - `chat.abort-cascade.test.ts`, blocked whole-session Stop: with a hidden run active, `sessions.abort`/`/stop` still cancel the stopped turn's child and leave an earlier turn's child running. **Red on main, green here.** - `sessions.abort-yielded.test.ts`: a run-less `chat.abort` on a yielded parent, and on the dormant child itself, stops nothing and leaves the paused child unchanged (control, green on both). - Gateway Stop suites: 28 files, 665 tests, plus the real-Gateway `run_stopped` hook e2e, all green. Live Gateway with a fake provider, main vs this branch, 3 runs each: | Scenario | main | this branch | |---|---|---| | Run-less `chat.abort {sessionKey}` (Wear's exact request, Workboard fallback) with a live child | child keeps running 3/3 | child killed 3/3 | | Exact-run `chat.abort` / typed `/stop` (controls) | child killed 3/3 | child killed 3/3 | | TUI Esc (`preserveSideRuns: true`) with a live `/btw`, a child of the stopped turn and a background child of an earlier turn | stopped turn's child keeps running 3/3; earlier child running; `/btw` reaches final | stopped turn's child killed 3/3; earlier child keeps running; `/btw` reaches final | | Invited send member's run-less Stop, with a child of their turn and a background child of the owner's earlier turn | member's child keeps running 3/3 | member's child killed 3/3; owner's child keeps running | Not benchmark-shaped: the change is in the one Stop owner, with no client, model or provider branches. ## Merge danger Two-way door: a revert fully restores the old behavior. Nothing is written, migrated or published differently, and the RPC schema is unchanged. Blast radius: every client that sends a run-less `chat.abort` (TUI Esc, Wear, the Workboard fallback, Android) now also stops the stopped turn's subagents. A user who presses Esc while a turn waits on `sessions_yield` still has to use `/stop` to end those children. Co-authored-by: Ayaan Zaidi <[email protected]>
…#208578) The maintainer approved the turn-scoped Stop cascade on 2026-11-29. ## Problem Pressing Esc in the TUI, Stop on the Wear app, or Stop on a Workboard card without a recorded run stopped the agent's turn, but the subagents that turn had started kept running and spending. These clients send `chat.abort` with only a session key. On main, that call never cancels descendants. Only an exact-run `chat.abort`, `/stop` and `sessions.abort` do. The docs disagreed with each other. `docs/tools/subagents/nesting.md` promised that explicit cancellation cascades through the descendant tree. The RPC pages (`rpc-session-control.md`, `subagents/operations.md`, `control-ui/chat.md`, `session-controller.md`) documented the run-less exception, which #122909 and #133076 kept to limit the blast radius: "broad session cleanup violates sibling ownership". ## What changes A `chat.abort` without a `runId` now cancels the descendants of the runs it actually stops, the same way an exact-run Stop cancels its turn's descendants (#122909). - **Children of the stopped turn:** cancelled. Native harness children are tied to their turn's exec custody, which is captured for every selected run before any parent stops; registry children keep their spawning turn id and are selected after the runs stop. - **Work the call did not stop keeps its children:** a `/btw` side run kept by `preserveSideRuns`, another person's run, a worker run the call does not cancel, and children an earlier, finished turn started. `sessions.abort` and `/stop` still stop all of those. - **A yielded parent or a dormant child:** no turn is running, so a run-less `chat.abort` stops nothing there, as before. `sessions.abort` stops that paused work. - **Invited participants:** a participant may stop only their own runs (#204899). Their Stop, run-less or exact-run, now also cancels those runs' children, and never another member's. Before this change a participant's Stop never cancelled children, even with an exact run id. - **`/stop` and `sessions.abort`** keep their whole-session cascade. When it is blocked (for example, while a hidden run is active), they now stop at least the stopped turns' children instead of none. - **Permissions:** unchanged. Anyone who could stop a run before still can, and the cascade reaches only the descendants of runs that caller stopped. The owner is `abortChatRunsForSessionKeyWithPartials`. For an explicit user Stop (`announceRunStopped`) that is not a whole-session Stop, it captures the exec custody of every run the plan selected, stops the runs, then runs the exact-run descendant cancellation for each run that actually stopped. Native harness children follow their turn's exec custody, which ends when the turn unwinds, so it is captured before any parent stops. Worker-placement reclaim, session drain and queued-input discard do not mark an explicit Stop, so they cancel no descendants. There is no protocol, schema or config change. Docs: the four RPC pages and `nesting.md` now say the same thing. A run-less Stop is turn-scoped; `sessions.abort` and `/stop` are whole-session. ## Evidence Tests at the Gateway handler boundary, with real registry children: - `chat.abort-cascade.test.ts`, "a run-less Stop cancels only the children of the turn it stops": `preserveSideRuns` with a live `/btw`, the stopped turn's child, a child of a worker run the call does not stop, and an earlier turn's child. Only the stopped turn's child is cancelled; the `/btw` is not aborted. **Red on main, green here.** The exact-run case is the control (green on both). - `chat.abort-cascade.test.ts`, invited member, run-less and exact-run: the member's Stop cancels the child of their own turn and leaves the child of another member's turn running. **Red on main for both, green here.** - `chat.abort-cascade.test.ts`, native children: a run-less Stop that stops two live turns cancels the native harness children of both. **Red without the custody capture, green here.** - `chat.abort-cascade.test.ts`, blocked whole-session Stop: with a hidden run active, `sessions.abort`/`/stop` still cancel the stopped turn's child and leave an earlier turn's child running. **Red on main, green here.** - `sessions.abort-yielded.test.ts`: a run-less `chat.abort` on a yielded parent, and on the dormant child itself, stops nothing and leaves the paused child unchanged (control, green on both). - Gateway Stop suites: 28 files, 665 tests, plus the real-Gateway `run_stopped` hook e2e, all green. Live Gateway with a fake provider, main vs this branch, 3 runs each: | Scenario | main | this branch | |---|---|---| | Run-less `chat.abort {sessionKey}` (Wear's exact request, Workboard fallback) with a live child | child keeps running 3/3 | child killed 3/3 | | Exact-run `chat.abort` / typed `/stop` (controls) | child killed 3/3 | child killed 3/3 | | TUI Esc (`preserveSideRuns: true`) with a live `/btw`, a child of the stopped turn and a background child of an earlier turn | stopped turn's child keeps running 3/3; earlier child running; `/btw` reaches final | stopped turn's child killed 3/3; earlier child keeps running; `/btw` reaches final | | Invited send member's run-less Stop, with a child of their turn and a background child of the owner's earlier turn | member's child keeps running 3/3 | member's child killed 3/3; owner's child keeps running | Not benchmark-shaped: the change is in the one Stop owner, with no client, model or provider branches. ## Merge danger Two-way door: a revert fully restores the old behavior. Nothing is written, migrated or published differently, and the RPC schema is unchanged. Blast radius: every client that sends a run-less `chat.abort` (TUI Esc, Wear, the Workboard fallback, Android) now also stops the stopped turn's subagents. A user who presses Esc while a turn waits on `sessions_yield` still has to use `/stop` to end those children. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 9da8ce6) Release adaptation: keep the stable exact-run owner and use already admitted authorization. Capture direct and native descendants before unwind, deduplicate by canceled turn and cascade only for successful cancellation. Companion audit: search, partial text and digest fixes are independent; TUI stop-all and hint changes are separate behavior. Co-authored-by: RomneyDa <[email protected]>
…#208578) The maintainer approved the turn-scoped Stop cascade on 2026-11-29. ## Problem Pressing Esc in the TUI, Stop on the Wear app, or Stop on a Workboard card without a recorded run stopped the agent's turn, but the subagents that turn had started kept running and spending. These clients send `chat.abort` with only a session key. On main, that call never cancels descendants. Only an exact-run `chat.abort`, `/stop` and `sessions.abort` do. The docs disagreed with each other. `docs/tools/subagents/nesting.md` promised that explicit cancellation cascades through the descendant tree. The RPC pages (`rpc-session-control.md`, `subagents/operations.md`, `control-ui/chat.md`, `session-controller.md`) documented the run-less exception, which #122909 and #133076 kept to limit the blast radius: "broad session cleanup violates sibling ownership". ## What changes A `chat.abort` without a `runId` now cancels the descendants of the runs it actually stops, the same way an exact-run Stop cancels its turn's descendants (#122909). - **Children of the stopped turn:** cancelled. Native harness children are tied to their turn's exec custody, which is captured for every selected run before any parent stops; registry children keep their spawning turn id and are selected after the runs stop. - **Work the call did not stop keeps its children:** a `/btw` side run kept by `preserveSideRuns`, another person's run, a worker run the call does not cancel, and children an earlier, finished turn started. `sessions.abort` and `/stop` still stop all of those. - **A yielded parent or a dormant child:** no turn is running, so a run-less `chat.abort` stops nothing there, as before. `sessions.abort` stops that paused work. - **Invited participants:** a participant may stop only their own runs (#204899). Their Stop, run-less or exact-run, now also cancels those runs' children, and never another member's. Before this change a participant's Stop never cancelled children, even with an exact run id. - **`/stop` and `sessions.abort`** keep their whole-session cascade. When it is blocked (for example, while a hidden run is active), they now stop at least the stopped turns' children instead of none. - **Permissions:** unchanged. Anyone who could stop a run before still can, and the cascade reaches only the descendants of runs that caller stopped. The owner is `abortChatRunsForSessionKeyWithPartials`. For an explicit user Stop (`announceRunStopped`) that is not a whole-session Stop, it captures the exec custody of every run the plan selected, stops the runs, then runs the exact-run descendant cancellation for each run that actually stopped. Native harness children follow their turn's exec custody, which ends when the turn unwinds, so it is captured before any parent stops. Worker-placement reclaim, session drain and queued-input discard do not mark an explicit Stop, so they cancel no descendants. There is no protocol, schema or config change. Docs: the four RPC pages and `nesting.md` now say the same thing. A run-less Stop is turn-scoped; `sessions.abort` and `/stop` are whole-session. ## Evidence Tests at the Gateway handler boundary, with real registry children: - `chat.abort-cascade.test.ts`, "a run-less Stop cancels only the children of the turn it stops": `preserveSideRuns` with a live `/btw`, the stopped turn's child, a child of a worker run the call does not stop, and an earlier turn's child. Only the stopped turn's child is cancelled; the `/btw` is not aborted. **Red on main, green here.** The exact-run case is the control (green on both). - `chat.abort-cascade.test.ts`, invited member, run-less and exact-run: the member's Stop cancels the child of their own turn and leaves the child of another member's turn running. **Red on main for both, green here.** - `chat.abort-cascade.test.ts`, native children: a run-less Stop that stops two live turns cancels the native harness children of both. **Red without the custody capture, green here.** - `chat.abort-cascade.test.ts`, blocked whole-session Stop: with a hidden run active, `sessions.abort`/`/stop` still cancel the stopped turn's child and leave an earlier turn's child running. **Red on main, green here.** - `sessions.abort-yielded.test.ts`: a run-less `chat.abort` on a yielded parent, and on the dormant child itself, stops nothing and leaves the paused child unchanged (control, green on both). - Gateway Stop suites: 28 files, 665 tests, plus the real-Gateway `run_stopped` hook e2e, all green. Live Gateway with a fake provider, main vs this branch, 3 runs each: | Scenario | main | this branch | |---|---|---| | Run-less `chat.abort {sessionKey}` (Wear's exact request, Workboard fallback) with a live child | child keeps running 3/3 | child killed 3/3 | | Exact-run `chat.abort` / typed `/stop` (controls) | child killed 3/3 | child killed 3/3 | | TUI Esc (`preserveSideRuns: true`) with a live `/btw`, a child of the stopped turn and a background child of an earlier turn | stopped turn's child keeps running 3/3; earlier child running; `/btw` reaches final | stopped turn's child killed 3/3; earlier child keeps running; `/btw` reaches final | | Invited send member's run-less Stop, with a child of their turn and a background child of the owner's earlier turn | member's child keeps running 3/3 | member's child killed 3/3; owner's child keeps running | Not benchmark-shaped: the change is in the one Stop owner, with no client, model or provider branches. ## Merge danger Two-way door: a revert fully restores the old behavior. Nothing is written, migrated or published differently, and the RPC schema is unchanged. Blast radius: every client that sends a run-less `chat.abort` (TUI Esc, Wear, the Workboard fallback, Android) now also stops the stopped turn's subagents. A user who presses Esc while a turn waits on `sessions_yield` still has to use `/stop` to end those children. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 9da8ce6) Release adaptation: Use the existing Gateway descendant cancellation owner and candidate Stop admission, capture custody before cancellation and cascade only for recorded stopped runs. Do not import the main-only extracted owners or parent-notice feature. Split the new turn-scoped regressions into a sibling test to keep the existing suite below its line cap. Co-authored-by: RomneyDa <[email protected]>
…openclaw#208578) The maintainer approved the turn-scoped Stop cascade on 2026-11-29. ## Problem Pressing Esc in the TUI, Stop on the Wear app, or Stop on a Workboard card without a recorded run stopped the agent's turn, but the subagents that turn had started kept running and spending. These clients send `chat.abort` with only a session key. On main, that call never cancels descendants. Only an exact-run `chat.abort`, `/stop` and `sessions.abort` do. The docs disagreed with each other. `docs/tools/subagents/nesting.md` promised that explicit cancellation cascades through the descendant tree. The RPC pages (`rpc-session-control.md`, `subagents/operations.md`, `control-ui/chat.md`, `session-controller.md`) documented the run-less exception, which openclaw#122909 and openclaw#133076 kept to limit the blast radius: "broad session cleanup violates sibling ownership". ## What changes A `chat.abort` without a `runId` now cancels the descendants of the runs it actually stops, the same way an exact-run Stop cancels its turn's descendants (openclaw#122909). - **Children of the stopped turn:** cancelled. Native harness children are tied to their turn's exec custody, which is captured for every selected run before any parent stops; registry children keep their spawning turn id and are selected after the runs stop. - **Work the call did not stop keeps its children:** a `/btw` side run kept by `preserveSideRuns`, another person's run, a worker run the call does not cancel, and children an earlier, finished turn started. `sessions.abort` and `/stop` still stop all of those. - **A yielded parent or a dormant child:** no turn is running, so a run-less `chat.abort` stops nothing there, as before. `sessions.abort` stops that paused work. - **Invited participants:** a participant may stop only their own runs (openclaw#204899). Their Stop, run-less or exact-run, now also cancels those runs' children, and never another member's. Before this change a participant's Stop never cancelled children, even with an exact run id. - **`/stop` and `sessions.abort`** keep their whole-session cascade. When it is blocked (for example, while a hidden run is active), they now stop at least the stopped turns' children instead of none. - **Permissions:** unchanged. Anyone who could stop a run before still can, and the cascade reaches only the descendants of runs that caller stopped. The owner is `abortChatRunsForSessionKeyWithPartials`. For an explicit user Stop (`announceRunStopped`) that is not a whole-session Stop, it captures the exec custody of every run the plan selected, stops the runs, then runs the exact-run descendant cancellation for each run that actually stopped. Native harness children follow their turn's exec custody, which ends when the turn unwinds, so it is captured before any parent stops. Worker-placement reclaim, session drain and queued-input discard do not mark an explicit Stop, so they cancel no descendants. There is no protocol, schema or config change. Docs: the four RPC pages and `nesting.md` now say the same thing. A run-less Stop is turn-scoped; `sessions.abort` and `/stop` are whole-session. ## Evidence Tests at the Gateway handler boundary, with real registry children: - `chat.abort-cascade.test.ts`, "a run-less Stop cancels only the children of the turn it stops": `preserveSideRuns` with a live `/btw`, the stopped turn's child, a child of a worker run the call does not stop, and an earlier turn's child. Only the stopped turn's child is cancelled; the `/btw` is not aborted. **Red on main, green here.** The exact-run case is the control (green on both). - `chat.abort-cascade.test.ts`, invited member, run-less and exact-run: the member's Stop cancels the child of their own turn and leaves the child of another member's turn running. **Red on main for both, green here.** - `chat.abort-cascade.test.ts`, native children: a run-less Stop that stops two live turns cancels the native harness children of both. **Red without the custody capture, green here.** - `chat.abort-cascade.test.ts`, blocked whole-session Stop: with a hidden run active, `sessions.abort`/`/stop` still cancel the stopped turn's child and leave an earlier turn's child running. **Red on main, green here.** - `sessions.abort-yielded.test.ts`: a run-less `chat.abort` on a yielded parent, and on the dormant child itself, stops nothing and leaves the paused child unchanged (control, green on both). - Gateway Stop suites: 28 files, 665 tests, plus the real-Gateway `run_stopped` hook e2e, all green. Live Gateway with a fake provider, main vs this branch, 3 runs each: | Scenario | main | this branch | |---|---|---| | Run-less `chat.abort {sessionKey}` (Wear's exact request, Workboard fallback) with a live child | child keeps running 3/3 | child killed 3/3 | | Exact-run `chat.abort` / typed `/stop` (controls) | child killed 3/3 | child killed 3/3 | | TUI Esc (`preserveSideRuns: true`) with a live `/btw`, a child of the stopped turn and a background child of an earlier turn | stopped turn's child keeps running 3/3; earlier child running; `/btw` reaches final | stopped turn's child killed 3/3; earlier child keeps running; `/btw` reaches final | | Invited send member's run-less Stop, with a child of their turn and a background child of the owner's earlier turn | member's child keeps running 3/3 | member's child killed 3/3; owner's child keeps running | Not benchmark-shaped: the change is in the one Stop owner, with no client, model or provider branches. ## Merge danger Two-way door: a revert fully restores the old behavior. Nothing is written, migrated or published differently, and the RPC schema is unchanged. Blast radius: every client that sends a run-less `chat.abort` (TUI Esc, Wear, the Workboard fallback, Android) now also stops the stopped turn's subagents. A user who presses Esc while a turn waits on `sessions_yield` still has to use `/stop` to end those children. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #202552
Part 4 of 6 of the split of #202552 (Participate). The stack:
This PR depends on #204787 (keep a chat's client capabilities when queued messages resume after a restart), which is already merged into
main. Theserver.participation-restart-controlsuite fails without it. That fix is not part of this diff.What Problem This Solves
Today you can only share a whole session: depending on their role, other people can't see it, can read it, or can change it. You can't invite one specific person into your session to read along, suggest, or talk to the agent while staying inside limits you set. Parts 1 to 3 added the storage, the limits on participant runs and the approval routing. Nothing could admit a participant yet, so all of that stays dormant until this PR.
User Impact
Operators can now let a role accept invitations. A role opts in by setting
gateway.roles.definitions.<role>.sessions.maxInvitedAccesstogether withsessions.others: "invited". A session creator can then invite people with that role at one of three levels, up to the role's limit:read: the invitee can see the session.suggest: the invitee can also add suggestions and react.send: the invitee can talk to the agent in your session.invitedPermissionand its participant tools (invitedTools, or the defaults plusinvitedAlsoAllow).Part 1 stored access levels but refused invitations with a level (
session.members.addor a mention withaccess), because nothing enforced levels yet. This PR enforces them and removes those refusals. A level above the invitee role's limit is still refused, and so is any level for a role withoutmaxInvitedAccess.Other changes for invitations:
session.members.setAccess, or remove the member. Lowering a member's level or removing them cancels their queued inputs.chat.pendingInputs.own).Roles without
maxInvitedAccesskeep today's sharing behavior, apart from these small visible differences:operator.writethat callschat.send,chat.abort,session.typing,session.suggestions.add, or asessions.patchthat only narrows permissions.operator.write.Session "<key>" was not found.Session "<key>" was not found., because the sharing check runs first.sessions.others: "invited", the OpenClaw ID People page now reads "Only sessions they’re invited to". Before, the description was missing.Still inactive until later parts:
github_publishonly becomes a default participant tool in part 5, so until then the publication path refuses participants.Why This Change Was Made
The stack follows one rule: restrict before admitting. Parts 2 and 3 act only on runs that carry a participation limit. This PR is the switch that creates that limit, and only for roles that opt in.
Access levels and send admission ship together. The level checks for
chat.send, typing and suggestions live in the same admission code as sending. If they were split, areadorsuggestmember could briefly start turns.This PR also carries the Gateway end-to-end suites for the whole participant path: spawn, children, descendant restart, restart control, recovery, approval delivery and configured tools. These suites need an invitation that can admit a run, so they can't run before this PR. It also includes four test cases that part 2 left for this PR for the same reason: participant sources, recovery narrowing, the literal-command restore, and the foreign scope-child refusal. Session access resolution reads the caller's connection scopes, so the Talk handler test fixtures now give their fake clients scopes, as real clients always have. Participant test fixtures build operator authority with a turn grant, matching the grant
mainnow requires. The test-line allocation record covers the 5,465 lines above the normal allowance.One change from the original branch closes a small information leak. When a role sets
sandbox: "required", a read-only caller without an invitation limit could tell an existing unsandboxed session from a missing one by the error it got back. Now a refused participation always reports a missing session.session-participation.test.tscovers this, and the test fails without the fix.Evidence
Upgrade from the released 2026.11.10 (latest stable)
I upgraded a real state directory from
[email protected](npm, commit6ea542fd97e2) to this branch through the shipped CLI and Gateway entry points. Only the model provider was mocked, with the repository's loopbackscripts/e2e/mock-openai-server.mjs. Setup used ordinary onboarding,config set,users.setRoleand authenticated Gateway RPCs as an owner and a separate non-admin member. No SQL fixture writes were involved. The candidate was built at4c7b1e47be90. The current head69c4268235c1adds only the test below and its test-line record, with no product code. Tests ran withumask 022and a privateTMPDIR.On 2026.11.10:
sessions.others: "suggest"(2026.11.10 offers onlynone,view,suggestandwrite).0 0 1 1 *, UTC) and force-ran it once.queued.On this branch, same state directory and config, before any opt-in:
gateway.rolesandcronconfig sections were unchanged.identity_id,added_byandadded_at, and the migration addedaccessasnull.session.members.listreturned the same members as on 2026.11.10.agent.waitstatusok).chat.history.ok.invitedAccess, and no stored session entry gainedparticipationCeilingordelegatedOperatorSource. The member's tool list matched 2026.11.10 except thatsession_projectis now offered. The same difference appears onmain(chore: carry and enforce participant limits on admitted runs #204847's upgrade proof), so it isn't from this PR.integrity_checkreportedokon the agent and state databases after every phase.After opting the existing role in (
others: "invited",maxInvitedAccess: "send", then a Gateway restart):chat.sendwas refused. An unlevelled member counts asreaduntil the creator sets a level.session.members.setAccesssetsend, the member's turn completed with participant tools only. It droppedcomputer,github_publish,message,openclawandsession_project, which the owner's turn still had.Version guard: this branch carries package version 2026.11.9, older than the release. The candidate Gateway therefore ran with
OPENCLAW_ALLOW_OLDER_BINARY_DESTRUCTIVE_ACTIONS=1, which skips only the version-string guard. The schema migrations ran normally.Earlier runs: the same flow passed from
[email protected], with the agent database migrated 38 → 44. A fresh state directory on this branch also passed: a member invited atsuggestwas refused forchat.sendand could send aftersetAccesstosend.Stored data this PR writes
session_members.access: part 1 added this column. This PR is the first code that writes a non-null value, and only when an opted-in role's member is invited at a level or given one withsetAccess. Existing rows staynull.maxInvitedAccess,invitedPermission,invitedToolsandinvitedAlsoAllowfields undergateway.roles.definitions.<role>.sessions. Released role definitions parse to identical objects; no defaults are injected.participationCeilingwith that participant's operator source on the session entry (operatorSources.<profileId>.participationCeiling). In the upgrade run, only the session where the participant sent after opt-in gained it.invitedAccessandinvitedPermissionon session rows are computed per viewer and are not stored.Stored-record compatibility test
session-row-invited-access.test.ts› "keeps stored roles and unlevelled member rows working as they did before invitations":othersvalue, plus main's ceiling-freeinvited, through this branch's schema. Each parses back to an identical object.access.shared,suggestandread-onlysessions, it records each member's and non-member's sharing role, send ability and workspace read ability for every role.The same test file, with its assertions unchanged, passes on the merge base
1913f57b9262and on currentmain8616182ae3f2. Stored roles and unlevelled member rows therefore keep main's behavior under this PR.Checks
All checks ran on this branch, rebased onto
mainafter parts 1 to 3 merged:max-lineserrors come frommain, inchat-send-session.tsand a Crabbox test; this PR doesn't touch either file.server.participation*Gateway suites and the Talk handler suites. On an earlier stack base,server.participation-admissionfailed once while the host was under heavy load; it passed on every run since.main. The test-line ratchet, lint, format and every core test typecheck shard pass with it.CI
4c7b1e47be90: in attempt 1 of run 45576917173, onlychecks-node-changed-1failed. The failing test wasserver-templates-trusted-plugin-approval.e2e.test.tswith "Tool settled before requesting approval", and theopenclaw/ci-gateaggregate failed with it.tools.invoke.checks-node-changed-1passed,openclaw/ci-gatepassed, and the run concludedsuccess.69c4268235c1(adds only a test and its test-line record): run 45591914107 tested the merge withmain81d69df5dcea. Five test jobs failed, plus theopenclaw/ci-gateaggregate. Every job passed except these, includingsecurity-fast.main: each of the 16 failed cases also fails onmain81d69df5dceawithout this PR, run locally from that exact commit. This PR changes none of the failing tests,src/gateway/session-companion*.ts,src/gateway/operator-run-authority.ts, orui/.checks-node-changed-compact-large-24-1: 7 cases insession-companion-ask.test.ts.checks-node-changed-compact-large-41: 4 "typed retryable" cases insession-companion-rpc.test.ts.checks-node-changed-compact-large-14-1: 3 hydration cases insession-companion-runtime.test.ts.checks-node-changed-compact-large-18-1:session-companion.test.ts› keeps the RPC source and busy slot through timed-out execution cleanup.prepareGatewayOperatorRunAuthority, as changed by refactor(gateway): decide automations rights once, as the turn grant #205173, readsclient.connect.roleon test clients that have noconnect. Side chat reports the resultingTypeErroras "Side chat could not answer right now."checks-ui-e2e (2/3):config-controls-visual.e2e.test.ts› keeps selected segmented options distinct in forced colors.🦞 Made with OpenClaw