Repository navigation
Conversation
…requester Occurrences of requester-scheduled plugin commands built their native tool surface like a live turn with no sender: the guest `toolsBySender["*"]` entry applied, the requester's recorded channel account was not used for group and channel tool policy, and a removed requester account was not refused. Resolve the job's stored scheduled tool policy once, as capped automations do, and pass it to admission and native tool preparation. Command schedules record no creator origin, so the schedule's own channel (captured from the live command and checked against the stored job on every occurrence) stands in for it. In account mode, refuse an unavailable requester account by name before the occurrence accepts any input.
|
🦞👀 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 changesScheduled plugin command occurrences use the requester's recorded account policy for admission and native subagent preparation. Example: Telegram account "team" is removed after its requester schedules a plugin command.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current policy gap with a focused change and supplied Gateway evidence; no actionable patch defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway restores requester-bound plugin schedules from cron jobs, validates their live authority, and dispatches commands whose native children receive the resolved tool ceiling. flowchart TD
A[Requester command] --> B[Stored cron schedule]
B --> C[Gateway occurrence runner]
C --> D[Current requester and account policy]
D --> E[Command admission]
E --> F[Native subagent preparation]
Technical reviewBest possible solution: Use the existing scheduled-policy resolvers consistently across command admission and native child preparation, as this patch does. Do we have a high-confidence way to reproduce the issue? Current-main source confirms the missing policy propagation, and the supplied built-Gateway comparisons reproduce wildcard failure and skipped account restrictions; this review executed no target code. Is this the best way to solve the issue? The patch is the smallest complete repair shown: it resolves policy through existing owners, checks the account before input, and supplies the same context to both consumers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f0ef6dbc6416. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +27, Tests +125, Docs +4, Other +2. Total +158 across 6 files. Added test files: 0. 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 (3 earlier review cycles)
Reviewed November 3, 2026, 3:47 AM ET / 08:47 UTC (Revision 4). |
…r check The shared gate admits any account id its channel still lists, so the comment should not promise that every removed account refuses.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Resolve two conflicts with main 5918b1d: - config/test-lines-baseline.txt: keep main's shared scalar (6320804). Main now budgets new test lines with per-change allocation records, so the test growth of this change (net +125 lines) moves to config/test-lines-allocations/scheduled-command-tool-policy-186281.txt. - commands-plugin.scheduled-turns.test-support.ts: keep both sides. The fixture body stays a named function so it can pass the requester session key to withAdminIngress, and it now takes main's resolveGatewayContext and legacy SDK resource host.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Closes #186281
What Problem This Solves
Fixes: occurrences of requester-scheduled plugin commands resolve tool policy like a live turn with no sender, so the guest
toolsBySender["*"]entry applies to them (with a subagent deny there, every occurrence fails), and the requester account's current tool policy and the removed-account refusal are skipped.User Impact
User impact: scheduled command turns resolve tool policy the way capped automations do. Guest wildcard sender entries no longer apply to them, each occurrence uses the requester account's current group/channel tool policy, and an occurrence whose requester account its channel no longer lists is refused before it runs, naming the account. As for capped automations, sender-specific
toolsBySenderentries, including"*", no longer apply to occurrences, and a later change to the requester's own entry does not reach existing schedules. Plugin schedules now share the capped-automation account check, so open reports of false refusals there (#156895, #186008) would affect them too until that check is fixed.Why This Change Was Made
Each occurrence now resolves the job's stored scheduled tool policy once, as capped automations do, and passes it to both admission and native tool preparation (before, preparation never received it). Command schedules record no creator origin, so the schedule's own channel (captured from the live command and checked against the stored job on every occurrence) stands in for it; schedules created from a direct chat on a named account keep working, where a capped automation without a recorded origin would refuse them. The account check runs right after the source check, before the occurrence accepts any input. The background-work docs now say how scheduled command turns resolve tool policy.
Evidence
Real Gateway (built
dist, isolated state, WebChat operator overchat.send, local stub provider, a plugin with requester-command scheduled turns,tools.toolsBySender["*"]denyingsessions_spawn/agents_wait), schedule created then the occurrence forced withcron.run:main5918b1d7bf4error: Scheduled command requires current native subagent eligibility.f758a1abbef)okcommands-plugin.scheduled-turns.test.ts(repo fixture: real plugin loader, cron service, channel ingress): onmainthe wildcard case and the account case fail at their assertions (the child losesread; a later deny for the requester's account is not applied), the direct-chat case passes; with the fix all three pass, together with the existing scheduled-turns, scheduled-turns-restart,plugin-command-scheduled-runandoperator-authoritytests (117/117 on the current head). The new cases take 2.3-2.5 s each; the whole file runs in 92 s alone (--maxWorkers=1, 31 tests), so they add about 8% to an existing fixture-heavy suite. The fixture now loads a minimal Discord channel that lists the configured accounts and resolves conversation tool policy like the Discord plugin; without a loaded channel, any configured-account check refuses every fixture occurrence.tsgo:core, core test shards, oxlint, oxfmt,git diff --check, line-cap and max-lines ratchets: clean.Test lines: the new tests add 125 net test lines (
commands-plugin.scheduled-turns.test.ts+97, its test support +26,operator-authority.test-support.ts+2), recorded inconfig/test-lines-allocations/scheduled-command-tool-policy-186281.txt. Each of the three cases covers a policy source no existing test reaches (guest wildcard entry, requester account, direct-chat named account), and the fixture needs a loaded channel that lists the configured accounts.Named account, real Gateway (built
dist, isolated state, fake Telegram Bot API, named accountteam, supergroup requester whose sender is linked to an admin profile withusers.linkChannelIdentity, local stub provider, the same plugin), occurrences forced withcron.run. Phase A: an allowed child reads a sentinel file. Phase B: two children withtools.swarm.maxConcurrent: 1, the first held at the provider so the second is queued, then the change. Phase C: the first occurrence after the change. Two runs per build and change:config.patchon accountteam)main5918b1d7bf4ok; its child hasreadand reads the fileerror: Scheduled account "team" is unavailable. Re-add it to the channel configuration, or recreate this automation from the intended account. No command ran, no childmain5918b1d7bf4groups["*"].tools.deny: ["read"]ok; its child hasreadand reads the filegroups["*"].tools.deny: ["read"]ok; its child has noreadBoth changes need a Telegram channel reload, which waits for running work (
deferring until ... complete), so the queued child runs under the old configuration on both builds; only phase C differs. This branch was measured atf758a1abbef.Registry used by the account check: the occurrence's source check compares the Gateway's current plugin registry with the one it captured on entry, and the account check runs right after it with no
awaitin between, so the process-root registry it reads is that captured registry. Instrumented builds ofmainand this branch on the named-account setup above (reload or config change while the occurrence waits for its parent session's turn) recorded the same object for the scheduled runner's scoped registry, the published registry and the process root at every point read: the account check, child tool policy, command runtime and execution admission. A registry published during the wait, including by a plugin that declaresreload.turnHandoverand is replaced mid-turn, makes the occurrence refuse at its next check withScheduled plugin command source changed or expired.before any input, onmainand on this branch alike; channel configuration changes wait for the running occurrence. On this setup the job carries no cron-level operator source, so its launch does not wait for the parent session; a wait at launch was not exercised.