Repository navigation
fix(cron): agents learn an automation run's outcome in the same tool call - #162481
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. |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 6:55 AM ET / 10:55 UTC (Revision 9). ClawSweeper reviewWhat this changesThe automations tool gains a bounded wait for a manually triggered job’s outcome, exact-run history lookup, older-Gateway fallback, and matching protocol, documentation, tests, and prompt snapshots. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and the latest release still return an enqueue acknowledgement without the agent-facing completion capability. Earlier actionable findings are addressed, the stated tradeoffs have verified maintainer acceptance, and no blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherAgents use the automations tool to trigger jobs through the Gateway’s cron service. The service executes accepted work and records its outcome; the Gateway returns authorized completion details or an acknowledgement for later follow-up. flowchart TD
A[Agent automation request] --> B[Gateway authorization]
B --> C[Cron run queue]
C --> D[Job execution and history]
C --> E[Bounded completion wait]
D --> E
E --> F[Current read authority]
F --> G[Outcome or accepted acknowledgement]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +160, Tests +177, Docs +2. Total +339 across 24 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep completion tracking with the cron execution owner, reuse authorized history reads, and preserve enqueue acknowledgements whenever waiting cannot yield an available outcome. Do we have a high-confidence way to reproduce the issue? Not applicable as an established-behavior bug: enqueue-only responses were intentional. Current source and the recorded before/after Gateway observations establish the missing agent completion capability. Is this the best way to solve the issue? Yes. An event-driven wait at the cron owner avoids client polling and preserves accepted work, existing history visibility, and older-Gateway compatibility. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d64730851269. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
Addressed review: shipped-Gateway fallback (single retry without waitTimeoutMs, mirrors the existing cron.list compact fallback), accepted ack survives a refused history read after a long wait, finished:true when the run ended but its history is hidden (self-deleting one-shot), management-only note points to the Automations page, pre-aborted signal returns at once, and the run output type declares only outcome fields so code-mode declarations stay within budget. @clawsweeper re-review |
|
Owner note on caller cancellation: the turn is already released at the tool boundary. Every finalized agent tool is wrapped by |
|
@clawsweeper Maintainer decision (Ayaan, repository maintainer): (1) Caller cancellation: accepted as is. The turn is released at the tool boundary (wrapToolWithAbortSignal / raceWithAbortSignal). What remains is a detached, bounded timer (at most 10 min) on a run that was already accepted. No wait-only signal will be threaded through the in-process mutation-completion path. (2) Management-grant turns receiving the outcome of a run they were allowed to start: accepted. It is read under the same cron.runs visibility rules, it is not a meaningful widening, and without it those turns would schedule verify jobs again. Please re-review. |
|
🦞👀 I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes. Request: Maintainer decision (Ayaan, repository maintainer): (1) Caller cancellation: accepted as is. The turn is released at the tool boundary (wrapToolWithAbortSignal / raceWithAbortSignal). What remains is a detached, bounded timer (at most 10 min) on a run that was already accepted. No wait-only signal will be threaded through the in-process mutation-completion path. (2) Management-grant turns receiving the outcome of a run they were allowed to start: accepted. It is read under the same cron.runs vis... |
|
ClawSweeper assist: The supplied decision accepts both tradeoffs: caller cancellation releases the turn while the bounded background wait continues, and management-grant callers may receive outcomes under existing visibility rules. A full correctness re-review is still needed; this assist response does not replace it. Evidence:
Suggested next action: Record the accepted finding disposition and clarified cancellation behavior in the PR body, then request Source: #162481 (comment) |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper Maintainer decision (Ayaan, repository maintainer): the authority-chain proof gate is accepted without a dedicated revocation-mid-request harness. Read authority (caller authority, agent runtime, management grant) is rechecked synchronously right before the outcome is attached, with no await between the check and the response. The only remaining window is "revoked after the response was built", which every read API has. A harness that revokes mid-request would harden a hypothetical. The handler-level test covers allowed vs revoked callers through the real cron.run/cron.runs handlers. Please re-review. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
0536165 to
5a3d4d3
Compare
|
Landed in 9f330ef.
|
…r own conversation (#162683) ## What Problem This Solves Fixes: when an agent runs an automation that targets its own conversation, `automations run` can hold the turn for the whole wait (60 s by default) and then return without an outcome. This happens when the job is a current-session job whose result is committed back to the calling conversation, or a named-session job written as an alias of the caller's session (for example `session:main`, or `session:agent:<id>:main` when `session.mainKey` is customized). ## User Impact User impact: those runs return their acknowledgement immediately, as #162481 intended, so the turn ends promptly and the run, which can only start or commit after the turn, delivers as usual. Waits for isolated jobs and other sessions are unchanged. ## Why This Change Was Made #162481 skipped the wait only for `main` jobs and for `session:<key>` targets whose raw suffix equalled the caller's session key. That check missed two real cases: - A `current` job commits its result into `job.sessionKey`. The commit waits for that session's active work (`commitCurrentSessionCronCompletion`, from the serialized delivery contract in #126860), and that work is the calling turn. - Named targets are run under `resolveCronAgentSessionKey`, which applies agent scoping and `mainKey` aliases (#29683 / #30654). The raw suffix `main` never equals the caller's `agent:<id>:main`. The check now applies only to agent-turn payloads (command and script jobs run as processes and never queue behind a turn) and compares only the session the run actually depends on: the named execution target, or for `current` jobs with announce delivery the `job.sessionKey` they commit into (quiet `current` jobs run detached and never commit, so they keep waiting). Both go through the execution owner's `resolveCronAgentSessionKey` (agent scoping and `mainKey` aliases), so they compare equal to the caller's canonical session key. The raw-suffix comparison is deleted. Archival bindings such as the creator `sessionKey` that the automations tool stamps on named-session jobs are deliberately not considered, because those runs execute elsewhere and can finish while the caller waits. The `main` case and every other invariant from #162481 are unchanged. ## Evidence - Live proof on the Telegram Test Server: owner DM, live OpenAI `gpt-5.5` behind a pass-through proxy (key never in the Gateway config), same scenario before (merge-base `ab1b93295ad`, which contains #162481) and after (`62ef249055c`). In each run the model creates three disabled jobs, then for each job calls `automations run` with `runMode: force` and replies `RUNn-DONE` once the tool returns. Times are from the user's send to the bot's reply, taken from the recorded Telegram timeline: | Job | Before: tool turn | Before: tool result | After: tool turn | After: tool result | |---|---|---|---|---| | `isolated` (control) | 13.8 s; report at 10.5 s | `run {status: ok, deliveryStatus: delivered, summary: ISOLATED-REPORT}` | 9.7 s; report at 7.7 s | same `run` | | `current` announce into the DM | 68.8 s (blocked for the full 60 s wait) | runId + note | 8.5 s | runId + note (immediate) | | `session:main` (alias of the DM's `agent:main:main`) | 73.8 s; NAMED-REPORT at 75.8 s | runId + note | 7.5 s; NAMED-REPORT at 10.0 s | runId + note (immediate) | Run history matches: before, the `session:main` run took 64.7 s because it queued behind the caller's turn; after, it took 4.3 s. - Out of scope: in both runs the `current` job itself fails with `attempt disposed before transcript write`, so its report is never delivered (before after 62 s, after after 4.8 s). A manual run started from an agent turn inherits that turn's transcript-write lifecycle. The same error shows up as a mirror warning on the other jobs. It is pre-existing, identical on origin/main, and not touched by this PR; it is being handled separately. - `cron.validation.test.ts` drives the real `cron.run` handler with the real binding resolver and runtime config. `session:main`, `session:agent:ops:main` with `mainKey: "work"`, and a `current` announce job bound to the caller return the plain ack without calling the wait. `isolated` jobs, quiet (`delivery: none`) `current` jobs, and a named job for another session that carries the creator's `sessionKey` (as the tool creates it), still wait. On origin/main the three own-session cases fail; the creator-`sessionKey` case catches the over-broad first version of this fix; the quiet-current case catches the second. A separate test runs a quiet `session:main` command job as a real Control UI management caller (the only callers that can see command jobs) and confirms it still waits; it fails on the previous head. - `pnpm tsgo:core` clean. `cron.validation.test.ts`: 266 passed, 29 s wall / 25.9 s Vitest (before this PR: 264 tests, about 24 s wall / 21.4 s). `server.cron.test.ts`: 17 passed. ### Bounded cost No new waits, runs, model calls or messages. The change only makes more own-session runs skip a wait that could not succeed anyway. ### Hermes Hermes never blocks the caller on a manual run, so it has no equivalent of this check. Keeping the bounded wait and skipping it only when the run depends on the caller is the smallest change that keeps #162481's same-call outcome for everything else. LOC (vs origin/main): production +21/-3 in one handler, tests +77/-9. Co-authored-by: Ayaan Zaidi <[email protected]>
…call (openclaw#162481) ## What Problem This Solves Fixes: when an agent runs an automation with `automations run`, the call returns as soon as the run is queued, so the model never learns whether the run worked. It then posts guesses, or schedules a separate "verify" job. That job runs with only its own scope, can't see the result, and reports a false "blocked". ## User Impact User impact: when an agent runs an automation, it gets the finished run (status, error, delivery status and summary) in the same tool result if the run ends within the call's `timeoutMs` (default 60 s, capped at 10 min). A longer run returns its `runId` and a note to check it later with `runs jobId runId`, not with a scheduled check. The CLI is unchanged. ## Why This Change Was Made `cron.run` became enqueue-only in openclaw#40204 (closing openclaw#40192). Back then a synchronous run held the RPC until the 60 s gateway timeout and returned a misleading timeout error while the job kept running. openclaw#81929 later added `openclaw cron run --wait`, polling `cron.runs` from the client, and deliberately kept `cron.run` from holding the request open. The agent tool never got a wait at all. A client-side poller would not work for the tool anyway: management-grant turns can run a job, but `cron.runs` is not one of their allowed methods. This PR keeps that invariant (no unbounded request, no false failure) and gives the one owner of run completion a bounded, opt-in wait: - The cron service records each accepted manual run's settlement. `waitForManualRun(runId, timeoutMs, signal)` resolves when the run has written its history row. It is event-driven, with no polling. - `cron.run` accepts an optional `waitTimeoutMs`. When the run finishes in time, the ack also carries `run`, read through the existing `cron.runs` handler so the same visibility and authority rules apply. When the wait ends first, the ack is unchanged and the run continues. - When an agent turn runs a main-session job, or a `session:<key>` job in its own session, the call returns at once. The caller's turn holds the main lane and its own session lane: heartbeats skip while `CommandLane.Main` is busy, and a main-session run waits up to 2 min for that busy turn. Waiting there would only burn the budget. - The `automations` tool's `run` passes its `timeoutMs` as the wait. `runs` now forwards `runId`. The tool descriptions now steer models away from verify jobs. Against a shipped Gateway, which rejects the new param before enqueueing, the tool retries the plain call once, the same way it already does for `compact` on `cron.list`. - Accepted runs stay accepted, and outcomes go only to callers that may still read them. After the history read, the handler rechecks read authority (caller authority, agent runtime and any management grant), with no await between that check and the response. If the read or the recheck is refused, for example because a delegated grant lapsed or was revoked during a long wait, the caller gets the plain ack and nothing about the outcome. If the run finished but its history is not visible (for example a one-shot that deleted itself after succeeding), the ack carries `finished: true`. Management-only turns are pointed to the Automations page instead of `runs`. The CLI keeps its client-side `--wait` polling in this PR. Moving it onto the Gateway wait is a separate, compatibility-reviewed follow-up. ## Evidence - Real isolated Gateway, real Telegram plugin on the Crabline synthetic Bot API, and a deterministic Responses provider. An owner DM turn calls the `automations` tool (throwaway harness, not committed). - Before (origin/main build): every `run` returned only `{ ok, enqueued, runId, processInstanceId }` in under 1 s, with no outcome. The report still reached the chat, so the model couldn't tell the run had succeeded. - After: the isolated job's `run` returned in 4.3 s with `run { status: "ok", completionStatus: "succeeded", deliveryStatus: "delivered", summary: "FAST-REPORT-DELIVERED" }`, and the report reached the chat. A slow job (8 s, called with `timeoutMs: 2000`) returned after 2.6 s with its `runId` and the `runs jobId runId` note. The run kept going and delivered, and a later `runs` call with that `runId` returned the single finished entry. A main-session job run from the owner's main-session DM returned in 0.6 s with the note instead of blocking the turn. - Gateway regression (`src/gateway/server.cron.test.ts`): `waitTimeoutMs: 50` returns only the `runId` while the run is blocked. `waitTimeoutMs: 10000` returns `run { runId, status: "ok", completionStatus: "succeeded", summary }`. On origin/main this fails because the closed schema rejects `waitTimeoutMs`. - Same-session skip (`cron.validation.test.ts`): from an agent turn, `main` and `session:<own key>` jobs return the plain ack without waiting. `isolated` jobs wait. - Authority chain (`cron.validation.test.ts`, through the real `cron.run` and `cron.runs` handlers with a stored run record): a caller that is still authorized gets `run { runId, status: "ok" }`. A caller revoked during the history read gets only the accepted ack. Before this change the revoked case turned into a request error. - Tool (`cron-tool.test.ts`): the wait is capped at 10 min, and the RPC timeout is the wait plus 60 s. An unfinished run gets the `runs jobId runId` note. - Tool contract (`cron-tool.output-contract.test.ts`): a shipped Gateway that rejects `waitTimeoutMs` still enqueues through a single retry, and the result stays valid against the output schema. The `run` output type only declares the outcome fields, so the generated code-mode declarations stay within their size allowance. - Measured local wall times on head `cf942df0601` (one `node scripts/run-vitest.mjs <file>` per file; wrapper wall / Vitest duration): `cron-tool.output-contract` 5 tests, 24s / 7.0s; `cron-tool` 72 tests, 19s / 16.2s; `server-cron-lazy` 25 tests, 21s / 17.6s; `cron.validation` 261 tests, 24s / 21.4s; `server.cron` 17 tests, 46s / 43.8s. There are no CI seconds yet: CI skips the test jobs while the PR is a draft, and the only job that ran, "PR context and evidence", passed in 38s. - `pnpm tsgo:core` is clean. Targeted tests pass: `server.cron`, `cron.validation`, `cron-tool`, `server-cron-lazy`. ### Bounded cost - The wait is bounded by `timeoutMs` (default 60 s, capped at 10 min in the tool) and ends early if the caller aborts. The `cron.run` RPC timeout is the wait plus a 60 s enqueue budget, so the response always arrives before the client gives up. - No new model calls or job runs. The waiter only watches a run that was already accepted. It does not retry, re-run or alert. - No nested waits. Automation-run sessions are limited to self status/list/get/runs/remove, so a job's run cannot call `run`. A job running itself gets `already-running`. Main-session and same-session runs, which can only start after the caller's turn, skip the wait. ### Hermes Hermes `cronjob(action="run")` sends the job to its async-delegation pool and returns a handle with "Do not wait or poll". The outcome comes back into the conversation as a new turn, and Hermes runs the job inline when no session can receive it. This PR borrows "the tool owns the follow-up, so the model doesn't poll". Feeding completions back into the conversation is not done here: OpenClaw already delivers run output to the job's target. It's a possible follow-up for long runs. LOC (commit): production about +125/-12, tests about +96, docs +3. Co-authored-by: Ayaan Zaidi <[email protected]>
…r own conversation (openclaw#162683) ## What Problem This Solves Fixes: when an agent runs an automation that targets its own conversation, `automations run` can hold the turn for the whole wait (60 s by default) and then return without an outcome. This happens when the job is a current-session job whose result is committed back to the calling conversation, or a named-session job written as an alias of the caller's session (for example `session:main`, or `session:agent:<id>:main` when `session.mainKey` is customized). ## User Impact User impact: those runs return their acknowledgement immediately, as openclaw#162481 intended, so the turn ends promptly and the run, which can only start or commit after the turn, delivers as usual. Waits for isolated jobs and other sessions are unchanged. ## Why This Change Was Made openclaw#162481 skipped the wait only for `main` jobs and for `session:<key>` targets whose raw suffix equalled the caller's session key. That check missed two real cases: - A `current` job commits its result into `job.sessionKey`. The commit waits for that session's active work (`commitCurrentSessionCronCompletion`, from the serialized delivery contract in openclaw#126860), and that work is the calling turn. - Named targets are run under `resolveCronAgentSessionKey`, which applies agent scoping and `mainKey` aliases (openclaw#29683 / openclaw#30654). The raw suffix `main` never equals the caller's `agent:<id>:main`. The check now applies only to agent-turn payloads (command and script jobs run as processes and never queue behind a turn) and compares only the session the run actually depends on: the named execution target, or for `current` jobs with announce delivery the `job.sessionKey` they commit into (quiet `current` jobs run detached and never commit, so they keep waiting). Both go through the execution owner's `resolveCronAgentSessionKey` (agent scoping and `mainKey` aliases), so they compare equal to the caller's canonical session key. The raw-suffix comparison is deleted. Archival bindings such as the creator `sessionKey` that the automations tool stamps on named-session jobs are deliberately not considered, because those runs execute elsewhere and can finish while the caller waits. The `main` case and every other invariant from openclaw#162481 are unchanged. ## Evidence - Live proof on the Telegram Test Server: owner DM, live OpenAI `gpt-5.5` behind a pass-through proxy (key never in the Gateway config), same scenario before (merge-base `db0e1a6e594`, which contains openclaw#162481) and after (`62ef249055c`). In each run the model creates three disabled jobs, then for each job calls `automations run` with `runMode: force` and replies `RUNn-DONE` once the tool returns. Times are from the user's send to the bot's reply, taken from the recorded Telegram timeline: | Job | Before: tool turn | Before: tool result | After: tool turn | After: tool result | |---|---|---|---|---| | `isolated` (control) | 13.8 s; report at 10.5 s | `run {status: ok, deliveryStatus: delivered, summary: ISOLATED-REPORT}` | 9.7 s; report at 7.7 s | same `run` | | `current` announce into the DM | 68.8 s (blocked for the full 60 s wait) | runId + note | 8.5 s | runId + note (immediate) | | `session:main` (alias of the DM's `agent:main:main`) | 73.8 s; NAMED-REPORT at 75.8 s | runId + note | 7.5 s; NAMED-REPORT at 10.0 s | runId + note (immediate) | Run history matches: before, the `session:main` run took 64.7 s because it queued behind the caller's turn; after, it took 4.3 s. - Out of scope: in both runs the `current` job itself fails with `attempt disposed before transcript write`, so its report is never delivered (before after 62 s, after after 4.8 s). A manual run started from an agent turn inherits that turn's transcript-write lifecycle. The same error shows up as a mirror warning on the other jobs. It is pre-existing, identical on origin/main, and not touched by this PR; it is being handled separately. - `cron.validation.test.ts` drives the real `cron.run` handler with the real binding resolver and runtime config. `session:main`, `session:agent:ops:main` with `mainKey: "work"`, and a `current` announce job bound to the caller return the plain ack without calling the wait. `isolated` jobs, quiet (`delivery: none`) `current` jobs, and a named job for another session that carries the creator's `sessionKey` (as the tool creates it), still wait. On origin/main the three own-session cases fail; the creator-`sessionKey` case catches the over-broad first version of this fix; the quiet-current case catches the second. A separate test runs a quiet `session:main` command job as a real Control UI management caller (the only callers that can see command jobs) and confirms it still waits; it fails on the previous head. - `pnpm tsgo:core` clean. `cron.validation.test.ts`: 266 passed, 29 s wall / 25.9 s Vitest (before this PR: 264 tests, about 24 s wall / 21.4 s). `server.cron.test.ts`: 17 passed. ### Bounded cost No new waits, runs, model calls or messages. The change only makes more own-session runs skip a wait that could not succeed anyway. ### Hermes Hermes never blocks the caller on a manual run, so it has no equivalent of this check. Keeping the bounded wait and skipping it only when the run depends on the caller is the smallest change that keeps openclaw#162481's same-call outcome for everything else. LOC (vs origin/main): production +21/-3 in one handler, tests +77/-9. Co-authored-by: Ayaan Zaidi <[email protected]>
Main's #162481 made the automations run action wait up to timeoutMs (default 60 s) for the run's outcome and added timeoutMs: 1 to this test, whose cron lane stays blocked until after the reply. The merge in e26c5f0 kept the branch's rewrite of the test and dropped that argument, so every case waited for an outcome that cannot arrive and the 10 s native attempt timed out.
What Problem This Solves
Fixes: when an agent runs an automation with
automations run, the call returns as soon as the run is queued, so the model never learns whether the run worked. It then posts guesses, or schedules a separate "verify" job. That job runs with only its own scope, can't see the result, and reports a false "blocked".User Impact
User impact: when an agent runs an automation, it gets the finished run (status, error, delivery status and summary) in the same tool result if the run ends within the call's
timeoutMs(default 60 s, capped at 10 min). A longer run returns itsrunIdand a note to check it later withruns jobId runId, not with a scheduled check. The CLI is unchanged.Why This Change Was Made
cron.runbecame enqueue-only in #40204 (closing #40192). Back then a synchronous run held the RPC until the 60 s gateway timeout and returned a misleading timeout error while the job kept running. #81929 later addedopenclaw cron run --wait, pollingcron.runsfrom the client, and deliberately keptcron.runfrom holding the request open. The agent tool never got a wait at all. A client-side poller would not work for the tool anyway: management-grant turns can run a job, butcron.runsis not one of their allowed methods.This PR keeps that invariant (no unbounded request, no false failure) and gives the one owner of run completion a bounded, opt-in wait:
waitForManualRun(runId, timeoutMs, signal)resolves when the run has written its history row. It is event-driven, with no polling.cron.runaccepts an optionalwaitTimeoutMs. When the run finishes in time, the ack also carriesrun, read through the existingcron.runshandler so the same visibility and authority rules apply. When the wait ends first, the ack is unchanged and the run continues.session:<key>job in its own session, the call returns at once. The caller's turn holds the main lane and its own session lane: heartbeats skip whileCommandLane.Mainis busy, and a main-session run waits up to 2 min for that busy turn. Waiting there would only burn the budget.automationstool'srunpasses itstimeoutMsas the wait.runsnow forwardsrunId. The tool descriptions now steer models away from verify jobs. Against a shipped Gateway, which rejects the new param before enqueueing, the tool retries the plain call once, the same way it already does forcompactoncron.list.finished: true. Management-only turns are pointed to the Automations page instead ofruns.The CLI keeps its client-side
--waitpolling in this PR. Moving it onto the Gateway wait is a separate, compatibility-reviewed follow-up.Evidence
automationstool (throwaway harness, not committed).runreturned only{ ok, enqueued, runId, processInstanceId }in under 1 s, with no outcome. The report still reached the chat, so the model couldn't tell the run had succeeded.runreturned in 4.3 s withrun { status: "ok", completionStatus: "succeeded", deliveryStatus: "delivered", summary: "FAST-REPORT-DELIVERED" }, and the report reached the chat. A slow job (8 s, called withtimeoutMs: 2000) returned after 2.6 s with itsrunIdand theruns jobId runIdnote. The run kept going and delivered, and a laterrunscall with thatrunIdreturned the single finished entry. A main-session job run from the owner's main-session DM returned in 0.6 s with the note instead of blocking the turn.src/gateway/server.cron.test.ts):waitTimeoutMs: 50returns only therunIdwhile the run is blocked.waitTimeoutMs: 10000returnsrun { runId, status: "ok", completionStatus: "succeeded", summary }. On origin/main this fails because the closed schema rejectswaitTimeoutMs.cron.validation.test.ts): from an agent turn,mainandsession:<own key>jobs return the plain ack without waiting.isolatedjobs wait.cron.validation.test.ts, through the realcron.runandcron.runshandlers with a stored run record): a caller that is still authorized getsrun { runId, status: "ok" }. A caller revoked during the history read gets only the accepted ack. Before this change the revoked case turned into a request error.cron-tool.test.ts): the wait is capped at 10 min, and the RPC timeout is the wait plus 60 s. An unfinished run gets theruns jobId runIdnote.cron-tool.output-contract.test.ts): a shipped Gateway that rejectswaitTimeoutMsstill enqueues through a single retry, and the result stays valid against the output schema. Therunoutput type only declares the outcome fields, so the generated code-mode declarations stay within their size allowance.cf942df0601(onenode scripts/run-vitest.mjs <file>per file; wrapper wall / Vitest duration):cron-tool.output-contract5 tests, 24s / 7.0s;cron-tool72 tests, 19s / 16.2s;server-cron-lazy25 tests, 21s / 17.6s;cron.validation261 tests, 24s / 21.4s;server.cron17 tests, 46s / 43.8s. There are no CI seconds yet: CI skips the test jobs while the PR is a draft, and the only job that ran, "PR context and evidence", passed in 38s.pnpm tsgo:coreis clean. Targeted tests pass:server.cron,cron.validation,cron-tool,server-cron-lazy.Bounded cost
timeoutMs(default 60 s, capped at 10 min in the tool) and ends early if the caller aborts. Thecron.runRPC timeout is the wait plus a 60 s enqueue budget, so the response always arrives before the client gives up.run. A job running itself getsalready-running. Main-session and same-session runs, which can only start after the caller's turn, skip the wait.