Repository navigation
refactor(cron): admit legacy scheduled requesters through operator admission - #205346
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. |
…mission A cron job saved without an operator source takes its owner bit from the grant admission gives its channel or profile requester, at each run and each scheduler turn about the job. Delete checkRequesterOwner and the requesterOwner capture in session events and cron-job-turn-target. Co-authored-by: obviyus <[email protected]>
Person facts now carry the job's agent, so a role whose agents exclude it gives no owner grant (local review round 1). Co-authored-by: obviyus <[email protected]>
435e69f to
644d11d
Compare
|
E2E on head
{"pass":true,"prefix":"HEAD","sessionKey":"agent:main:one-admission-071d4781","models":["gpt-5.5-2026-04-23"],"relayStatuses":[200],"checks":[{"id":"R.running-turn-finishes","pass":true,"detail":{"state":"final","toolEnds":3,"toolEndsAfterRevoke":3}},{"id":"Q.queued-input-refused-visibly","pass":true,"detail":{"accepted":true,"providerRequestsWithQueuedMarker":0,"visibleRefusalInTranscript":true}},{"id":"S.stop-cancels","pass":true,"detail":{"abort":{"ok":true,"aborted":true,"runIds":["73968828-1aaa-4c30-a454-21f614a3b9c8"]},"state":"aborted","requestsWithStopMarker":1}}],"elapsedMs":66482}
|
Doctor's read-only owner preview applies the role's agents list, as admission does (local review round 2). Also trims comments and the admission helper. Co-authored-by: obviyus <[email protected]>
|
E2E on final head
{"pass":true,"prefix":"HEAD","sessionKey":"agent:main:one-admission-09726c1d","models":["gpt-5.5-2026-04-23"],"relayStatuses":[200],"checks":[{"id":"R.running-turn-finishes","pass":true,"detail":{"state":"final","toolEnds":3,"toolEndsAfterRevoke":3}},{"id":"Q.queued-input-refused-visibly","pass":true,"detail":{"accepted":true,"providerRequestsWithQueuedMarker":0,"visibleRefusalInTranscript":true}},{"id":"S.stop-cancels","pass":true,"detail":{"abort":{"ok":true,"aborted":true,"runIds":["2b8bafd4-1717-47f9-8239-e47fc7f70788"]},"state":"aborted","requestsWithStopMarker":1}}],"elapsedMs":56972}
|
… preview Co-authored-by: obviyus <[email protected]>
|
E2E on final head
{"pass":true,"prefix":"HEAD","sessionKey":"agent:main:one-admission-6781ee62","models":["gpt-5.5-2026-04-23"],"relayStatuses":[200],"checks":[{"id":"R.running-turn-finishes","pass":true,"detail":{"state":"final","toolEnds":3,"toolEndsAfterRevoke":3}},{"id":"Q.queued-input-refused-visibly","pass":true,"detail":{"accepted":true,"providerRequestsWithQueuedMarker":0,"visibleRefusalInTranscript":true}},{"id":"S.stop-cancels","pass":true,"detail":{"abort":{"ok":true,"aborted":true,"runIds":["9566a7cb-3f50-411b-8291-978a2481a29a"]},"state":"aborted","requestsWithStopMarker":1}}],"elapsedMs":55950}
|
Doctor cannot read access policies or the run's agent check, so an admin-role profile requester is reported as unverified instead of reimplementing admission (local review round 4). Co-authored-by: obviyus <[email protected]>
|
E2E on final head
{"pass":true,"prefix":"HEAD","sessionKey":"agent:main:one-admission-eab6fb02","models":["gpt-5.5-2026-04-23"],"relayStatuses":[200],"checks":[{"id":"R.running-turn-finishes","pass":true,"detail":{"state":"final","toolEnds":3,"toolEndsAfterRevoke":3}},{"id":"Q.queued-input-refused-visibly","pass":true,"detail":{"accepted":true,"providerRequestsWithQueuedMarker":0,"visibleRefusalInTranscript":true}},{"id":"S.stop-cancels","pass":true,"detail":{"abort":{"ok":true,"aborted":true,"runIds":["8c128a8a-c56c-411d-915e-45f153240742"]},"state":"aborted","requestsWithStopMarker":1}}],"elapsedMs":57038}
|
|
Maintainer override: the two red jobs on head
Merge-base evidence (local
Cause on main: #205297 refuses a scheduled run whose occurrence admission is missing; these |
|
Codex review: needs maintainer review before merge. What this changesThis PR routes legacy scheduled requesters through shared operator admission and updates Doctor’s ownership preview. Example: A legacy job targets agent main and belongs to a profile with an admin role that permits main.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: it addresses a source-verified ownership mismatch, and no definite introduced code defect was found. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherCron occurrence admission and scheduler event preparation consume stored requester identities and current policy, then pass a frozen owner decision to scheduled runs and repair turns. flowchart TD
A[Stored automation] --> B[Requester identity]
B --> C[Operator admission]
D[Current profile and policy] --> C
C --> E[Turn grant]
E --> F[Scheduled occurrence]
E --> G[Scheduler repair turn]
Technical reviewBest possible solution: Use shared admission for legacy requester ownership, retain the documented compatibility behavior, and let scheduled consumers read the resulting grant. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically denies owner status to an ordinary named-role admin profile requester; the PR reports a matching base-red regression test, but this review ran no target code. Is this the best way to solve the issue? The patch uses the existing admission owner, supplies the target agent, removes the replaced runtime check, and keeps Doctor from claiming an ownership decision it cannot fully evaluate. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ea0116a6dfcb. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +80, Other -6. Total +79 across 11 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 Reviewed November 25, 2026, 8:29 AM ET / 13:29 UTC. |
# Conflicts: # src/gateway/operator-admission.ts # test/scripts/oxlint-boundary-guards.test.ts
|
E2E on head
{"pass":true,"prefix":"HEAD","sessionKey":"agent:main:one-admission-990783b4","models":["gpt-5.5-2026-04-23"],"relayStatuses":[200],"checks":[{"id":"R.running-turn-finishes","pass":true,"detail":{"state":"final","toolEnds":3,"toolEndsAfterRevoke":3}},{"id":"Q.queued-input-refused-visibly","pass":true,"detail":{"accepted":true,"providerRequestsWithQueuedMarker":0,"visibleRefusalInTranscript":true}},{"id":"S.stop-cancels","pass":true,"detail":{"abort":{"ok":true,"aborted":true,"runIds":["23c93591-cfec-4906-b239-c7bf46bcd98f"]},"state":"aborted","requestsWithStopMarker":1}}],"elapsedMs":59020} |
# Conflicts: # test/scripts/oxlint-boundary-guards.test.ts
|
E2E on head
{"pass":true,"prefix":"HEAD","sessionKey":"agent:main:one-admission-45974540","models":["gpt-5.5-2026-04-23"],"relayStatuses":[200],"checks":[{"id":"R.running-turn-finishes","pass":true,"detail":{"state":"final","toolEnds":3,"toolEndsAfterRevoke":3}},{"id":"Q.queued-input-refused-visibly","pass":true,"detail":{"accepted":true,"providerRequestsWithQueuedMarker":0,"visibleRefusalInTranscript":true}},{"id":"S.stop-cancels","pass":true,"detail":{"abort":{"ok":true,"aborted":true,"runIds":["1d6a5f16-3b3f-4189-95a6-ddb9938808e9"]},"state":"aborted","requestsWithStopMarker":1}}],"elapsedMs":57611} |
|
Landed as 86d835e.
|
* commit '92569e37ab84a8cb1e4a12c3dcbb45acb97977c9': fix: distinguish Desktop sources without wrapping their names or IDs (#203747) fix(ui): Greek sigma searches miss matches outside Sessions and Files (#189518) fix: keep agent skill names on one line beside their switches (#203734) test(cron): admit scheduled occurrences in cron fixtures and fix Node 24 toHex in Vitest (#205383) fix: keep the Agents menu usable after copying an ID (#203739) fix(whatsapp): preserve code table spaces across message chunks (#205327) refactor(cron): admit legacy scheduled requesters through operator admission (#205346) fix: keep silent Codex turns healthy with running commands (#196062) test(update): verify the recorded preparation failure (#205363) fix(test): prove sibling imports on the active update path fix(chat): complete mentions without leaving part of the name behind (#205326) fix(test): restore Side chat hydration and retry checks (#205376) refactor: plugin-run turns get owner status from commands.ownerAllowFrom, like text messages (#205373) chore(ui): refresh control ui locales (#205378) fix: keep Telegram rich <details> and list blocks in one message when replies stream in chunks (#205318) refactor(gateway): one refusal owner with a required next step (#205337) fix(discord): keep long table labels bold across messages (#205328) feat: invitation, sharing and participant controls in the Control UI (#204920) fix(test): distinguish stamped Skill Library upgrade policies fix(markdown): preserve trailing inline-code spaces in plain-text tables (#205317)
…mission (openclaw#205346) ## Problem OA2 PR 6c, part 1 (DESIGN §4.8; split from openclaw#205297). A cron job saved without an operator source names its requester as a channel sender or a profile. Its owner bit was decided outside admission, by `checkRequesterOwner` in `src/cron/execution-context-admission.ts`, at two places: each scheduled run (occurrence mint) and each scheduler turn about the job (repair, notices) through `session-event-target`. That check used its own rules: a configured or linked-admin channel owner; for a profile, "named roles are off, or the Gateway owner profile". So a profile whose named role is `admin` was the owner in the Control UI but not in its own scheduled runs. ## Fix - New `admitScheduledRequesterGrant` in `src/gateway/operator-admission.ts` returns the requester's `TurnGrant`: - channel requester: `decideChannelOwnerPrincipal` (configured owner), else the sender's linked admin profile (`prepareChannelOperatorAdmin`, the same gatherer as before); - profile requester: `person` facts (with the job's agent, so a role's `agents` list applies) through `prepareOperatorAdmission` + `decideOperatorAdmission`. - Occurrence mint and scheduler turns take the owner bit from `grant.owner`. The run gets only the grant, never operator scopes (no scope widening). - Deleted `checkRequesterOwner` and the `requesterOwner` capture in `session-event-target` / `session-event-context` / `cron-job-turn-target` (renamed to `scheduledRequester` with its admitted `grant`). - Lint lists shrink: `OWNER_PRODUCER_FILES` 28 → 24, `TURN_FLAG_FILES` 19 → 18, `ADMISSION_FILES` 59 → 58. - Doctor's read-only replay (`execution-context-check.ts`) reads the requester's own profile (a transferred job's `ownerProfileId`, not its creator's). An admin-role profile requester is reported as unverified: its owner bit depends on the role's `agents` list and access policy, which only admission reads. New Doctor cells: admin-role requester (unverified), transferred job whose creator is admin and requester is member (loses owner tools; red without the fix). ## Decisions (recorded, not asked) - **Named widening:** a profile requester with an admin named role is now the owner of its scheduled runs (was not). This is the design rule (owner = `operator.admin` in the admitted scopes), the same answer the person gets in the Control UI. - **Kept fallback (today's answer, named):** on an install without named roles, every profile requester stays the owner. `person` facts would refuse them (no role → no scopes; PR 4 left that cell for later), which would take owner-only tools from existing jobs. The fallback lives inside the admission module, next to the decision, not in cron. - **Unchanged (today's answer):** trusted-policy jobs, unlinked legacy jobs and unbound parents keep owner via the existing `legacy`/`trusted-policy` basis in `execution-context.ts`. - **Scheduler turns for a channel owner** no longer carry the command-owner recovery reference; their queued successors re-admit the native sender, as every channel owner's queued work does (`prepareReplyCommandOwnerAuthority`). - **Split (next PR):** plugin requester-owner continuation (`openclaw-plugin-tools`, `tool-factory-context`, `bindRequesterOwnerIdentity`, the cron creator `requesterOwner` chain), `scheduled-message-invocation`, `message-action-dispatch`, `execution-context-registry`, `openclaw-tools`. That chain runs through `agent-run-user-turn`, `chat-send` and subagent requester custody and would put this PR over the file cap. ## Tests - New cell `execution-context-admission.test.ts` "admits a stored profile requester through its named role": admin role → owner, admin role limited to another agent → not owner, member role → not owner, untiered → owner. **Red on base `8ea184867868`** (admin role: `owner: false, basis: "none"`), green on head. - Unchanged and green: `execution-context-owner-authority.test.ts` (trusted policy, unbound parent, untiered profile, removed profile, no requester: real embedded/Codex/CLI tool surfaces), the Discord configured-owner cell, `server-cron-notifications.repair.test.ts`. ## Evidence - Production lines (`src` + `scripts`, non-test, vs merge base): +126 / −127. - Pre-push: one `ocx test` call over 64 files (touched tests + direct importers of every changed source + importers of the cron test-support files). All green except `src/cron/service.pr-automation.test.ts` and `service.pr-automation-feedback.test.ts` (37 cases, "occurrence admission is not configured"): red on base `8ea184867868` too (37 failed there), from openclaw#205297's fixture gap; imports no changed file. `pnpm tsgo:core`, `pnpm tsgo:test`, oxfmt and oxlint clean; `pnpm check:changed` reds only on main's `CHANGELOG/2026.11.10.md` bot attribution and main's dead exports (none in this diff). - E2E (`one-admission-e2e/run.sh`, isolated Gateway, real `gpt-5.5`) on the final head (see PR comments): Q queued input refused visibly, R running turn finishes after revoke, S Stop cancels: all pass. - Legacy-job owner tools: proven at the integration tier (`execution-context-owner-authority.test.ts` builds the real embedded, Codex and CLI tool surfaces for an untiered profile job (owner tools) and a removed/non-owner requester (no owner tools)) plus the new admission cell for named roles. No real-Gateway run of a hand-written legacy job row; such rows cannot be created through the product any more. ## Review - Round 1 (P1, real): person admission skipped the role's `agents` check; the job's agent is now passed. Cell added. - Round 2 (P2, real): Doctor's preview ignored the same `agents` list; fixed, cells added. - Round 3 on `f0370ee7da42` (P2, real): Doctor read the creator's profile for a transferred job's requester; fixed, cell added. Review on the final head is the merge gate. - Round 4 on `e555208d1f82` (P2, real): Doctor's admin-role preview ignored access policy. Cut less: Doctor no longer re-derives that answer; it reports the requester as unverified. - Round 5 on final head `7f016c02292e`: clean (`patch is correct`, no findings). Five review runs exceeded the two-round cap in the pipeline; rounds 3-4 were Doctor-preview findings, each real and fixed (round 4 by cutting the re-derivation, not adding to it). Co-authored-by: Ayaan Zaidi <[email protected]>
Release adaptation: Read the existing admitted scope ceiling for stored operator sources. Keep current recovery, requester admission, and configured channel-owner handling. Companion audit: #205173 and #205346 restructure newer admission contracts, not required for this stable repair. (cherry picked from commit 4d07855) Co-authored-by: RomneyDa <[email protected]>
Problem
OA2 PR 6c, part 1 (DESIGN §4.8; split from #205297). A cron job saved without an operator source names its requester as a channel sender or a profile. Its owner bit was decided outside admission, by
checkRequesterOwnerinsrc/cron/execution-context-admission.ts, at two places: each scheduled run (occurrence mint) and each scheduler turn about the job (repair, notices) throughsession-event-target. That check used its own rules: a configured or linked-admin channel owner; for a profile, "named roles are off, or the Gateway owner profile". So a profile whose named role isadminwas the owner in the Control UI but not in its own scheduled runs.Fix
admitScheduledRequesterGrantinsrc/gateway/operator-admission.tsreturns the requester'sTurnGrant:decideChannelOwnerPrincipal(configured owner), else the sender's linked admin profile (prepareChannelOperatorAdmin, the same gatherer as before);personfacts (with the job's agent, so a role'sagentslist applies) throughprepareOperatorAdmission+decideOperatorAdmission.grant.owner. The run gets only the grant, never operator scopes (no scope widening).checkRequesterOwnerand therequesterOwnercapture insession-event-target/session-event-context/cron-job-turn-target(renamed toscheduledRequesterwith its admittedgrant).OWNER_PRODUCER_FILES28 → 24,TURN_FLAG_FILES19 → 18,ADMISSION_FILES59 → 58.execution-context-check.ts) reads the requester's own profile (a transferred job'sownerProfileId, not its creator's). An admin-role profile requester is reported as unverified: its owner bit depends on the role'sagentslist and access policy, which only admission reads. New Doctor cells: admin-role requester (unverified), transferred job whose creator is admin and requester is member (loses owner tools; red without the fix).Decisions (recorded, not asked)
operator.adminin the admitted scopes), the same answer the person gets in the Control UI.personfacts would refuse them (no role → no scopes; PR 4 left that cell for later), which would take owner-only tools from existing jobs. The fallback lives inside the admission module, next to the decision, not in cron.legacy/trusted-policybasis inexecution-context.ts.prepareReplyCommandOwnerAuthority).openclaw-plugin-tools,tool-factory-context,bindRequesterOwnerIdentity, the cron creatorrequesterOwnerchain),scheduled-message-invocation,message-action-dispatch,execution-context-registry,openclaw-tools. That chain runs throughagent-run-user-turn,chat-sendand subagent requester custody and would put this PR over the file cap.Tests
execution-context-admission.test.ts"admits a stored profile requester through its named role": admin role → owner, admin role limited to another agent → not owner, member role → not owner, untiered → owner. Red on base5cb1764fc2de(admin role:owner: false, basis: "none"), green on head.execution-context-owner-authority.test.ts(trusted policy, unbound parent, untiered profile, removed profile, no requester: real embedded/Codex/CLI tool surfaces), the Discord configured-owner cell,server-cron-notifications.repair.test.ts.Evidence
src+scripts, non-test, vs merge base): +126 / −127.ocx testcall over 64 files (touched tests + direct importers of every changed source + importers of the cron test-support files). All green exceptsrc/cron/service.pr-automation.test.tsandservice.pr-automation-feedback.test.ts(37 cases, "occurrence admission is not configured"): red on base5cb1764fc2detoo (37 failed there), from refactor(cron): refuse a scheduled run whose occurrence admission failed #205297's fixture gap; imports no changed file.pnpm tsgo:core,pnpm tsgo:test, oxfmt and oxlint clean;pnpm check:changedreds only on main'sCHANGELOG/2026.11.10.mdbot attribution and main's dead exports (none in this diff).one-admission-e2e/run.sh, isolated Gateway, realgpt-5.5) on the final head (see PR comments): Q queued input refused visibly, R running turn finishes after revoke, S Stop cancels: all pass.execution-context-owner-authority.test.tsbuilds the real embedded, Codex and CLI tool surfaces for an untiered profile job (owner tools) and a removed/non-owner requester (no owner tools)) plus the new admission cell for named roles. No real-Gateway run of a hand-written legacy job row; such rows cannot be created through the product any more.Review
agentscheck; the job's agent is now passed. Cell added.agentslist; fixed, cells added.f0370ee7da42(P2, real): Doctor read the creator's profile for a transferred job's requester; fixed, cell added. Review on the final head is the merge gate.e555208d1f82(P2, real): Doctor's admin-role preview ignored access policy. Cut less: Doctor no longer re-derives that answer; it reports the requester as unverified.7f016c02292e: clean (patch is correct, no findings). Five review runs exceeded the two-round cap in the pipeline; rounds 3-4 were Doctor-preview findings, each real and fixed (round 4 by cutting the re-derivation, not adding to it).