Repository navigation
fix: restore session owner assignment for non-owner agent turns - #154239
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. |
Security-sensitive guard clearedCurrent revision: This PR no longer changes files in the maintainer security-review tier. Separate CODEOWNERS requirements still apply to security policy and enforcement files. |
|
Codex review: needs maintainer review before merge. Reviewed September 29, 2026, 9:42 PM ET / September 30, 2026, 01:42 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch lets admitted non-owner agent turns assign a visible session to a registered person or configured agent, while preserving narrower session controls and documenting the resulting owner behavior. Merge readiness✅ Ready for maintainer review Current main still withholds the sessions tool from admitted non-owner agent turns without operator-write authority. The merged visible-spawn fix covers initial ownership in a narrower case, and a maintainer explicitly confirmed that later assignment remains needed. The latest branch addresses the prior authority finding with production-boundary coverage. Priority: P2 Review scores
Verification
How this fits togetherChannel and CLI agent turns receive a Gateway-admitted tool set. A session assignment passes through the sessions tool and Gateway authorization before the existing SQLite writer stores the owner, which later session views and eligible personal-context selection consume. flowchart LR
A[Channel or CLI turn] --> B[Run admission]
B --> C[Session tool action gate]
C --> D[Gateway visibility and live authority]
D --> E[SQLite owner writer]
E --> F[Session views and later context]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +145, Tests +854, Docs +10. Total +1009 across 31 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the existing Gateway assignment writer as the single authority for owner changes and land the bounded non-owner tool path after the native merge gates pass. Do we have a high-confidence way to reproduce the issue? Yes. Current-main tool resolution excludes sessions for the described non-owner turn without operator-write authority; this review established the path from source but did not execute it. Is this the best way to solve the issue? Yes. The branch reuses the established assignment writer and handoff contract, and its real HTTP boundary test covers the previously disputed foreign-human target and forbidden callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 858993c1a41c. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Expose only responsibility assignment without Gateway-owner posture. Require affirmative owner authority for other session actions and retain standalone invocation restrictions. Co-authored-by: VACInc <[email protected]>
Keep standalone MCP attach grants outside the non-owner assignment exception. Reuse canonical CLI admission, fence execution through the existing Gateway commit guard, and prove the real HTTP-to-SQLite authority chain. Co-authored-by: VACInc <[email protected]>
5344c61 to
615cefd
Compare
|
Related to #155349, which is now merged. That change assigns a newly created visible child to the verified human requester only when the requester matches the parent session’s effective human owner. This PR remains necessary: it separately permits a live admitted non-owner agent turn to use the assignment-only |
Reconcile the original assignment-only repair with current runtime contracts. Preserve live caller authority, creator and sharing policy, and the existing assignment writer. Prove linked Discord requester creation, MCP assignment, and stored-owner readback with attach and revocation controls. Co-authored-by: steipete <[email protected]>
Integrate main through the already-landed fix for the inherited chat-attachments max-lines failure. Assignment production paths are unchanged by this integration. Co-authored-by: steipete <[email protected]>
Restrict only explicit non-owner turns to assignment while preserving existing scheduled/system management. Keep live admission mandatory for assignment without affirmative ownership, restore senderless regression fixtures, and route the real MCP server test through its existing server owner. Co-authored-by: steipete <[email protected]>
Integrate a08479a for the observed PR matrix-preflight failure. The assignment delta is unchanged, the current workflow-cap planner fits 84 GitHub and 81 hybrid jobs, and the isolated assignment/management boundary proof and affected type graphs pass on the integrated tree. Co-authored-by: steipete <[email protected]>
|
@clawsweeper re-review The senderless-management finding is fixed in 2f63d62: only explicit non-owner turns receive assignment-only actions; existing senderless management remains unchanged, and the original fixture posture is restored rather than injecting ownership. Live admission is still mandatory for assignment without affirmative ownership. The compatibility revision passed 37 boundary cases plus 60 restored management cases; the integrated current-main tree passed another 22 real Gateway/MCP/factory cases and affected type graphs. The already-landed CI repair a08479a resolves the matrix failure without depending on the separate packing PR. Native local review is READY; please review this exact corrected head. |
|
🦞👀 Re-review progress:
|
Preserve the existing general human handoff contract. Exercise an actual non-owner Discord MCP assignment to another registered human, its persisted personal bootstrap selection, and fresh requester authority without borrowing the assignee identity. Clarify the same contract in ownership and tool documentation. Include Peter's canonical assertReliabilityForcedExit export repair for the inherited CI type failure. Co-authored-by: steipete <[email protected]>
Reconcile with current main while preserving live admitted assignment, participant selection, and bounded operator controls. Co-authored-by: steipete <[email protected]>
|
Merged via squash.
|
…claw#154239) * fix: restore session owner assignment for non-owner agent turns Expose only responsibility assignment without Gateway-owner posture. Require affirmative owner authority for other session actions and retain standalone invocation restrictions. Co-authored-by: VACInc <[email protected]> * fix: require admitted authority for session handoffs Keep standalone MCP attach grants outside the non-owner assignment exception. Reuse canonical CLI admission, fence execution through the existing Gateway commit guard, and prove the real HTTP-to-SQLite authority chain. Co-authored-by: VACInc <[email protected]> * fix: preserve senderless session management Restrict only explicit non-owner turns to assignment while preserving existing scheduled/system management. Keep live admission mandatory for assignment without affirmative ownership, restore senderless regression fixtures, and route the real MCP server test through its existing server owner. Co-authored-by: steipete <[email protected]> * fix: verify handoff context and repair assignment CI Preserve the existing general human handoff contract. Exercise an actual non-owner Discord MCP assignment to another registered human, its persisted personal bootstrap selection, and fresh requester authority without borrowing the assignee identity. Clarify the same contract in ownership and tool documentation. Include Peter's canonical assertReliabilityForcedExit export repair for the inherited CI type failure. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: VACInc <[email protected]> Co-authored-by: steipete <[email protected]>
…nventory Run A (all --changed shards at a25baa1) failed 16 tests, all in fork-pinned areas. Each is TEST-DRIFT: the fork behaviour holds on 10.1 and only the test setup changed upstream. Each fix has a revert control that fails for the right reason. - attempt-prompt-context (Telegram current-message carrier, v3/v4): openclaw#163471 replaced the BEGIN/END internal-context wrapper with an "OpenClaw runtime context:" label applied at model send. The fork's carrierText still states the body. Control: without carrierText the v3 case fails on a bare "openclaw#19452:". - session-context (runtime carriers at compaction boundaries, 3, an upstream test): openclaw#161281 pins the summary exactly, and the fork's checkpoint line collides with that. The cut point is unchanged from 9.9. Controls: no checkpoint line -> 14/21; a cut between the carrier and its user -> 19/21. - pending-inputs.redrive: openclaw#163582 made listSessionPendingInputs async. Control: without the fork's terminal block, 10.1 admits a fresh turn for a committed source turn ("expected true to be false"). - agent-runner-failure-reply (3) and assistant-failure (1): the 10.1 copy from openclaw#163381, under this carry's precedent (the fork keeps its classification and takes 10.1's copy). The transport cases now also assert "not took too long"; without that, the old negatives passed with the fork code removed. assistant-failure asserts the FailoverError fields (provider, model) in place of the old text. The 9.9 build did not rotate profiles on this path either (probe at 9eea409). - owner-only-tool-stubs (4) and attempt.owner-only-tool-stubs (2): openclaw#154239 makes non-owner turns use the real `sessions` tool, limited to assign_owner, rather than denying it. Alex, 2026-10-11: take upstream's rule. The tests therefore expect every owner-only tool except `sessions` to be stubbed. openclaw#164296 makes the tool-surface bridge add the Tool Search controls itself, so the attempt test covers Tool Search off, on, and Code Mode. Controls: with the fork's stub shaping off, 5/8; with the refusal line removed, 0/4. Also adds src/agents/owner-only-tool-stub-marker.ts to scripts/pr-lib/wrapper-components.txt. tool-policy.ts has imported it since the 9.9 carry and it was never listed, which failed eager-import-closure. With the line, eager-import-closure is 18/18 and pr-wrappers 217/217.
…n and its spawned sessions openclaw#154239 (53c39cd, in v2026.10.1) gives an explicit non-owner turn the sessions tool limited to assign_owner, targeting `sessionKey ?? current`, scoped only by tools.sessions.visibility. That defaults to `all`, and sessions.assignOwner is a visibility-authorized Gateway method, so on a default config any group member who can trigger the agent can reassign the owner of every non-incognito session on the Gateway. Measured at 6757492 (non-owner channel turn, live admitted run, real in-process router and SQLite store): visibility unset (all), default agentToAgent: current, same agent (by key and by session id) and another agent's session all reassigned all + agentToAgent disabled, or agent: current and same agent reassigned tree or self: current only The owner field is written with sessions.changed; a human assignee's USER.md is selected on later turns of that session, and the assignee passes the creator-or-assignee clause for stop. Neither rh-bot nor mac-mini sets tools.sessions or tools.agentToAgent. Fix: for senderIsOwner === false, resolvePatchTarget also checks the resolved target at `tree` visibility (when the configured visibility is not already `self`), after the configured check and before the owner write. The current session (default, by key or by session id) never reaches the check; a session this conversation spawned passes it, so upstream's spawn-then- assign flow keeps working. Owner and senderless callers, and every other action, are unchanged. The non-owner tool descriptions now say "the current session or a session it spawned". Test (src/gateway/local-request-context.session-tools.non-owner-assign.test.ts, routed to the gateway database-workers project): non-owner and owner callers x visibility unset and `agent` x targets current (default, key, session id), spawned child, same agent (key, session id), other agent; each case asserts the exact set reassigned, the refusal reason, and that refused rows are untouched. 4/4. Non-owner: current and spawned child allowed, same agent and other agent refused by the new rule (other agent by `agent` visibility when configured). Owner: everything allowed except other agent under `agent`. Controls, each failing 2/4 (the non-owner cases): - check removed: same agent (key, id) and other agent come back "allowed". - check moved after the owner write: the refusal fires but the row was already written (expected {owner} to deeply equal undefined). - check moved before resolution (refuse any sessionKey): current by key and by id and the spawned child become refused. - fixture child without spawnedBy lineage: the spawned child becomes refused. Upstream: server.mcp-session-owner.test.ts 1/1 (fails 1/1 under a current-session-only rule), sessions-tool.owner 9/9, agent-tools.session-owner 3/3; sessions-tool*, owner-only stub tests 10 files 86/86; session-archive, session-rename, mcp-http.personal-authority 4 files 21/21 with this test. tsgo:core and tsgo:test:src rc=0, oxlint rc=0, oxfmt clean, prompt snapshots current, vitest config guards 515/515, check:line-cap-ratchet --base v2026.10.1^{commit} lists the same 35 pre-existing entries as at 6757492.
Related: #125057
What Problem This Solves
Fixes: an agent can create a visible work session but cannot assign it to the verified channel requester when its turn lacks Gateway-owner authority.
User Impact
Live admitted agent turns can assign responsibility to a registered person or configured agent and read back the stored owner, including for non-admin Discord requesters. Non-owner channel turns receive assignment only unless they already have operator-write authority; those operators retain their existing bounded archive, restore, and Stop controls. Settings, deletion, global group changes, and cloud-profile discovery remain owner-gated. Senderless system management and explicit tool denies are preserved.
The administrator-attested channel/profile link is still required to identify “me.” Assignment does not create identity links, grant the assignee’s privileges, change creator/sharing authority, migrate existing owners, or change conditional visible-spawn inheritance. Another registered human remains a valid handoff target under the existing UI/RPC contract. Their personal USER.md supplies preferences on later eligible turns; personal prompt selection is not a secrecy boundary or permission to access that person’s credentials.
Why This Change Was Made
Expose a narrow assignment action through the existing sessions tool, bind it to a live admitted turn, and retain the canonical assignment writer and dispatch/commit authorization checks. CLI tool projection and the final MCP grant consume the same admission. Standalone HTTP or attached sessions cannot gain assignment merely through transport binding.
The conflict repair preserves current main’s scoped session controls, multiperson user selection, personal-tool execution wrapper, and collector Stop restriction. Original contributor ancestry is retained. The previously landed CI planner and SQLite export repairs are now inherited from main; the separate row-packing PR is not a dependency.
Evidence
b0ce03d35a85(tree-identical signing of reviewed237f7e2d709c) passed 268 distinct cases across 11 files (269 executions, including one CLI replay after restoring current-main fixture cleanup). Initial selection: 266 cases / 10 files, 297.38 seconds wrapper wall. The additional multiperson selection and cleanup replay passed in 97.07 seconds wrapper wall.This is keyless, isolated Linux production-boundary proof, not live Discord/model execution or a Team deployment. No full build or full repository suite was run, and CI was not manually dispatched or rerun. Hosted review and required CI are tracked separately on the published head.
Prior regression evidence and human-target review clarification
Earlier revisions passed 382 initial focused cases, 52 channel-authority cases, 39 MCP-cache cases, 37 compatibility cases, 60 restored senderless-management cases, and a 22-case integrated replay. Those are historical scoped results, not current-head full-suite evidence. Restoring the old whole-tool owner gate reproduced missing-tool discovery; restoring the overly restrictive absent-owner predicate reproduced the real senderless list-to-archive failure. Fixed bytes passed both controls.
The hosted revision-4/5 foreign-human finding identified a reachable personal-context effect, but requester-only targets would change the existing assignment contract. The public RPC/UI permit handoffs to any registered person by an identified, appropriately scoped caller with session visibility. Assigned-owner personal-context selection was deliberately introduced in #154980; it does not select the current sender or grant the assignee’s authority.
The expanded real MCP fixture assigns a different registered administrator, reads back that owner, prepares fresh member-sender admission, and exercises the bootstrap boundary. The assignee’s preferences are selected as documented; requester metadata remains the member, senderIsOwner stays false, no operator principal is created, and personal-instructions access still requires authenticated requester authority. This joined bootstrap/admission proof remains in the current passing selection. No requester-only restriction or assignee-privilege borrowing was introduced.
Worked on by
Work sessions
View the OpenClaw team session