Repository navigation
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 changesThis PR passes the prepared scheduled policy into script admission so message actions retain their recorded creator origin. Example: An account-a scheduled script requests deletion of Telegram message 456 in chat 123.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: current main still needs this focused creator-origin handoff repair; no actionable patch defects were found, and exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe cron runner prepares tools and admits each occurrence, then carries its private message capability through Gateway account checks and channel-owned authorization to provider I/O. flowchart TD
A[Stored job and creator origin] --> B[Runtime policy preparation]
B --> C[Occurrence admission]
C --> D[Private message capability]
D --> E[Gateway account and origin checks]
E --> F[Provider conversation authorization]
F --> G[Guarded provider I/O]
Technical reviewBest possible solution: Land the prepared-policy handoff while keeping persistent Telegram conversation authorization within the separately tracked capability work. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the lost-origin handoff, and the supplied red/green regression targets that boundary; this read-only review executed no target code. Is this the best way to solve the issue? Using the same resolved policy for preparation and admission is the smallest complete fix and preserves provider restrictions and occurrence liveness. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 51959d9247b7. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +2, Tests +161, Docs +2. Total +165 across 6 files. Added test files: 0. 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 (4 earlier review cycles)
Reviewed October 26, 2026, 3:28 PM ET / 19:28 UTC (Revision 5). |
|
@clawsweeper re-review Updated head: The scope is explicitly corrected: this repairs core creator-origin handoff, not end-to-end account-bound Telegram deletion. The real adapter still requires provider-observed conversation binding and denies that account-bound case without provider HTTP. No routing metadata is promoted to authority; the independent provider-context requirement remains outside this PR. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Added new shipped-entry-point evidence to the PR body for unchanged head The proof is explicitly split: the requested boundary was observed, but the wrapper remains FAIL because its stricter zero-attempt assertion found one ancillary catalog lookup blocked before external resolution/connection. The failure is preserved and disclosed, not relabeled green. This is synthetic loopback evidence, not live Telegram proof; product code and the successful exact-head CI are unchanged. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
openclaw#180565) Use the prepared cron runtime's resolved creator-origin policy when admitting scheduled script tools. This keeps recorded creator authority available at admission while preserving the separate Telegram provider-binding check. Retain the Gateway-handler regression and focus the surrounding fixtures on admission behavior. Related: openclaw#180537 Co-authored-by: InsanusMokrassar <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Upstream head 48ab4a7. The ledger records the carry of 2ef2ffabe408 as 103a179, but this branch already matches the PR through 88ee80c ("flag reauthorization only for jobs that construct agent tools"): src/cron/tools-allow.ts and tools-allow.test.ts are byte-identical to that commit, scheduled-tool-policy.ts and its test to the head, and the output-schema fields and their contract test from 3dbda92 are present. The head was rebased since; its first commit differs from 2ef2ffabe408 only in main's cron-list-projection refactor. This carries what came after 88ee80c: - b9e0da0 "flag scripts only when their preparation admits the account": a script (payload or condition) with a cap that constructs no agent tools never resolves a capability profile unless it names MCP, so it never reaches the scheduled-account guard, but cronJobNeedsCreatorReauthorization still flagged it. The branch's trigger-script.ts has the same shape (capability profile only from createTools when toolPlan.constructTools, or from acquireMcpTools behind the MCP gate), so the defect is present. tools-allow.ts takes the commit as is; trigger-script.ts uses the shared cronScriptReferencesMcp for its MCP gate. - 4b02417: the troubleshooting entry no longer guesses the cause. Both causes it names hold here: the guard returns before the account list is read (agent-tools.policy.ts), and an executable edit without fresh creator authorization drops the recorded origin (jobs-tool-policy.ts). - The test-lines allocation (48ab4a7), with this delta's net count. Adaptations: - trigger-script.account-policy.test.ts does not exist here (main's file, from openclaw#180565). The PR's new case is carried as that file's only test, at main's path. It uses createOpenClawTestState for the workspace (no withCronStore here) and drops the occurrence parameter, which this branch's script invocation does not take. - run.account-policy.test.ts: the branch's table uses object rows; the PR's empty-cap DM row and its detector-vs-outcome check are added in that shape. Not applicable: 3596448 drops an unused active-jobs import from cron-tool.output-contract.test.ts. Here that import is used (lines 116 and 140, as in the v2026.11.2 tag). Proof (M4, Node 26.12.1, --maxWorkers=1): - trigger-script.account-policy.test.ts, run.account-policy.test.ts, tools-allow.test.ts and the seven other trigger-script test files (trigger-script.test.ts and its six siblings): 10 files, 67 tests passed (43 + 24). The new empty-cap DM agent-turn row fails closed with "no recorded creator channel", so the branch's isolated executor checks the account whatever the cap, as the PR assumes. - Red-before, tools-allow.ts and trigger-script.ts reverted: trigger-script.account-policy.test.ts fails at its first case, the empty-cap script payload ("payload []: ... expected true to be false": the runtime completed and the detector said blocked); 1 failed, 8 passed of 9. run.account-policy.test.ts passes before and after: its new row guards that agent turns keep the flag.
Related: #180537
Related: #166518
What Problem This Solves
Fixes scheduled script message actions rejecting a matching recorded creator origin at core admission.
User Impact
Scripts retain the same creator account and origin through preparation and admission. Channel-owned checks still apply: account-bound Telegram deletion still requires authenticated current-conversation binding, which this change does not add.
Why This Change Was Made
Admission now consumes the already-prepared scheduled policy instead of the bare persisted policy. No new authority, configuration, storage format, or fallback is introduced. Thanks @InsanusMokrassar for the fix and original proof.
Evidence
Scheduled telegram:delete requires matching recorded creator origin; the same test passes with the fix. Matching, missing, unknown, and wrong-channel origins are checked across repeated invocations.@solidjs/vite-plugin, oxlint lackedeslint-plugin-solid, and the type wrapper refused dependencies physically outside the checkout. Formatting still passes; exact-head CI supplies the integrated proof.Prior contributor proof and limitations at 5f65ebe
Related: #180537
Related context: #166518
What Problem This Solves
Fixes scheduled script message actions receiving a missing creator origin at core admission even when the job retains a matching recorded origin.
User Impact
This fixes the core admission handoff, not end-to-end account-bound Telegram deletion. The bundled Telegram adapter separately requires authenticated current-conversation binding. A recorded channel/account origin alone does not supply it, so those scheduled mutations remain denied before provider HTTP.
No creator origin or conversation authority is inferred from routing, no account-bound job is upgraded to operator authority, and provider target checks remain unchanged. Supporting account-bound scheduled Telegram mutations needs a separately agreed authority-capture and revocation contract; this PR does not introduce one.
Why This Change Was Made
Script preparation already resolves the recorded origin into the scheduled policy context. Admission now consumes that same prepared context instead of the bare persisted policy. This completes the core handoff left outside the preparation/cache fix in #176158.
Evidence
Synthetic loopback CLI/Gateway evidence — split result
The requested admission boundary was observed; the proof wrapper remains
FAIL. Its separate zero-network-attempt assertion failed on a blocked ancillary plugin-catalog lookup, as detailed below.At clean HEAD
5f65ebe03dc621f0f6e5b9d0dc621cc48306f5de, the normalscripts/run-node.mjslauncher ran separate Gateway and CLI processes. HOME, state, config, workspace, caches, and the Gateway port were isolated. Only the external Telegram Bot API and model responses were loopback fixtures with synthetic identities and credentials; this is not live Telegram-service proof.The shipped Telegram poller received the synthetic inbound message, the normal inbound owner allowlist resolved the creator, and the shipped agent
automationstool created the job through Gatewaycron.add. No product source was instrumented, no creator origin was supplied as a job argument or injected into storage, and no routing metadata was promoted to authority. After shutdown, a read-only query of the test-owned SQLite row returned these selected fields:{ "scheduledToolPolicy": { "version": 1, "mode": "account", "ownerAccountId": "proof" }, "payload": { "toolsAllow": [ "message" ] }, "toolsAllowProvenance": { "version": 1, "source": "final-executable-surface", "callerOrigin": { "kind": "external", "channel": "telegram" } } }channelRequesterwas absent in the stored provenance.Redacted command transcript (connection/auth arguments and generated identifiers omitted):
Selected fields from the actual
automations runJSON stdout:{ "completed": true, "status": "error", "completionStatus": "failed", "run": { "error": "cron script payload failed (internal_error): Error: Error: Delegated Telegram message mutation requires a provider-observed binding to the exact current topic and account.\n at openclaw-code-mode:user.js:1:7", "deliveryStatus": "not-requested" } }The CLI exited 1 because the provider-owned refusal is intentionally retained. Reaching this distinct Telegram check demonstrates that the matching recorded origin passed core admission without granting conversation authority. The fixture recorded zero Telegram mutation calls after the scheduled CLI-run baseline, and zero
deleteMessagecalls in the complete final trace. Normal synthetic startup and agent-reply traffic occurred before that baseline.Failed-check disclosure: the wrapper still reports
RESULT=FAIL; it was not relaxed or relabeled. Its stricter zero-attempt assertion detected onegetaddrinfo("clawhub.ai")call from Gateway plugin-catalog prewarming. The process guard returnedEAI_FAILbefore the real resolver or TCP/TLS/HTTP. No non-loopback IP connection was observed under that guard; allowed IP targets were only the two proof loopback ports. This proves the bounded admission-to-provider-refusal behavior, not zero attempted lookups. Guard self-test wrappers are not reported as green. Public dependencies/runtime artifacts were staged before the final guarded run, so the entire setup/troubleshooting session is not claimed to have been offline.Both Gateway and fixture were stopped after the run; the checkout remained clean. Build metadata matched the same commit:
2026.10.6-5f65ebe03dc6-2026-10-24T06-56-32.872Z.The follow-up regression uses the real
CronService.runoccurrence lifecycle, script runtime, in-process Gateway handler, bundled Telegram adapter, and Bot API client. Only external Telegram HTTP is replaced by the repository fixture; there is no synthetic provider action callback or always-current occurrence predicate.deleteMessagewith the expected chat and message IDs. This is a control, not a recommendation to reauthorize an account-bound job as trusted.getChatlookup: the still-active occurrence emits the expecteddeleteMessage; disabling the real occurrence before releasing lookup emits zero deletes. The lookup began before revocation and is not counted as mutation I/O.Provider-proof validation before upstream integration: 5/5 provider-boundary tests passed, the owning
test-root-othertype graph andtest-root-e2egraph passed, targeted lint had no warnings/errors, and formatting/diff checks passed. The earlier core regression and 116 selected checks passed for the unchanged original repair at7b01230e.The provider-proof rerun reused a completed isolated repository runtime build (
OPENCLAW_E2E_SKIP_BUILD=1):OPENCLAW_E2E_SKIP_BUILD=1 OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs test/cron-script-telegram-delete.e2e.test.ts --maxWorkers=1 node scripts/run-tsgo-core-test-shards.mjs --ci-graphs-json '["test-root-other"]'CI compatibility follow-up —
5f65ebe0CI on
b63429daexposed a real fixture/API compatibility failure after upstream made per-occurrence admission mandatory: the added core regression omittedoccurrence, causing both a type error and a runtime failure. The branch was integrated with upstream648528a15470451db1d6b89ad35a829630372ec3, and the regression now supplies the existingTEST_SCHEDULED_OCCURRENCEfixture. No production guard or authority contract was changed.Before committing this integrated candidate, focused validation passed: account-policy 3/3, Telegram provider 5/5, overlapping cron siblings 30/30, the owning
services-cronandtest-root-othertype graphs, targeted lint on all six PR files, formatting, and diff checks. These are the local preparation results for the same source now published in5f65ebe0. Hosted CI for this exact head has also completed successfully, including the previously failingcheck-test-types-core-5and the aggregateopenclaw/ci-gate. Security Review, CodeQL, and OpenGrep passed as well.A fresh canonical independent
autoreviewof all six PR files against that frozen upstream base completedscoped-clean, with no actionable P0–P2 findings. It covered the occurrence fixture, hydrated-policy handoff, real-provider denial boundary, and paired active/revoked lookup controls.The earlier broad changed-path type wrapper, on the pre-integration branch, compiled all 29 graphs but exited nonzero on source-only shard-size budgets (
gateway-root: 726/720;infra: 737/720). This newtest/file belongs to neither collector. Those limits were not changed, and the broad wrapper was not rerun or reported green after integration.No live Telegram service or private production state was used. This does not demonstrate successful account-bound scheduled Telegram deletion or resolve its separate provider-context requirement.