Repository navigation
fix(agents): resolve scheduled account policy in the caller registry - #184164
igs-rogenlo wants to merge 4 commits into
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: blocked before merge. What this changesResolve scheduled account availability and group tool policy through the caller’s loaded channel registry. Example: The caller’s WhatsApp registry contains account work, while the process-root registry has no WhatsApp registration.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this PR fixes a current registry-scope mismatch with no actionable code findings; draft status and current-head maintainer security approval remain. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherAgent tool-policy resolution consumes session identity, account identity, configuration, and channel registrations to return group restrictions or reject unavailable scheduled authority. flowchart TD
A[Scheduled job] --> B[Caller runtime scope]
B --> C[Group tool policy]
C --> D[Loaded channel registration]
D --> E[Account roster and group restrictions]
E --> F[Agent tool execution]
F --> G[Gateway provider read]
Technical reviewBest possible solution: Use the existing scoped registration resolver while retaining loaded-only lookup, named-account rejection, and final-effect authority checks. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically consults the process-root plugin rather than the scoped registration; the contributor reports both focused registry regressions fail on the pinned base and pass with the fix. Is this the best way to solve the issue? This is the smallest complete production repair: change the lookup at the shared policy owner without introducing another registry, fallback, cache, or configuration option. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 92415c1e5fe7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +682. Total +682 across 4 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 26, 2026, 6:24 AM ET / 10:24 UTC (Revision 4). |
|
@clawsweeper re-review Updated head: Added three native Gateway/scheduler-to-agent/provider-read cases: an authorized account reaches the expected Discord message read; a root-present account removed from the scoped roster is rejected before model/provider I/O; disabling an active occurrence prevents the pending message read. The product suite, formatting, typed lint, gateway-server types and independent static review passed. The PR body separates the synthetic model/HTTP responses and prepared-registry hooks from native policy, admission and dispatch. It also documents the separate Gateway account-owner requirement and the read-only effect. Current-head maintainer/security approval is still required before landing. |
|
🦞👀 Re-review progress:
|
Recorded scheduler-to-tool evidence for PR #184164Published content: The append traces below were written during the actual isolated execution. The HTTP arrays, model observations and completion fields were captured by that same fixture; they are not manufactured from assertions. Account/channel/message identities use aliases, credentials and local paths are removed, and provider paths retain only their shape. The original artifact hashes appear below. This is a redacted projection, not a byte-identical copy of the originals. The positive path needs the account in both the prepared scoped registry and the Gateway registry. Prepared registry acquisition and account rosters are test hooks; registration custody/read grants, scheduler admission, agent execution and message dispatch remain native. The model and Discord HTTP servers are synthetic. Effects shown are Discord read GETs, not send/write, live Discord or production behavior. Authorized readObserved data: The append stream records two tool-http arrivals and a tool-result returned to the model continuation. The separate captured HTTP array records GET for the channel metadata and message-list routes, with authorizationMatches=true. Recorded completion is ok. Append trace (original order and millisecond timestamps retained; redacted): {"kind":"fixture-start","at":1793002965185}
{"kind":"registry-install-start","at":1793002993975}
{"kind":"gateway-start","at":1793003000690}
{"kind":"gateway-ready","at":1793003026738}
{"kind":"prepared-runtime-ready","at":1793003026839}
{"kind":"job-created","at":1793003045521}
{"kind":"native-registry-authority","at":1793003045539,"rootHasAccount":true,"scopedHasAccount":true,"rootReadCurrent":true,"scopedReadCurrent":true}
{"kind":"scheduler-dispatch","at":1793003045539,"mode":"success"}
{"kind":"model-request","at":1793003055876}
{"kind":"tool-http","path":"<provider-prefix>/channels/<channel-A>","at":1793003061931}
{"kind":"tool-http","path":"<provider-prefix>/channels/<channel-A>/messages","at":1793003061945}
{"kind":"model-request","at":1793003062048}
{"kind":"tool-result","at":1793003062049,"text":"{\"ok\":true,\"channelId\":\"<channel-A>\",\"messages\":[{\"id\":\"<message-A>\",\"channel_id\":\"<channel-A>\",\"author\":\"<author-A; identifying fields redacted>\",\"content\":\"<synthetic message content redacted>\",\"attachments\":[],\"embeds\":[],\"type\":0,\"timestamp\":\"<synthetic timestamp redacted>\"}]}"}
{"kind":"finished","at":1793003062396,"status":"ok"}Recorded HTTP/model/completion fields (redacted): {
"recordedHttpRequests": [
{
"method": "GET",
"path": "<provider-prefix>/channels/<channel-A>",
"authorizationMatches": true
},
{
"method": "GET",
"path": "<provider-prefix>/channels/<channel-A>/messages",
"authorizationMatches": true
}
],
"recordedModelObservation": {
"requests": 2,
"messageToolAdvertised": true,
"toolOutput": {
"ok": true,
"channelId": "<channel-A>",
"messages": [
{
"id": "<message-A>",
"channel_id": "<channel-A>",
"author": "<author-A; identifying fields redacted>",
"content": "<synthetic message content redacted>",
"attachments": [],
"embeds": [],
"type": 0,
"timestamp": "<synthetic timestamp redacted>"
}
]
}
},
"recordedCompletion": {
"action": "finished",
"status": "ok",
"completionStatus": "succeeded",
"deliveryStatus": "not-requested",
"runAtMs": 1793003046584,
"durationMs": 15784
}
}Assertion/interpretation boundary: The test separately asserts the expected returned message and native owner/policy bindings; those assertions are not additional trace events. Scoped account absent while root retains itObserved data: The recorded registry facts are rootHasAccount=true and scopedHasAccount=false, with both read-custody checks current. The trace ends with the unavailable-account error. The recorded HTTP array is empty and model.requests is 0. Append trace (original order and millisecond timestamps retained; redacted): {"kind":"fixture-start","at":1793003062640}
{"kind":"registry-install-start","at":1793003064872}
{"kind":"gateway-start","at":1793003064883}
{"kind":"gateway-ready","at":1793003076123}
{"kind":"prepared-runtime-ready","at":1793003076158}
{"kind":"job-created","at":1793003081397}
{"kind":"native-registry-authority","at":1793003081413,"rootHasAccount":true,"scopedHasAccount":false,"rootReadCurrent":true,"scopedReadCurrent":true}
{"kind":"scheduler-dispatch","at":1793003081413,"mode":"scoped-removed"}
{"kind":"finished","at":1793003083082,"status":"error","error":"Scheduled account \"<account-A>\" is unavailable. Re-add it to the channel configuration, or recreate this automation from the intended account."}Recorded HTTP/model/completion fields (redacted): {
"recordedHttpRequests": [],
"recordedModelObservation": {
"requests": 0,
"messageToolAdvertised": false
},
"recordedCompletion": {
"action": "finished",
"status": "error",
"completionStatus": "failed",
"deliveryStatus": "not-requested",
"runAtMs": 1793003082468,
"durationMs": 576,
"error": "Scheduled account \"<account-A>\" is unavailable. Re-add it to the channel configuration, or recreate this automation from the intended account."
}
}Assertion/interpretation boundary: The test keeps the scoped Discord registration, removes only the scoped account roster entry, and asserts denial before model/provider I/O. Zero recorded requests applies to this bounded fixture observation window. Disable active occurrence before the message-list readObserved data: The append stream records metadata tool-http, pre-read-barrier, revoke-requested, revoked, pre-read-released, then finished with the operator-disabled error. The captured HTTP array contains only the metadata GET and model.requests is 1. No message-list request is recorded. Append trace (original order and millisecond timestamps retained; redacted): {"kind":"fixture-start","at":1793003084976}
{"kind":"registry-install-start","at":1793003087505}
{"kind":"gateway-start","at":1793003087516}
{"kind":"gateway-ready","at":1793003098888}
{"kind":"prepared-runtime-ready","at":1793003098926}
{"kind":"job-created","at":1793003103938}
{"kind":"native-registry-authority","at":1793003103952,"rootHasAccount":true,"scopedHasAccount":true,"rootReadCurrent":true,"scopedReadCurrent":true}
{"kind":"scheduler-dispatch","at":1793003103952,"mode":"active-revocation"}
{"kind":"model-request","at":1793003111057}
{"kind":"tool-http","path":"<provider-prefix>/channels/<channel-A>","at":1793003111372}
{"kind":"pre-read-barrier","at":1793003111373}
{"kind":"revoke-requested","at":1793003111373}
{"kind":"revoked","at":1793003111436}
{"kind":"pre-read-released","at":1793003111436}
{"kind":"finished","at":1793003111458,"status":"error","error":"Cron job disabled by operator."}Recorded HTTP/model/completion fields (redacted): {
"recordedHttpRequests": [
{
"method": "GET",
"path": "<provider-prefix>/channels/<channel-A>",
"authorizationMatches": true
}
],
"recordedModelObservation": {
"requests": 1,
"messageToolAdvertised": true
},
"recordedCompletion": {
"action": "finished",
"status": "error",
"completionStatus": "failed",
"deliveryStatus": "not-requested",
"runAtMs": 1793003104963,
"durationMs": 6450,
"error": "Cron job disabled by operator."
}
}Assertion/interpretation boundary: The revoked marker is emitted after native cron.update returns enabled=false; its exact response is asserted but not separately serialized. The barrier/release markers are fixture instrumentation. This proves the tested disablement interleaving, not arbitrary in-flight revocation timing or outbound sends. Terminal excerptSelected terminal lines from the same execution, with local paths redacted. Build warnings and most lifecycle cleanup lines are omitted here; ProvenanceAll digests are SHA-256 of the original, unredacted retained artifact bytes. Redacted bytes necessarily have different digests. No private local path is required to identify these source artifacts.
Source binding to published content:
The two added test files match the pre-run manifest and published blobs. The policy, original policy tests and model helper match both parent and published blobs. Each append JSONL also equals its scenario JSON trace array before redaction. The native wrapper completed its source verification. This is local runtime evidence, separate from the earlier 17 policy regressions and hosted CI. Maintainer authorization and security review remain required; this attachment grants neither. Full redacted terminal log for PR #184164This is the already recorded native test-wrapper log from the frozen staged candidate later committed unchanged as Original retained log SHA-256: Complete redacted terminal output |
|
@clawsweeper re-review The existing recorded runtime evidence requested by the latest review is now attached: three scenario traces plus the complete redacted terminal log. The PR body links it. Head remains The attachment includes the observed authorized GETs, scoped rejection with zero recorded requests, and active disablement before message retrieval, with original hashes and source-content binding. It distinguishes observed records from assertions and retains the fixture, read-effect and cleanup limitations. Maintainer authorization remains required. |
|
🦞👀 Re-review progress:
|
|
73960b1 to
e57553b
Compare
|
This is ready for the maintainer security review of GitHub reported a conflict with |
Related: #150278, #178677.
What Problem This Solves
Fixes scheduled jobs reporting an available named account as unavailable when their channel plugin exists only in the current runtime registry scope.
User Impact
Scheduled account checks and group tool policy use the current channel implementation. A scoped account removal continues to deny the run even if the process-root implementation still lists that account. No configuration, stored-job or credential migration is added. Legacy jobs without authenticated creator origin still require native reauthorization; this does not repair their missing provenance.
Why This Change Was Made
Use the existing channel registration resolver with
loadedOnly: trueinstead of the process-root lookup. This retains loaded-only behavior and the existing account guard without adding a registry, cache or fallback. Distinct native registry owners cover the policy regression, and three additional isolated product cases exercise the scheduler through actual message execution and cancellation.Evidence
Update 2026-11-25: rebased onto
mainat79e42e0877d9. On the rebased head,agent-tools.policy.test.tspasses 20/20 locally (18/20 withmain's unmodified policy file;mainadded two tests to that file), the three Gateway product cases pass, and the mock-export and test-line ratchets pass. The test counts, commit ids and hosted-CI statements below describe earlier heads.The existing policy suite has 17 passing tests: the two registry regressions fail on base
925d43df5722e6f3aa2abdce4912042b2753f3ebwhile the 15 existing tests pass. Those policy tests remain unchanged in this follow-up.The added product suite passes all three cases through the real Gateway, admitted local automation creation, scheduler, embedded agent and Discord message-action path:
/messagesGETs.work, while root still lists it, the scheduler rejects before any model or provider request.cron.update, then releasing the response ends the occurrence as disabled by operator. No/messagesrequest is sent.The test hooks select the prepared runtime registry and supply account rosters; this does not validate production prepared-registry acquisition itself. The model HTTP endpoint and Discord HTTP responses are also synthetic. Policy decisions, registration custody/read authority, occurrence admission, agent execution and dispatch are native. The local creator is a harness-admitted principal, not a live human channel session. Discord credential-only reads delegate to the Gateway, so successful execution also requires the account in the Gateway owner. These cases do not claim that a scoped-only account bypasses that second owner.
This is provider read-effect evidence, not live Discord, send/write, notification, production-deployment or hosted-CI proof. The earlier isolated published-2026.10.7 policy/cron probes remain separate pre-execution evidence and are not substituted for these source product tests. Normal current-head maintainer/security review is still required before landing.
Validation of this follow-up on commit
0ced7be2a363c7ed259929f43146d594e1fa10f1:925d43df5722e6f3aa2abdce4912042b2753f3ebcompleted through P2 with no actionable findings; its final source verification passed. This was a static review, separate from the executed tests above.Recorded runtime output
The three recorded scenario traces and complete redacted terminal log show the authorized metadata/message GETs, the scoped-account rejection with zero recorded model/provider requests, and active disablement before the message-list request. The attachment preserves observed event order and native completion fields, separately labels assertion explanations, and binds the original artifact hashes and five source-file hashes to this published content.
This is the existing execution of the frozen staged candidate subsequently committed unchanged as
0ced7be2a363c7ed259929f43146d594e1fa10f1, not a post-commit rerun. Synthetic endpoints, identities, credentials and private local paths are redacted. The original retained-namespace warning is included; the log is not presented as a blanket descendant-cleanup guarantee. Maintainer security authorization is still required before landing.CI repair follow-up
The incremental test-only correction is committed as
46cbc61b97ef5669fa71c6a4f197c7ab6ef7805b, directly on the previously published head above.withinTest/awaitGateBeforeSettlementhelpers and Vitest's nativeit.fortest signal, retaining the existing assertions and 300-second case timeout.node-exec-availabilityexports in the partial mock.CI=1mode with an isolated Node 24.22.1 toolchain: 3/3 passed, including scoped-account removal and active revocation. Endpoint/principal limitations above still apply.0ced7be2a363c7ed259929f43146d594e1fa10f1(--no-merge-base). This is validation of the incremental repair, not a current-main merge or hosted-CI result.Independent read-only P0–P3 review of this exact incremental commit found no actionable defects; it did not rerun tests or grant security-policy approval.
Production code is unchanged by this follow-up. Current-head maintainer/security authorization is still required before landing.
Test-line allocation and current CI limits
The native scheduled-account acceptance adds 577 test/support lines in total. The current trusted CI checker supports per-change allocations under
config/test-lines-allocations; this PR requests exactly 577 lines there. The global baseline and checker remain unchanged. This allocation retains the real Gateway/SQLite success, scoped-account removal and active-revocation cases rather than replacing the owning runtime with mocks. The three product cases passed on the previously published test revision; their code and assertions are unchanged by the allocation.The latest run of that published revision passed the mock-export and timeout-race ratchets but failed the separate test-line ceiling (556 over the merged-tree ceiling, net +577). The allocation addresses that accounting failure only. A separate Darwin tooling workflow checked out this older PR branch and requested
test/scripts/pr-dependency-cache.test.ts, which does not exist on that branch. That workflow failure and the required maintainer/security approval are not reported as green.Additional current-stable policy-owner probe — 2026-11-05
Executed the real published OpenClaw 2026.10.10 group-policy function with native registry scopes, without starting jobs or sending channel traffic. The baseline rejects an account available only in the scoped channel, accepts a root account removed from the scoped channel, and returns the root policy instead of the scoped policy. Substituting the exact two-line resolver change fixes all three scenarios: the scoped account is accepted, the removed account is rejected, and the scoped
deny: [exec]policy is returned.The candidate probe uses a process-local module load hook; the installed package remains unchanged. An initial strict assertion incorrectly treated an explicit
allow: undefinedproperty as a policy difference; assertions were corrected to check both policy fields, and both baseline and candidate runs then completed. This is policy-owner execution with synthetic channel registrations, not a repeat of the product Gateway suite or a live scheduled-channel acceptance.Hosted status remains separate: Darwin is still failed at Test dependency cache lifetime, ci-gate still reports failure, and security-sensitive review is pending. The current job metadata confirms the failed step; the CLI returned no retained log lines for that job in this check, so that absence is not evidence of a passing run. No hosted green, production deployment, or maintainer authorization is claimed.