Repository navigation
fix(gateway): owner turns after subagent work cannot edit automations - #157404
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. Reviewed September 24, 2026, 3:10 PM ET / 19:10 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch lets a resumed channel-owner turn use its one-use grant at the Gateway automation scope check and routes the regression test through Gateway request dispatch. Merge readiness✅ Ready for maintainer review Keep this PR open for merge consideration. Current main still blocks the documented owner-continuation workflow, and this review found no blocking patch defect. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway receives automation requests from an agent turn, checks the caller’s authority, and passes admitted requests to the automation handler. The handler checks authority again before changing a saved job. flowchart LR
A[Owner chat] --> B[Resumed agent turn]
B --> C[Automation tool]
C --> D{Gateway scope check}
D -->|Matching grant| E[Live authority check]
D -->|No authority| F[Permission error]
E --> G[Saved automation]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +35, Tests +8. Total +43 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Preserve owner continuation access through the exact-method grant while retaining one-use redemption and live authority checks at each automation effect. Do we have a high-confidence way to reproduce the issue? Yes. A configured owner can resume after subagent work and request an automation update; current main still rejects that write-scoped call at the admin scope gate. The PR reports the same failure on its base build, though this review did not execute current main. Is this the best way to solve the issue? Yes. The grant owner supplies an exact-method check at the scope gate, while the automation handler retains one-use redemption and live precommit validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2c946b584e9d. 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 (1 earlier review cycle)
|
|
|
Fixed: resumed owner turns can manage automations using their existing method-bound grants. With thanks to @obviyus. |
…pe gate (openclaw#157404) Allow automation management continuations to use their existing method- and run-bound grants at the Gateway scope check while preserving single-use redemption and live authority validation. Reviewed-by: @shakkernerd
What Problem This Solves
Fixes: a configured channel owner cannot update, run or remove an automation from a turn that resumes after a subagent finishes; the automations tool fails with
missing scope: operator.admin, although owner turns are documented to manage any Gateway automation.User Impact
User impact: an owner's agent can edit its automations in follow-up turns after subagent work, instead of telling the owner it lacks permission and sending them to the Control UI.
Why This Change Was Made
A configured channel owner's turn gets automation management through a one-use
cronManagementGrant, bound to one method and the admitted run.cron.update,cron.runandcron.removeare registered asoperator.adminmethods. A subagent-completion continuation turn reaches the Gateway through an in-process client withoperator.writeonly, so the method-scope fence inauthorizeGatewayMethodrefused the call before the cron handler could redeem the grant. Reads (cron.list,cron.get) need onlyoperator.read, so they worked and the failure looked like a missing permission on the owner's side.The fence now asks the grant owner (
holdsCronManagementGrant) whether the internal caller holds an unredeemed grant bound to this exact method and run, and admits the call if so. The cron handler still redeems the grant once and checks it is active, exactly as before. A grant bound to another method, an expired or revoked grant, or no grant still fails at the fence.The existing requester-continuation integration tests called
cronHandlers["cron.update"]directly, which skipped the fence. They now dispatch throughhandleGatewayRequestwith a write-scoped client, so they cover the production path.Evidence
Live Telegram (Test Server, real user in a forum group, fresh Gateway from built
dist, token auth). The owner's message makes the agent spawn a subagent and yield; the subagent finishes; the resumed continuation turn lists automations and updates a seeded job through the automations tool.automations update074198a634missing scope: operator.admin(the production error)Turns the owner starts directly already had enough scope and passed on both builds; the failure is specific to continuation turns.
Tests (
src/gateway/server-methods/requester-cron-authority.integration.test.ts):operator.writeclient. On base, all routed management cases fail withmissing scope: operator.admin; with this PR they pass. The no-grant case is refused at the fence, as in production.cron.removedoes not admitcron.update.pnpm tsgo:corepasses.Test cost (
--maxWorkers=1):pnpm test src/gateway/server-methods/requester-cron-authority.integration.test.ts --maxWorkers=1: 15 tests, 40.8 s wall (71% transform, 22% tests). One new case; the others changed dispatch only.