Repository navigation
fix(automations): let automation notice turns read caller-visible automations - #180304
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 changesAllows trusted scheduler notice turns to list and inspect caller-visible automations while retaining owner gates for other actions. Example: The one-shot automation “Owned proof” fails and posts an auto-disable notice into its creating conversation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current automation-notice inspection failure without granting owner identity; no introduced correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherEmbedded agents and CLI loopback clients assemble tools through a shared turn-authority gate; permitted automation reads then reach scheduler handlers that enforce current caller visibility. flowchart TD
A[Scheduler failure notice] --> B[Host session event admission]
B --> C[Embedded or CLI tool assembly]
C --> D[Shared turn authority gate]
D --> E[Caller scoped scheduler reads]
D --> F[Owner gated other actions]
E --> G[Visible automation and run history]
Technical reviewBest possible solution: Keep the narrow read exception in the shared turn-authority owner and retain scheduler-owned visibility enforcement. Do we have a high-confidence way to reproduce the issue? Current-main source blocks every automation call on the senderless notice turn, and the contributor records the same failure through the Gateway with base production files; this review executed no target code. Is this the best way to solve the issue? The fix preserves stable tool definitions and uses the existing authority gate and scheduler visibility owners, with both embedded and CLI assembly callers updated. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b1094285fc42. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +67, Tests +942. Total +1009 across 10 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 (3 earlier review cycles)Reviewed October 22, 2026, 4:34 AM ET / 08:34 UTC (Revision 4). |
…tion-reads # Conflicts: # src/agents/agent-tools.turn-authority.ts
…fect Drive a real failed one-shot through the scheduler's auto-disable notice on an isolated Gateway and check, at the cron handlers, that the notice turn reads only its own chat's automation and history, every write and other owner-only tool stays gated, removal or run closure during an awaited history read discloses nothing, and a non-owner agent turn that asserts scheduler provenance gets the owner gate.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…omations (openclaw#180304) * fix(automations): let automation notice turns read caller-visible automations * test(automations): prove notice-turn automation reads at the final effect Drive a real failed one-shot through the scheduler's auto-disable notice on an isolated Gateway and check, at the cron handlers, that the notice turn reads only its own chat's automation and history, every write and other owner-only tool stays gated, removal or run closure during an awaited history read discloses nothing, and a non-owner agent turn that asserts scheduler provenance gets the owner gate. --------- Co-authored-by: VACInc <[email protected]>
…188105) Related: #161007, #180304, #187346 ## What Problem This Solves Fixes: an automation's failure repair turn cannot read or change the job it was asked to repair, so it asks the user to fix it instead. ## User Impact User impact: when an owned automation fails, the repair turn in its owner conversation can now read the job's runs and update the job when the job's requester is still an owner, so most repairs no longer need a human reply. Scheduler notices about a job follow the same rule. Risk to note: a job whose requester is not an owner (or whose stored operator source can no longer be restored) now gets read-only automation access in its repair and notice turns, and no session-owner fallback. Jobs that record no requester keep the session owner's current access, as other system turns do since #187346. ## Why This Change Was Made System-started turns got their authority from what kind of turn they were: a label match for notices (#180304), a caller rule for completions (#187346, which left cron out), and nothing for repairs, which went through the public `agent` RPC. Any client can send the repair's provenance label on that RPC, so it could never carry authority. Now: - A scheduler turn about a job acts for the job's recorded requester, the same requester and owner check its scheduled runs use (channel sender, profile, or restored operator source). Owner status is rechecked before each owner-only effect. - Repairs run on the host session-event path, like notices and completions. - Every host system turn gets one rule for caller-scoped automation reads; the `sourceTool === "cron"` match is gone. ## Evidence Production repair transcripts (read-only, one Gateway, since the repair feature shipped): 57 repair turns, 3 fixed their job, 28 asked the user. No repair turn ever completed an `automations` call: before 2026-10-19 the tool was absent, then a schema check failed, and since 2026-10-22 all 18 calls were refused by the owner gate. All 3 script-payload repairs were refused. Final-effect test `src/gateway/server-cron-failure-repair.final-effect.test.ts` runs the real repair dispatcher, real session-event admission, the turn's real tool surface and in-process Gateway dispatch into a real `CronService` and its store (model synthetic). Each case reports the tool result and the stored job afterwards: | Job requester | `automations update` | Stored description | |---|---|---| | Channel owner | ok | changed | | Channel non-owner | gated | unchanged | | Channel owner revoked while the repair was queued | turn refused at admission, no tool ran | unchanged | | Channel owner revoked after admission | refused: tool host retired by the config change | unchanged | | Restored Control UI admin operator source | ok | changed | | Restored non-admin operator source | gated | unchanged | | Operator source with its device revoked before the repair | gated (no session fallback) | unchanged | | Operator source device revoked while queued | turn refused at admission, no tool ran | unchanged | Two fixes came out of this proof: - The queued-revocation case first let the update through: the requester recheck read the config captured at capture time. It now reads the Gateway's current config, as completion turns do (`authority.isCurrent(getSessionEventRuntimeConfig())`). - A restored operator source is an owner only when it was a Control UI administrator, matching the job's in-session runs (`session-run.ts`). The non-admin case fails without this rule. On the base commit the file fails (the repair cannot dispatch outside the old lifecycle path); production transcripts above show the base refusal itself. Runtime-error suppression from #162772 is kept: repair session events set a host-owned `suppressErrorDelivery`, so error payloads stay in the transcript and out of chat. The owner-topic Gateway test now has the repair return a provider-error payload and asserts no chat delivery; without the flag that test fails (`prepareSessionEventDelivery` called once). Gateway cron suite (`server.cron.test.ts`): the owner-topic repair and NO_REPLY repair cases drive the real reply runtime; they check the owner topic's session and thread route, repair pending through retries until the turn settles (success and error), one escalation, and that a forged public `cron_failure_repair` label still gets no silence. The monotonic deadline cases in `server-cron-notifications.repair.test.ts` now run against the session-event dispatcher. Focused runs (`pnpm test <file> --maxWorkers=1`, wall time): | File | Tests | Time | |---|---|---| | `src/gateway/server-cron-failure-repair.final-effect.test.ts` (new) | 8 | 34 s | | `src/gateway/server-cron-notifications.repair.test.ts` | 2 | 7 s | | `src/gateway/tool-resolution.exclude.test.ts` | 37 | 9 s | | `src/agents/agent-tools.turn-authority.test.ts` | 14 | 1 s | | `src/gateway/server.cron.test.ts` | 15 | 30 s | | `src/auto-reply/reply/session-event-permissions.test.ts` | 27 | 37 s | | `src/cron/execution-context-admission.test.ts` | 26 | 6 s | The new test file adds about 8 s of test time (eight cases, one shared fixture). `server.cron.test.ts` stays at its prior cost. `oxfmt`, type-aware `oxlint` on changed files, `pnpm tsgo:core`, the `src` test-type shards and the baseline ratchets (`check:test-mock-exports`, `check:max-lines-ratchet`, `check:assertion-safety`, `check:test-timeout-race-ratchet`) pass. Hosted CI and the ClawSweeper review are green on the merged head. Gaps: - Profile requesters reuse the scheduled-run owner check unchanged; channel and operator-source requesters are the tested paths. - The managed tool host used by `openEventToolHost` does not pass `inputProvenance` into tool construction, so caller-scoped reads for non-owner turns are shown in the unit matrices, not this harness (the embedded attempt path does pass it). Follow-up. - Live proof needs a deploy; the next real failing job on a production Gateway will show it. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#188105) Related: openclaw#161007, openclaw#180304, openclaw#187346 ## What Problem This Solves Fixes: an automation's failure repair turn cannot read or change the job it was asked to repair, so it asks the user to fix it instead. ## User Impact User impact: when an owned automation fails, the repair turn in its owner conversation can now read the job's runs and update the job when the job's requester is still an owner, so most repairs no longer need a human reply. Scheduler notices about a job follow the same rule. Risk to note: a job whose requester is not an owner (or whose stored operator source can no longer be restored) now gets read-only automation access in its repair and notice turns, and no session-owner fallback. Jobs that record no requester keep the session owner's current access, as other system turns do since openclaw#187346. ## Why This Change Was Made System-started turns got their authority from what kind of turn they were: a label match for notices (openclaw#180304), a caller rule for completions (openclaw#187346, which left cron out), and nothing for repairs, which went through the public `agent` RPC. Any client can send the repair's provenance label on that RPC, so it could never carry authority. Now: - A scheduler turn about a job acts for the job's recorded requester, the same requester and owner check its scheduled runs use (channel sender, profile, or restored operator source). Owner status is rechecked before each owner-only effect. - Repairs run on the host session-event path, like notices and completions. - Every host system turn gets one rule for caller-scoped automation reads; the `sourceTool === "cron"` match is gone. ## Evidence Production repair transcripts (read-only, one Gateway, since the repair feature shipped): 57 repair turns, 3 fixed their job, 28 asked the user. No repair turn ever completed an `automations` call: before 2026-10-19 the tool was absent, then a schema check failed, and since 2026-10-22 all 18 calls were refused by the owner gate. All 3 script-payload repairs were refused. Final-effect test `src/gateway/server-cron-failure-repair.final-effect.test.ts` runs the real repair dispatcher, real session-event admission, the turn's real tool surface and in-process Gateway dispatch into a real `CronService` and its store (model synthetic). Each case reports the tool result and the stored job afterwards: | Job requester | `automations update` | Stored description | |---|---|---| | Channel owner | ok | changed | | Channel non-owner | gated | unchanged | | Channel owner revoked while the repair was queued | turn refused at admission, no tool ran | unchanged | | Channel owner revoked after admission | refused: tool host retired by the config change | unchanged | | Restored Control UI admin operator source | ok | changed | | Restored non-admin operator source | gated | unchanged | | Operator source with its device revoked before the repair | gated (no session fallback) | unchanged | | Operator source device revoked while queued | turn refused at admission, no tool ran | unchanged | Two fixes came out of this proof: - The queued-revocation case first let the update through: the requester recheck read the config captured at capture time. It now reads the Gateway's current config, as completion turns do (`authority.isCurrent(getSessionEventRuntimeConfig())`). - A restored operator source is an owner only when it was a Control UI administrator, matching the job's in-session runs (`session-run.ts`). The non-admin case fails without this rule. On the base commit the file fails (the repair cannot dispatch outside the old lifecycle path); production transcripts above show the base refusal itself. Runtime-error suppression from openclaw#162772 is kept: repair session events set a host-owned `suppressErrorDelivery`, so error payloads stay in the transcript and out of chat. The owner-topic Gateway test now has the repair return a provider-error payload and asserts no chat delivery; without the flag that test fails (`prepareSessionEventDelivery` called once). Gateway cron suite (`server.cron.test.ts`): the owner-topic repair and NO_REPLY repair cases drive the real reply runtime; they check the owner topic's session and thread route, repair pending through retries until the turn settles (success and error), one escalation, and that a forged public `cron_failure_repair` label still gets no silence. The monotonic deadline cases in `server-cron-notifications.repair.test.ts` now run against the session-event dispatcher. Focused runs (`pnpm test <file> --maxWorkers=1`, wall time): | File | Tests | Time | |---|---|---| | `src/gateway/server-cron-failure-repair.final-effect.test.ts` (new) | 8 | 34 s | | `src/gateway/server-cron-notifications.repair.test.ts` | 2 | 7 s | | `src/gateway/tool-resolution.exclude.test.ts` | 37 | 9 s | | `src/agents/agent-tools.turn-authority.test.ts` | 14 | 1 s | | `src/gateway/server.cron.test.ts` | 15 | 30 s | | `src/auto-reply/reply/session-event-permissions.test.ts` | 27 | 37 s | | `src/cron/execution-context-admission.test.ts` | 26 | 6 s | The new test file adds about 8 s of test time (eight cases, one shared fixture). `server.cron.test.ts` stays at its prior cost. `oxfmt`, type-aware `oxlint` on changed files, `pnpm tsgo:core`, the `src` test-type shards and the baseline ratchets (`check:test-mock-exports`, `check:max-lines-ratchet`, `check:assertion-safety`, `check:test-timeout-race-ratchet`) pass. Hosted CI and the ClawSweeper review are green on the merged head. Gaps: - Profile requesters reuse the scheduled-run owner check unchanged; channel and operator-source requesters are the tested paths. - The managed tool host used by `openEventToolHost` does not pass `inputProvenance` into tool construction, so caller-scoped reads for non-owner turns are shown in the unit matrices, not this harness (the embedded attempt path does pass it). Follow-up. - Live proof needs a deploy; the next real failing job on a production Gateway will show it. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#188105) Related: openclaw#161007, openclaw#180304, openclaw#187346 Fixes: an automation's failure repair turn cannot read or change the job it was asked to repair, so it asks the user to fix it instead. User impact: when an owned automation fails, the repair turn in its owner conversation can now read the job's runs and update the job when the job's requester is still an owner, so most repairs no longer need a human reply. Scheduler notices about a job follow the same rule. Risk to note: a job whose requester is not an owner (or whose stored operator source can no longer be restored) now gets read-only automation access in its repair and notice turns, and no session-owner fallback. Jobs that record no requester keep the session owner's current access, as other system turns do since openclaw#187346. System-started turns got their authority from what kind of turn they were: a label match for notices (openclaw#180304), a caller rule for completions (openclaw#187346, which left cron out), and nothing for repairs, which went through the public `agent` RPC. Any client can send the repair's provenance label on that RPC, so it could never carry authority. Now: - A scheduler turn about a job acts for the job's recorded requester, the same requester and owner check its scheduled runs use (channel sender, profile, or restored operator source). Owner status is rechecked before each owner-only effect. - Repairs run on the host session-event path, like notices and completions. - Every host system turn gets one rule for caller-scoped automation reads; the `sourceTool === "cron"` match is gone. Production repair transcripts (read-only, one Gateway, since the repair feature shipped): 57 repair turns, 3 fixed their job, 28 asked the user. No repair turn ever completed an `automations` call: before 2026-10-19 the tool was absent, then a schema check failed, and since 2026-10-22 all 18 calls were refused by the owner gate. All 3 script-payload repairs were refused. Final-effect test `src/gateway/server-cron-failure-repair.final-effect.test.ts` runs the real repair dispatcher, real session-event admission, the turn's real tool surface and in-process Gateway dispatch into a real `CronService` and its store (model synthetic). Each case reports the tool result and the stored job afterwards: | Job requester | `automations update` | Stored description | |---|---|---| | Channel owner | ok | changed | | Channel non-owner | gated | unchanged | | Channel owner revoked while the repair was queued | turn refused at admission, no tool ran | unchanged | | Channel owner revoked after admission | refused: tool host retired by the config change | unchanged | | Restored Control UI admin operator source | ok | changed | | Restored non-admin operator source | gated | unchanged | | Operator source with its device revoked before the repair | gated (no session fallback) | unchanged | | Operator source device revoked while queued | turn refused at admission, no tool ran | unchanged | Two fixes came out of this proof: - The queued-revocation case first let the update through: the requester recheck read the config captured at capture time. It now reads the Gateway's current config, as completion turns do (`authority.isCurrent(getSessionEventRuntimeConfig())`). - A restored operator source is an owner only when it was a Control UI administrator, matching the job's in-session runs (`session-run.ts`). The non-admin case fails without this rule. On the base commit the file fails (the repair cannot dispatch outside the old lifecycle path); production transcripts above show the base refusal itself. Runtime-error suppression from openclaw#162772 is kept: repair session events set a host-owned `suppressErrorDelivery`, so error payloads stay in the transcript and out of chat. The owner-topic Gateway test now has the repair return a provider-error payload and asserts no chat delivery; without the flag that test fails (`prepareSessionEventDelivery` called once). Gateway cron suite (`server.cron.test.ts`): the owner-topic repair and NO_REPLY repair cases drive the real reply runtime; they check the owner topic's session and thread route, repair pending through retries until the turn settles (success and error), one escalation, and that a forged public `cron_failure_repair` label still gets no silence. The monotonic deadline cases in `server-cron-notifications.repair.test.ts` now run against the session-event dispatcher. Focused runs (`pnpm test <file> --maxWorkers=1`, wall time): | File | Tests | Time | |---|---|---| | `src/gateway/server-cron-failure-repair.final-effect.test.ts` (new) | 8 | 34 s | | `src/gateway/server-cron-notifications.repair.test.ts` | 2 | 7 s | | `src/gateway/tool-resolution.exclude.test.ts` | 37 | 9 s | | `src/agents/agent-tools.turn-authority.test.ts` | 14 | 1 s | | `src/gateway/server.cron.test.ts` | 15 | 30 s | | `src/auto-reply/reply/session-event-permissions.test.ts` | 27 | 37 s | | `src/cron/execution-context-admission.test.ts` | 26 | 6 s | The new test file adds about 8 s of test time (eight cases, one shared fixture). `server.cron.test.ts` stays at its prior cost. `oxfmt`, type-aware `oxlint` on changed files, `pnpm tsgo:core`, the `src` test-type shards and the baseline ratchets (`check:test-mock-exports`, `check:max-lines-ratchet`, `check:assertion-safety`, `check:test-timeout-race-ratchet`) pass. Hosted CI and the ClawSweeper review are green on the merged head. Gaps: - Profile requesters reuse the scheduled-run owner check unchanged; channel and operator-source requesters are the tested paths. - The managed tool host used by `openEventToolHost` does not pass `inputProvenance` into tool construction, so caller-scoped reads for non-owner turns are shown in the unit matrices, not this harness (the embedded attempt path does pass it). Follow-up. - Live proof needs a deploy; the next real failing job on a production Gateway will show it. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 8100c60) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 12819b3dac7eab80d73e174c19363fe1e29679e4)
Summary
High Level TLDR
When an automation fails and gets auto-disabled, OpenClaw posts a notice into the owning conversation: "Check automation history for details." That notice starts a new agent turn. Because no human sent it, the turn has no owner identity, and the
automationstool refuses every call with "automations needs the owner's authority, and this turn was not started by the owner." So the agent cannot do the one thing the notice tells it to do, and the owner has to send another message just to get the failure reason.This PR lets that scheduler notice turn run the read-only, caller-scoped
automationsactions (list,get,runs). Every write (add,update,remove,run,wake), Gateway-wide management, and every other owner-only tool (gateway,nodes,sessions, ...) stay gated exactly as before.Root Cause
resolveTurnToolSurface(src/agents/agent-tools.turn-authority.ts) gates every tool inGATEWAY_OWNER_ONLY_CORE_TOOLS(src/security/dangerous-tools.ts) whensenderIsOwner === false.automationsis in that list.enqueueSessionEventForHostwithsource: "cron"(src/gateway/server-cron-targets.ts).buildSessionEventContext(src/auto-reply/reply/session-event-context.ts) builds a sender-less context (InputProvenance {kind: "internal_system", sourceTool: "cron"},CommandAuthorized: false, noSenderId), soresolveCommandAuthorizationreturnssenderIsOwner: false. This is intended: a system turn must not borrow the owner's identity.automationstool to caller-visible records:bindCronManagementGrantonly mints Gateway-wide management for fresh owner or Control UI admin turns, andcron.list/get/runsfilter throughreadCronCallerScope+cronJobMatchesCallerScope(agent-created jobs are bound to their creator session). The tool description already promises this ("Other turns see caller-visible jobs and scoped counts only"). The owner-only gate blocks the whole tool before that existing caller scope can apply.Evidence from a production Gateway (Telegram group topic, Claude CLI runtime over the MCP loopback):
Automation has no recorded inference account ...) and was auto-disabled.provenance: {kind: "internal_system", sourceTool: "cron"},senderIsOwner: false.automationsgetandrunscalls on that turn both returnedautomations needs the owner's authority, and this turn was not started by the owner. Do not retry automations.runscall returned the failure reason immediately.automationscalls were refused this way, all on automation failure notices.Change
isSchedulerSystemTurn({trigger, inputProvenance}): true only fortrigger === "event"(derived by the session-event executor frominternalEventExecution, which clients cannot set) andinternal_systemprovenance withsourceTool === "cron". This covers scheduler notices and wakes. It excludes scheduled runs (crontrigger, which can carry hook-mapped external content), webhook wakes (hooksource), exec completions (execsource), inter-session input, and client-asserted provenance on theagentRPC (its trigger is neverevent).resolveTurnToolSurfacetakesschedulerSystemTurn. On such a turn, the owner-gatedautomationstool keeps its stable definition (no prompt-prefix change) but its executor is split: actions inCRON_SCOPED_READ_ACTIONS(list,get,runs, the same set the recovery read-only mode uses) run the turn-policy instance; everything else returns the owner gate. The action is read withreadToolStringParam, like the executor.exportedTools/callableTools, so descendants never inherit it.src/agents/agent-tools.ts) and the Gateway MCP loopback used by CLI runtimes (src/gateway/tool-resolution.ts).CRON_SCOPED_READ_ACTIONSmoves to the lightautomations-tool-name.tsso the turn-authority module does not import the cron schema module.Scope boundary
senderIsOwner, toGATEWAY_OWNER_ONLY_CORE_TOOLS, or to any other owner-only tool on system turns.sourceTool: "cron_failure_repair"). When a failure-alert route exists, a failed owned one-shot gets that turn instead of the auto-disable notice. It runs through theagentRPC, where a client can assert the same provenance, so there is no host-only signal to key a read exception on yet. Its brief already embeds the last error. This PR covers the auto-disable notice, which is what installs withcron.failureAlert.enabled: falsereceive.sessionTarget: "isolated"has nosessionKey, so its notice goes to the agent's main session, and that session cannot see a job owned by another chat. That is unchanged scheduler behavior.Verification
Real behavior proof
Final-effect boundaries on a real failed automation (
test/e2e/qa-lab/runtime/system-turn-automation-read-boundaries.e2e.test.ts, new in this update). This runs an isolated in-process Gateway with its own tempHOMEand state dir, the real cron scheduler (clock-controlled), real session-event admission, the embedded runtime, and the realcron.get/cron.list/cron.runshandlers. Model HTTP is the only synthetic part. Two test seams sit around the real code: one pausesreadCronRunHistoryRecordsafter it returns, so a change can be injected during the awaited read, and one records what the realcron.runshandler responded.Owned proof,Closing proof). An owner turn in chat B createsForeign proof. The config hascron.failureAlert.enabled: false, same as the production install.Owned proof. Its run fails (the provider returns 400), and the scheduler disables the one-shot and posts the real notice into chat A:⚠️ Automation "Owned proof" was auto-disabled after 1 consecutive run failures.runs <owned>. While history hydration is paused, an operator callscron.remove <owned>. The handler's disclosure-time recheck returnsAutomation not found: <owned>and no entries.Closing proof, which fails the same way and gets its own auto-disable notice. That notice turn callsruns <closing>. While hydration is paused,chat.abortstops the run. The real handler sends no response at all; it throwsTypeError: agent runtime authority is no longer active. No provider request ever receives that tool result.operator.write(not an owner) sends anagentturn into chat A withinputProvenance: {kind: "internal_system", sourceTool: "cron"}. Itsautomations get <closing>returnsautomations needs the owner's authority, and this turn was not started by the owner. Do not retry automations., because theeventtrigger comes from the host and this turn has theusertrigger.cron.list(operator) showsClosing proofandForeign proof, so the notice turn's refusedremovechanged nothing.Red on base: with the six production files from
main(agent-tools.ts,agent-tools.turn-authority.ts,automations-tool-name.ts,cron-tool-schema.ts,cron-tool.ts,tool-resolution.ts), the same test fails at the first owned read:The original e2e (
system-turn-automation-reads.e2e.test.ts) is kept. It sends a notice through the scheduler's producer and checkslist. It was red on base at the previous head and is green on this head.Existing handler suites cover the boundaries that the e2e does not set up end to end, and they pass on this head:
cron.validation.test.ts(foreign account:keeps new jobs scoped to their creator account while preserving accountless legacy jobs; scheduled-authority session binding;withholds $scope history when client authority closes during the $phase read;rechecks the scoped job after reading history %s),cron.history.test.ts,cron.ownership-matrix.test.ts, andcron-caller-scope.test.ts: 4 files, 161 tests passed.Regression tests (red on base, green here):
src/agents/agent-tools.turn-authority.test.ts: reads (list,get,runs) reach the executor;status/add/update/remove/run/wake/missing action stay gated;gatewaystays gated; nothing is exported to descendants; a completion handoff's requester denial wins; reads run the turn-policy instance; theisSchedulerSystemTurnmatrix (event/cron/user trigger, cron/exec source, inter_session kind).src/gateway/tool-resolution.exclude.test.ts(MCP loopback surface with a real admitted run context): reads are served only fortrigger=event+internal_system/cron. They are refused for ausertrigger with spoofed provenance, anexecsource,inter_session, and missing provenance.updateandgatewaystay gated in every case.Consumer suites on this head:
agent-tools.turn-authority,tool-resolution.exclude,agent-tools.prefix-stability,cron-tool,cron-tool.automation,agent-tools.create-openclaw-coding-tools,agent-tools.construction-routing,gateway-tool.assembly,agent-tools.session-portal,cli-runner/prepare.completion-tools,agent-tools-agent-config: 11 files, 252 tests pass. Root test tsgo shards (includingtest-root-e2e) pass.Merge conflict:
mainmerged in (merge commit, no rebase). The only conflict was inagent-tools.turn-authority.ts. The resolution keepsmain's removal of the unusedwithheldinput, andschedulerSystemTurnplus the split executor are unchanged.check:changedagainstmain(run locally;main's pinned pnpm 12.15.0 is newer than this host's minimum release age, so the run used the installed pnpm): format, lint, core tsgo shards, assertion SAFETY and line-cap ratchets pass for the changed files. Three checks fail on files outside this diff: the max-lines suppression ratchet (threeui/files), the core test shard root budget (gateway-root: 724,infra: 738> 720; this PR adds no core test roots), and the full-tree dead export scan (exports in heartbeat, channels, and other files that this PR does not touch).Performance:
resolveTurnToolSurfacemicro-benchmark (75 tools, 15 owner-only denied, scheduler turn, 2000 warmup + 15x5000 calls, Node 24.19, same host), three runs each. Median µs/call: base 10.23 / 10.56 / 9.64, PR 9.98 / 10.67 / 10.42. No measurable difference. The merge frommainonly removed the unusedwithheldfilter from this function.What was not tested
HOME, and a real model would pick its own tool calls, so the boundary cases could not be scripted. The loopback assembles the sameautomationstool, which calls the samecron.get/list/runshandlers, andresolveGatewayScopedToolsis covered with a real admitted run context. The embedded runtime is proven end to end above.tools.toolSearch/ code mode dispatch on the notice turn (the e2e turns both off).