Repository navigation
fix(automations): CLI-runtime owners can't see or manage ownerless automations - #162237
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. |
✅ Maintainer security changes approvedA maintainer approved this revision with an explicit security approval comment.
A later push requires a fresh approval comment for an external contributor's PR. |
|
Codex review: needs maintainer review before merge. What this changesPreserves admitted automation-management authority when CLI MCP requests construct their tools. Example: A configured owner asks a Claude CLI agent to disable an automation owned by qa-other-account.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs documented automation management that remains broken on main; no actionable introduced defect remains, and the previous exact-head security approval blocker is cleared. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway admission establishes run-bound authority, the host-owned CLI grant carries its construction scope across MCP HTTP, and automation operations redeem existing method-bound grants before accessing Cron persistence. flowchart LR
A[Authenticated owner turn] --> B[Admitted run authority]
B --> C[Host owned CLI grant]
C --> D[MCP tool construction]
D --> E[Method bound management grant]
E --> F[Cron authorization and persistence]
Technical reviewBest possible solution: Retain the existing run-bound management scope during CLI tool construction while preserving policy, revocation, and final-effect authorization. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the missing construction scope, supported by the recorded live red/green result and #186696; this review ran no reproduction. Is this the best way to solve the issue? The patch repairs the construction boundary through existing owners, restores the matching tool schema, and preserves execution-time authorization without a parallel authority registry. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against be0d5c97b500. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +67, Tests +241, Other +82. Total +390 across 8 files. Added test files: 1. 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. 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 (4 earlier review cycles)
Reviewed October 29, 2026, 12:51 AM ET / 04:51 UTC (Revision 5). |
Preserve the remaining behavior of local d5bb7f8 after upstream requester-origin and detached-listener work (openclaw#157806 and openclaw#165432). Cron tools bind management while being constructed; entering the admitted caller only at later MCP execution left authorized CLI owners unable to manage existing ownerless jobs. Capture the exact live Cron construction scope on the host-only CLI grant and enter it under the admitted caller at tool resolution. Keep the stored request scope, live owner membership, exact grant-row lifecycle, detached listener, and final one-use method-bound effect checks. Construction omits execution-only requester grant minting; execution retains its original issuer. Prove the original caller-vs-gateway visibility failure through real HTTP MCP, tool resolution, and isolated Cron persistence, including owner removal, bearer revocation, and later unentitled callers. A second real HTTP regression proves construction cannot see the requester issuer while execution can mint and redeem one-use grants. Focused affected tests, scoped types/lint, and fresh independent review passed. Related openclaw#162237; local retention does not constitute the outstanding maintainer security approval.
7dd812f to
654ad2e
Compare
|
Reconstructed this repair on newer main at Fresh real HTTP MCP → tool construction → durable Cron regression is red before the repair and green after, including owner removal, grant revocation and a later unentitled caller. A second HTTP regression verifies that construction cannot access the execution-only requester-grant issuer. Final affected21/21 and broader85distinct checks across runs, focused statics and independent review pass. GitHub reports mergeable. No security approval or current deployment is claimed. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Preserve the remaining behavior of local d5bb7f8 after upstream requester-origin and detached-listener work (openclaw#157806 and openclaw#165432). Cron tools bind management while being constructed; entering the admitted caller only at later MCP execution left authorized CLI owners unable to manage existing ownerless jobs. Capture the exact live Cron construction scope on the host-only CLI grant and enter it under the admitted caller at tool resolution. Keep the stored request scope, live owner membership, exact grant-row lifecycle, detached listener, and final one-use method-bound effect checks. Construction omits execution-only requester grant minting; execution retains its original issuer. Prove the original caller-vs-gateway visibility failure through real HTTP MCP, tool resolution, and isolated Cron persistence, including owner removal, bearer revocation, and later unentitled callers. A second real HTTP regression proves construction cannot see the requester issuer while execution can mint and redeem one-use grants. Focused affected tests, scoped types/lint, and fresh independent review passed. Related openclaw#162237; local retention does not constitute the outstanding maintainer security approval. Local-Feature: cli-mcp-management-construction Semantic-Source: 22b7f5f Upstream-Tracking: openclaw#162237 Drop-When: Upstream retains scoped CLI management during construction with execution-only issuance and live authority checks. Rebase-Base: ed9d493
Preserve the remaining behavior of local d5bb7f8 after upstream requester-origin and detached-listener work (openclaw#157806 and openclaw#165432). Cron tools bind management while being constructed; entering the admitted caller only at later MCP execution left authorized CLI owners unable to manage existing ownerless jobs. Capture the exact live Cron construction scope on the host-only CLI grant and enter it under the admitted caller at tool resolution. Keep the stored request scope, live owner membership, exact grant-row lifecycle, detached listener, and final one-use method-bound effect checks. Construction omits execution-only requester grant minting; execution retains its original issuer. Prove the original caller-vs-gateway visibility failure through real HTTP MCP, tool resolution, and isolated Cron persistence, including owner removal, bearer revocation, and later unentitled callers. A second real HTTP regression proves construction cannot see the requester issuer while execution can mint and redeem one-use grants. Focused affected tests, scoped types/lint, and fresh independent review passed. Related openclaw#162237; local retention does not constitute the outstanding maintainer security approval. Local-Feature: cli-mcp-management-construction Semantic-Source: 22b7f5f Upstream-Tracking: openclaw#162237 Drop-When: Upstream retains scoped CLI management during construction with execution-only issuance and live authority checks. Rebase-Base: ed9d493
Preserve the remaining behavior of local d5bb7f8 after upstream requester-origin and detached-listener work (openclaw#157806 and openclaw#165432). Cron tools bind management while being constructed; entering the admitted caller only at later MCP execution left authorized CLI owners unable to manage existing ownerless jobs. Capture the exact live Cron construction scope on the host-only CLI grant and enter it under the admitted caller at tool resolution. Keep the stored request scope, live owner membership, exact grant-row lifecycle, detached listener, and final one-use method-bound effect checks. Construction omits execution-only requester grant minting; execution retains its original issuer. Prove the original caller-vs-gateway visibility failure through real HTTP MCP, tool resolution, and isolated Cron persistence, including owner removal, bearer revocation, and later unentitled callers. A second real HTTP regression proves construction cannot see the requester issuer while execution can mint and redeem one-use grants. Focused affected tests, scoped types/lint, and fresh independent review passed. Related openclaw#162237; local retention does not constitute the outstanding maintainer security approval. Local-Feature: cli-mcp-management-construction Semantic-Source: 22b7f5f Upstream-Tracking: openclaw#162237 Drop-When: Upstream retains scoped CLI management during construction with execution-only issuance and live authority checks. Rebase-Base: 0220489
654ad2e to
648d5ab
Compare
|
Rebased onto current main ( Current main still has the gap. #186668 repairs the same handoff at execution time, and #186696 is another report of #147614. The difference is that this PR binds at construction, so the tool's schema and description also get the management shape (the schema-parity point #186668 leaves out of scope). Execution still uses the same one-use, method-bound grant and the same final-effect checks. I'm happy to close this in favour of #186668 if maintainers prefer that route. Locally on the rebased tree: build, type checks and lint pass, and the focused tests ( The previous re-review stopped on a provider limit. Exact-head security approval is still outstanding, and none is claimed. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
obviyus
left a comment
There was a problem hiding this comment.
Maintainer review at 648d5ab8.
Bug confirmed in production. On 2026.10.8, a configured channel owner on a claude-cli agent called automations get on a job owned by the same conversation and got cron job not found (the job has operator authority, so only management can see it). No cron: admin management line was logged for that turn, while the same owner on the embedded runtime logs one. This matches #186696 and the root cause here: finalizeCliMcpGrant captured only the requester issuer and the currentness check, and the loopback request later built the automations tool outside the owner's activeCronCreatorAuthority scope, so bindCronManagementGrant returned undefined.
Design. This matches the Codex path (runWithCronCreatorAuthorityCapabilityResolver around dynamic tool construction). The narrow construction identity is right: management binding gets the admitted caller, and requester-grant minting stays at execution.
Tool cache. I checked whether a cached tool can keep management authority past its lifetime. It cannot widen:
mintCronCreatorAuthorityGrantrechecksscope.active, abort,isCurrentand channel-owner membership on every call, and each grant is one-use and method-bound.McpLoopbackToolCachekeys by grant token and evicts on row replacement.- A stale cached tool fails closed with the expired-management error; it does not fall back to caller scope for the rest of that grant. That is acceptable. A short note in the PR body would help the security reviewer.
Before merge:
check-lint-core-2is red. Please check whether it comes from this diff or from currentmain.- ClawSweeper asks for real behavior proof. A QA or live run with a
claude-cliowner turn doingget/updateon an operator-created job would cover it.
Related: #187195 lets the owner conversation pause or remove its own operator-created jobs without management, so it does not overlap with this fix. This PR is still needed for Gateway-wide owner management on CLI agents.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
obviyus
left a comment
There was a problem hiding this comment.
Approving the exact head 26c6297. The management scope reaches CLI MCP tool construction only for the admitted owner run; grants stay one-use, method-bound and rechecked at mint and commit. Live Claude CLI proof passes on this head and fails on main with the production error.
|
/allow-security-sensitive-change |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 33c8e49. Thanks @Grynn for the fix.
|
…tomations (openclaw#162237) Related: openclaw#147614, openclaw#157126, openclaw#157144 ## What Problem This Solves Fixes: admitted owners using CLI-backed agents cannot see or manage existing ownerless automations because the later MCP request constructs the tool outside the owner's automation-management scope. ## User Impact Authorized owners regain Gateway-wide list/get/update of existing automations through CLI MCP. Removing owner membership or revoking the grant still denies access, and later callers without management authority remain caller-scoped. Ownerless jobs remain ownerless. No configuration or stored-data migration is required. ## Why This Change Was Made Automation tools bind management authority when constructed, before their later execution. The host-only CLI grant now retains the exact live construction scope, and tool resolution enters it under the admitted caller identity and stored request scope. The construction identity deliberately omits execution's requester-grant issuer. Actual execution retains the existing one-use, method-bound grant and final-effect checks. The retained callback rechecks the exact grant row, active run, abort/currentness and current channel-owner membership. Stale scope exits any ambient management scope rather than inheriting it. The implementation builds on current requester-origin and detached-listener ownership; it does not restore superseded listener or ambient-authority code. ## Evidence - **Live Claude CLI proof:** new QA scenario `cron-claude-cli-owner-management` (live-frontier, `claude-cli/claude-sonnet-4-6`, subscription auth). A configured channel owner asks the Claude CLI agent to `get` and then disable an automation owned by another account. On this branch the agent replies with the success marker; the job is disabled and keeps its original owner. With the four source files reverted to `main`, the same live turn fails with `cron job not found: <id> ... For cross-session management, use a fresh authenticated configured channel owner ...`, which is the production report in openclaw#186696. - **Production:** on 2026.10.8, a configured channel owner on a `claude-cli` agent got `cron job not found` for a job owned by the same conversation, with no `cron: admin management` log line; the same owner on the embedded runtime is granted management. - **Real boundary regression:** `src/gateway/server-methods/mcp-cron-management.integration.test.ts` drives the actual detached loopback HTTP MCP listener, production tool resolution and isolated durable Cron persistence. On the unchanged owner it fails with `expected 'caller' to be 'gateway'`; with this repair it lists, reads and updates the ownerless job without assigning an owner. - The same scenario then removes the configured owner and observes update refusal; revokes the grant and observes HTTP401; starts a later unentitled run on the same listener and observes caller scope with no access to the job. The only mocked boundary is unrelated attached-node inventory. - **Construction/execution separation:** a real HTTP regression proves the admitted identity cannot mint a requester grant during construction, while execution can mint and redeem its one-use grant. It failed before the construction identity was narrowed and passes afterward. - Final affected command: `OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/gateway/mcp-http.async-scope.test.ts src/gateway/server-methods/mcp-cron-management.integration.test.ts src/agents/tools/cron-tool.management.test.ts --maxWorkers=1`: **21/21 pass** (7 HTTP-scope, 1 durable Cron integration, 13 management controls). Wrapper wall **65.13s**, including compiler/bootstrap work; the integrated owner scenario took **6.772s**. These are test costs, not production-latency benchmarks. - Earlier broader affected runs cover **85 distinct tests across the runs**, including grant-store, grant construction, authority and requester-continuation consumers. Core/gateway test types, touched type-aware lint, formatting, scoped line-cap and diff checks pass. - Simplification keeps the existing grant row and Cron authority owner; no second authority registry, wire credential, database schema or permission option is added. Construction and execution share one identity builder with an explicit phase. Necessary patch growth is the retained host callback and separate real authority/revocation regressions. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #147614, #157126, #157144
What Problem This Solves
Fixes: admitted owners using CLI-backed agents cannot see or manage existing ownerless automations because the later MCP request constructs the tool outside the owner's automation-management scope.
User Impact
Authorized owners regain Gateway-wide list/get/update of existing automations through CLI MCP. Removing owner membership or revoking the grant still denies access, and later callers without management authority remain caller-scoped. Ownerless jobs remain ownerless. No configuration or stored-data migration is required.
This carries existing management authority across a host-owned boundary, so it needs the repository's exact-head security approval.
Why This Change Was Made
Automation tools bind management authority when constructed, before their later execution. The host-only CLI grant now retains the exact live construction scope, and tool resolution enters it under the admitted caller identity and stored request scope. The construction identity deliberately omits execution's requester-grant issuer. Actual execution retains the existing one-use, method-bound grant and final-effect checks.
The retained callback rechecks the exact grant row, active run, abort/currentness and current channel-owner membership. Stale scope exits any ambient management scope rather than inheriting it. The implementation builds on current requester-origin and detached-listener ownership; it does not restore superseded listener or ambient-authority code.
This semantic repair is based on
f91bca9546f5. Its seven changed files are byte-identical to reviewed source683a0212960fb997b1758ceaa55bc248a84b2c79; unrelated preceding model-locality changes are excluded from this PR. A local merge check against1e48ec3a9e3succeeds.Evidence
cron-claude-cli-owner-management(live-frontier,claude-cli/claude-sonnet-4-6, subscription auth). A configured channel owner asks the Claude CLI agent togetand then disable an automation owned by another account. On this branch the agent replies with the success marker; the job is disabled and keeps its original owner. With the four source files reverted tomain, the same live turn fails withcron job not found: <id> ... For cross-session management, use a fresh authenticated configured channel owner ..., which is the production report in [Bug]: Channel owner turns on claude-cli runtime get no automation management grant over the MCP bridge (cron.update restricted) #186696.claude-cliagent gotcron job not foundfor a job owned by the same conversation, with nocron: admin managementlog line; the same owner on the embedded runtime is granted management.src/gateway/server-methods/mcp-cron-management.integration.test.tsdrives the actual detached loopback HTTP MCP listener, production tool resolution and isolated durable Cron persistence. On the unchanged owner it fails withexpected 'caller' to be 'gateway'; with this repair it lists, reads and updates the ownerless job without assigning an owner.OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/gateway/mcp-http.async-scope.test.ts src/gateway/server-methods/mcp-cron-management.integration.test.ts src/agents/tools/cron-tool.management.test.ts --maxWorkers=1: 21/21 pass (7 HTTP-scope, 1 durable Cron integration, 13 management controls). Wrapper wall 65.13s, including compiler/bootstrap work; the integrated owner scenario took 6.772s. These are test costs, not production-latency benchmarks.Current-head CI and independent maintainer security approval are still required; no approval or merge readiness is inferred from older-head checks.