Repository navigation
fix: let write operators control their own sessions through agents - #160296
Conversation
Co-authored-by: VACInc <[email protected]>
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 0fc82ef1-734a-4429-8fad-403e03085288
|
🦞👀 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. Reviewed September 28, 2026, 11:09 AM ET / 15:09 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch lets agents acting for write operators archive, restore, and stop eligible sessions through Gateway controls, while preserving existing session-send behavior. Merge readiness✅ Ready for maintainer review Keep open. Current main still lacks these agent session controls, and the session-access owner approved the permission boundary for this exact head. The earlier steering finding is resolved; I found no new blocking code defect. Priority: P2 Review scores
Verification
How this fits togetherThe agent sessions tool receives an operator’s request and sends authorized actions to the Gateway. The Gateway checks current session access before changing session state or stopping active and queued work. flowchart LR
A[Write operator] --> B[Agent sessions tool]
B --> C{Current operator grant and session access}
C --> D{Creator or human assignee}
D --> E[Gateway archive restore or Stop]
E --> F[Session state and queued work]
C --> G[Denied]
D --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +588, Tests +1520, Docs +1. Total +2109 across 30 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the approved, target-bound controls in the existing Gateway mutation paths, with session-send steering continuing under its established access rules. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: current main documents and enforces an owner-gated sessions tool, while the branch adds an approved operator capability. Is this the best way to solve the issue? Yes. The branch uses the existing Gateway mutation owners and checks live caller, access, relationship, and target identity before effects, without changing the established steering contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 741c9cb56bde. 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 (6 earlier review cycles)
|
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 6dac9f04-6b73-412a-9c7d-89ba9c437d07
Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 04add422-6ba1-46e1-a45e-87520b6afcbf
|
@clawsweeper re-review Head bfca7c0 preserves ordinary active-run sends and fixes the CI publication assertion. Focused tests, bearer-bound HTTP final effects, and changed checks passed. The PR body has the redacted proof and measured test costs. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Head 3cc054c restores the existing sessions_send steering admission and removes its separate control guard. The assembled Gateway steering regression fails on the previous head and passes now; bearer-bound HTTP final-effect cases pass on this head. The PR body has current proof and test costs. Human approval of the new archive/restore/Stop grant remains pending. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Maintainer decision (session-access owner): approved. The expanded Accepted boundary: an agent acting with |
|
🦞👀 Re-review progress:
|
…penclaw#160296) * fix: let non-admin operators ask agents to archive sessions Co-authored-by: VACInc <[email protected]> * fix: let non-admin operators ask agents to archive sessions Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 0fc82ef1-734a-4429-8fad-403e03085288 * fix: let write operators control their own sessions through agents Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 6dac9f04-6b73-412a-9c7d-89ba9c437d07 * fix: let write operators control their own sessions through agents Worked on by: - @VACInc Co-authored-by: VACInc <[email protected]> OpenClaw-Publication: 04add422-6ba1-46e1-a45e-87520b6afcbf * fix(sessions): preserve ordinary active-run sends * fix(sessions): retain established active-run steering --------- Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: VACInc <[email protected]>
Summary
High Level TLDR
Agents acting for a write operator can archive, restore, and stop sessions that operator created or is assigned to, when normal session access also allows it. Ordinary active-run sends and explicit steering retain the existing
sessions_sendaccess rules.User impact
operator.writeusers can ask their agents to archive, restore, and Stop eligible sessions.operator.sessions.writealone does not expose these controls. Assignment alone never grants access. Self-archive waits for the current reply to finish; Stop targets another session, with an optional exact run ID. Swarm collectors cannot discover or execute Stop. Existing administrator, private-session, settings, ownership, deletion, and standalone HTTP restrictions remain.What Problem This Solves
The old discovery gate hid the whole sessions tool behind Gateway administration. This branch carries host-issued operator authority through existing Gateway mutation owners, then rechecks access, creator or assignee, target generation, and current authority at the action boundary.
Earlier PR heads had two send regressions.
startSessionsSendAgentRunfirst applied restricted session-control preparation to every non-owner active-run send, including a message with nomode. Narrowing that guard to explicitmode="steer"still changed the published steering contract: an unrelated write operator who passed the existing send-access check could no longer steer. This head removes the separate control grant and guarded queue path fromsessions_send, restoring main's existing send and steering behavior while keeping the new archive/restore/Stop controls restricted. Separately, a projection test waited forfacts.kind="unchanged", whileassignSessionOwnerpublishesfacts.kind="owner"; the corrected assertion covers the two CI cases that failed on the prior head.Evidence
3cc054c4fc749e396bce34b03cc6fe8f6fc255e0,pnpm test src/gateway/mcp-http.session-controls.test.ts --maxWorkers=1ran against an isolated loopback MCP server:Test Files 1 passed (1); Tests 10 passed (10); real 23.55s(45.05s on the earlier cold run). Five bearer-bound HTTPtools/callcases and five in-process dispatcher cases passed. The HTTP assertions require status 200, an allowed archive result, and a persisted SQLitearchivedAt; unassigned, reassigned, role-revoked, and replaced targets require an error and no archive on the intended target. Reassignment, revocation, and replacement occur after target preparation and before the Gateway write resumes.pnpm test src/gateway/local-request-context.session-archive.test.ts --maxWorkers=1:Test Files 1 passed (1); Tests 13 passed (13); real 55.80s. The assembledsessions_sendtool queued explicit steering for both assigned and unrelated targets underoperator.writeand configuredvisibility: "all". With the previous PR code restored temporarily, the unrelated case failed withstatus: "forbidden"; this head passes. The same file also verifies restricted archive/Stop behavior.sessions_sendadmission and A2A siblings passed 48 tests across two files.pnpm test src/gateway/session-row-projection.worker-read.test.ts --maxWorkers=1:Test Files 1 passed (1); Tests 18 passed (18); real 20.87s, including both cases that failed in the prior CI run.node scripts/check-changed.mjs -- <changed paths>passed formatting, production and test types, core lint, and guards. Independent P0/P1 autoreview of the final repair delta was clean.Verification
Measured local wall time for each new or changed test file (
pnpm test <file> --maxWorkers=1, one worker):src/agents/tools/sessions-control-authority.test.tssrc/agents/tools/sessions-tool.collector.test.tssrc/agents/tools/sessions-tool.test.tssrc/gateway/local-request-context.session-archive.test.tssrc/gateway/mcp-http.archive-authority.test.tssrc/gateway/mcp-http.runtime.test.tssrc/gateway/mcp-http.session-controls.test.tssrc/gateway/session-membership-projection.test.tssrc/gateway/session-row-projection.worker-read.test.tsThe authority, assembled Gateway, and cold HTTP files exceed 30s wall time because their import or transform graph is large; the Gateway and HTTP files also exercise real queue or bearer binding, Gateway mutation, and persisted SQLite final effects. Those contracts cannot be established by a cheaper helper-only test. Exact-head CI on
3cc054c4fc749e396bce34b03cc6fe8f6fc255e0ran as CI run 36435123465 and did not pass. The PR context and evidence gate passed after this body gained its required authored section headings. Two unrelated test shards failed:checks-ui-e2e (6/9):ui/src/e2e/chat-user-bubble-disclosure.e2e.test.tstimed out in Playwrightlocator.screenshotwhile waiting for the element to stabilize after restoring the desktop viewport. The exact file passed locally on this head, 32/32 in 40.82s, including that case. The passing replay does not explain or fix the CI timeout. A local--shard 6/9run used a different file map and did not select this file; it also ended with three unrelated real-Gateway suite setup failures because this host's Node 25.9.0 is rejected by the repository'snode:sqliteguard (73 files and 350 tests passed). It is not a successful CI-shard replay.checks-windows-node-test-5:src/daemon/schtasks.env-case.real.test.tsexpected live child argv but one CIM read returnednullafter child readiness. This PR does not change the Windows launcher or CIM owner. This Linux worktree cannot replay the native Windows case; the cause remains unproven.Neither failed file nor its owning UI/daemon path changes in this PR. No speculative timeout, retry, assertion, or baseline change was made. These failures leave exact-head CI red. ClawSweeper's revision 5 found no discrete code defect. The session-access owner approved the exact-head
operator.writearchive, restore, and Stop grant, including clearing queued follow-ups for eligible created or assigned sessions; the new exact-head ClawSweeper review is pending.What was not tested
No live Gateway, real user channel, or deployed service was used. The user barred live infrastructure changes; the isolated bearer-bound HTTP server and SQLite readback are the closest permitted transport and final-effect proof. No before/after runtime latency benchmark was run: the baseline has no corresponding non-admin archive/Stop flow, and this send repair restores main's queue path. The session-access owner approved the new archive/restore/Stop grant on this head; this PR is not merged or deployed.
Contributor credit
Reported and requested by @VACInc.