Skip to content

refactor(automations): run scheduled conversation work through session admission - #178764

Merged
steipete merged 16 commits into
mainfrom
steipete/automations-s2
Oct 21, 2026
Merged

steipete merged 16 commits into
mainfrom
steipete/automations-s2

Conversation

@steipete

@steipete steipete commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Related: #167796. Slice 2 of 4, following landed #178650. Doctor migration is slice 3; heartbeat execution and SDK retirement are slice 4.

What Problem This Solves

An existing session:<key> scheduled agent turn needs to join its conversation's ordinary admission and mailbox and remain running until that turn settles. Running it through the detached executor gives execution, authority, workspace and delivery decisions a second owner.

User Impact

Explicit conversation jobs now use the session controller and retain their authenticated source, model/account policy, managed workspace, delivery policy and recorded result. Cron records completion only after the controller settles. Main-session system events retain #178650's adoption and restart behavior. Legacy heartbeats and detached jobs remain working; this slice performs no migration.

Claw Add review accepts positive-integer everyMs schedules and owner delivery, as Peter approved on October 18. Existing cron/timezone and none/last-channel variants remain unchanged. Runtime owner delivery and portable Claw Add conversion follow in slice 3.

Why This Change Was Made

Both execution paths share Cron's authority, inference, telemetry, workspace and prompt owners. Deferred admission revalidates policy; disallowed or malformed models and contradictory targets fail visibly. Scheduled model/account choices stay turn-local and do not replace the conversation's saved preferences. A recorded job account retains independent authorization, including replacement and revocation checks.

The shared prompt builder preserves job identity, local/UTC time, legacy Gmail/custom-hook untrusted wrapping, the existing unsafe-content opt-in and unattended guidance. Source leases and managed-worktree custody remain live through settlement and terminal writes. No authority is widened.

Evidence

  • Focused proof: 294 unique cases across 25 Cron, Gateway, reply and protocol files, with unchanged-input proof reused. Later repair selections overlap this total and are not summed into it.
  • Failing-before/passing-after boundary regressions cover session routing/settlement, revoked and malformed models, terminal error loss, subagent model precedence, saved account-pin replacement, unavailable destination account with a valid recorded job binding, and legacy hook prompt wrapping/identity/time.
  • Real deferred admission and account policy: 17 cases pass in 55.9 seconds Vitest / 76.4 seconds wrapper; 20 existing inference/admission consumers also pass. The earlier model/fallback selection passes 81 cases across eight files, including restart cases. These slower cases exercise actual queueing, policy publication, storage, authorization and filesystem effects.
  • Authenticated continuation: all 13 fixture cases pass through the ordinary execution owner, including restart recovery and revocation during a merge attempt. Real isolated Gateway/synthetic-model continuation passes in 23.9 seconds within the unchanged 90-second timeout.
  • Final prompt repair: 28 cases across the session runner, detached prompt consumer and restart regression pass in 29.2 seconds Vitest / 32.4 seconds wrapper. The new prompt cases fail on the preceding head for the expected missing-context/untrusted-wrapper assertions; their test bodies take milliseconds. The prompt-prefix stability test also passes.
  • CI caught an older adapter test that still expected a locked session to allow fallbacks after the model-lock repair. The corrected table retains exact declared/empty fallback assertions for unlocked sessions and verifies suppression under a lock. All 12 file cases pass in 6.2 seconds; the existing real queued lock scenario also passes in 8.4 seconds (11.8 seconds wrapper). Production behavior is unchanged.
  • Review caught a setup-watchdog gap after queued session adoption. Queue owners now report actual wait/admit transitions, including native capacity waits and policy re-admission; provider start retains its separate execution deadline. The watchdog regression fails on the preceding head, and the real deferred-session case fails before the lifecycle wiring. The corrected selection passes 32 cases, including restart, source authority and both execution adapters; no timeouts or assertions were weakened.
  • The final delivery repair carries Cron’s existing resolved-tool prompt finalizer into both ordinary execution adapters. It supplies safe explicit-target metadata and automatic-delivery guidance only after actual tool availability is known; the inbound owner continues to supply routed formatting once. Five missing-guidance regressions fail before the fix; all 28 touched-suite cases, 19 restart/prefix/native-tool-policy cases and two focused CLI finalization cases pass. Shared system prefixes remain unchanged.
  • CI exposed a static type-import cycle in the finalizer adapter. Moving the unchanged callback type into a dependency-free contract fixes it: the exact Madge check fails before and reports zero cycles after. Both affected type graphs, typed lint, format and nine existing prompt/restart cases pass; no runtime behavior or test assertions changed.
  • A queued Gmail-hook regression showed that revoking hooks.gmail.allowUnsafeExternalContent could leave the old unwrapped prompt after config re-admission. Cron now retains the raw occurrence and rebuilds the prompt with each admitted config, keeping its original firing timestamp. The real Cron/queue regression fails before the fix; all 57 affected queue, source-custody, prompt and restart cases pass (108 seconds wrapper; the new case takes 3.2 seconds).
  • Merged current main f70a4ba83c2b after GitHub reported a conflict. The sole overlap was the failure-alert fixture: it now uses main’s shared setup while retaining both execution adapters. All six failure-alert/restart cases and four Claw schema cases pass; core/Cron/infra types, typed lint, format, exact staged line-growth and zero-cycle Madge pass. No production file overlapped.
  • Rejected turns now retain their actionable recovery payload in automation receipts. The context-overflow regression fails before the fix with only a generic error, then passes with the existing /compact and /new guidance. The affected selection passes all 33 cases across the initial run and focused replay; 22 handoff and three restart cases also pass. Core/infra types, typed lint, format and line-growth pass; local and committed delta reviews are scoped-clean through P2. No authority, status or delivery policy changed.
  • CI9 caught a missing required durationMs field in the new synthetic context-overflow fixture. The owning messaging type graph reproduces the error before the one-line fixture correction and passes after it. The selected context-overflow case still passes in 3.1 seconds (14.8 seconds wrapper); typed lint, format and local/committed delta reviews pass. No production behavior or assertion changed.
  • Review found that a message-tool send could retain the destination captured before queued execution. The Automations owner now composes its existing live destination check into the message capability’s occurrence fence. The real Cron/controller/message-tool regression fails before the fix; changed-route, unchanged-route and delivery:none controls pass afterward. All 39 affected cases, including restart, pass in 76.7 seconds; core/messaging type graphs, typed lint, format and line-growth pass. The change adds three net production lines and preserves the original occurrence authority.
  • Affected compiler graphs, typed lint, format, whitespace and line-growth ratchet pass. Protocol generation/check, prompt snapshots and the package build pass without tracked generated drift. The import-cycle guard reports zero cycles. Codex reviews are scoped-clean through P2.

The prior-head Android Play CI run (39518190275, job 118956103466) timed out in ChatComposerLayoutTest.modelSelectionPinsNamedDefaultAndKeepsAdmittedEffectOwned at its unchanged 1-second catalog wait. A secretless Linux replay with matching Java/Gradle pins and two test forks passed the exact case 3/3 on clean CI main d6e3a30c0bfce and 3/3 on the tested merge 439a6ede1c35. The Android source and relevant toolchain inputs match. This is non-reproduction evidence, not an inherited-failure or repair claim; the isolated replay does not reproduce preceding suite order/load. Android Play subsequently passed in exact-head run 39520774003 on 9b4a2cabd181.

CI run 39523844566, job 118974256949 fails server.sessions.create-notices.test.ts:144: its trusted spawn fixture expects a human profile while the existing delegated-creator projection returns an agent. The original 28-file shard selection with CI's checksum-pinned Bun reproduces the identical assertion on clean current main 1989e3dc4360 on macOS; the complete selection has 1 failure/222 passes in 190.6 seconds (the first batch matches CI at 1 failure/135 passes). The test, creation handler, inheritance, provenance and row-projection inputs are unchanged by this PR. The run completed with 101 successful jobs, 20 skipped jobs, this inherited failure and its aggregate gate. The next completed run 39526422189 on 66a8829ab738 had 100 successful jobs, 20 skipped jobs, the same inherited creator failure, the now-repaired fixture type failure, and the aggregate gate. Final-head CI 39528902818, attempt 1 on 78c8fa1884a7b, completed with 103 successful jobs, 20 skipped jobs, the same inherited creator assertion (job 118990488145), an inherited formatting failure, and the aggregate gate. All build, type, lint, UI, Android and PostgreSQL jobs passed. The initial runner queue drained without cancellation or retry.

The formatting failure is confined to unchanged ui/src/pages/chat/chat-state-resource-layout.test.ts in check-docs job 118990487035. The same formatter command on that file fails identically on clean actual CI main 15905ee254d0, with oxfmt/Bun agreement. The file, formatter owners, pins, configuration and dependency inputs are unchanged in the tested merge. The creator test and its four runtime inputs also match the retained clean-main proof and are unchanged in tested merge f12ef35f0dae (parents main 15905ee254d0 and this PR head). These two unrelated failures qualify for the authorized pre-existing-failure landing exception; failed CI is not presented as green.

The original system-event restart regression has a separate failing-on-main control in #178650: unadopted work becomes one interrupted error after restart, without replay or duplication.

Two repository-wide static inventories fail identically on clean base c4c695af703bf82e7ae72005639e7f18f9e760f0: max-lines suppression entries in three untouched UI files, and test-root counts (agents-tools 721, gateway-root 724, infra 724, plugins-platform 727 against 720). Affected compiler graphs pass. No thresholds, assertions or skips were changed. The build reports the existing advisory UI startup size of 318.6 KiB against 317.5 KiB; exact-head CI supplies the enforced broad result.

Production +2,400/−967 (net +1,433); tests/support +2,232/−133 (net +2,099); docs +5/−1. The incremental growth retains the shipped heartbeat and detached execution contracts until their migration and deletion slices. The prompt repair itself removes eight production lines by sharing the existing builder.

Representative proof commands:

node scripts/test-projects.mts src/cron/session-run.test.ts src/cron/isolated-agent/run.message-tool-policy.test.ts src/cron/service.restart-session-event.test.ts --maxWorkers=1
node scripts/test-projects.mts src/auto-reply/reply/session-event-config-readmission.test.ts src/auto-reply/reply/get-reply-run-admission.test.ts --maxWorkers=1
node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/e2e/qa-lab/runtime/gateway-authorized-continuation.e2e.test.ts --maxWorkers=1
pnpm build

Limits: synthetic-model proof covers runtime authority and settlement, not external-provider transport. No live Team or Gateway state changed. Main-target agent turns, migration, runtime owner delivery and portable Claw Add remain slice 3; heartbeat/SDK removal remains slice 4. Exact-head PR CI supplies broad proof.

…ssion admission

Slice 2 of #167796. Route explicit session agent turns through the ordinary session controller while preserving scheduled source authority, inference binding, delivery and managed-worktree custody. Retain legacy heartbeats and detached execution until their migration slices.

Add Peter-approved Claw review everyMs and owner variants without changing existing declaration variants.
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 20, 2026 20:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T01:46:26.377164Z 78c8fa1 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL labels Oct 20, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

assertCurrent: assertEffectCurrent,
...(target.sessionId === "" && options.createIfMissing

P2 Badge Preserve the underlying agent failure in cron results

When the agent returns a normal terminal failure result, such as exhausted provider fallbacks, onFailed is not invoked and this assignment becomes the run's top-level error even though deliveryEvidence.meta.error.message contains the actual cause. runCronSessionTurn() consequently records and sends failure alerts containing only Session event execution failed, leaving operators without the actionable provider/model error; project the terminal error into failure while retaining diagnostics.

AGENTS.md reference: AGENTS.md:L75-L75

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/auto-reply/reply/model-selection.ts Resolved
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 20, 2026
Reject explicit scheduled models after policy revocation before automatic selection can substitute another model. Preserve terminal agent errors in settlement receipts and keep shared result and delivery contracts independent of runtime imports. Real deferred-admission and terminal-failure regressions pass with the focused consumer and restart checks.
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 78c8fa1884a7b5fc434f0b2b3e286d77b17bfb0a
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/runtime-plan/credential-source.types.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa55804a57

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/auto-reply/reply/model-selection.ts Resolved
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

Routes explicitly conversation-targeted scheduled turns through ordinary session admission, execution, delivery, and settlement.

Example: A scheduled report targets session:agent:main:project:inbox while another turn is active.

  • Before: Cron uses its separate execution path after waiting for the conversation.
  • After: The report joins the conversation’s ordinary queue, and Cron waits for terminal settlement.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful ownership consolidation with meaningful runtime and authority evidence, but the remaining premature-completion regression blocks merge.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): For this maintainer-authored PR, the supplied isolated Gateway continuation run and production-owner controls cover allowed execution, queued revocation, forbidden workspace access, and revocation during publication; the latest route regression rejects the stale destination before the transport adapter while controls still send.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Scheduled conversation work has a separate execution owner, making conversation queueing, authority, workspace custody, and completion harder to keep consistent.
Reason: The maintainer-authored direction consolidates existing responsibility, preserves later migration boundaries, and explicitly approves the additive Claw review variants.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this maintainer-authored PR open: the session-admission cutover is useful, but the previously reported scheduled-send finality regression remains unfixed.

Priority: P2
Reviewed head: 78c8fa1884a7b5fc434f0b2b3e286d77b17bfb0a

Before merge

  • Preserve Cron’s nonfinal default for scheduled message sends (P1) - This previously reported finding remains unfixed. For a session-targeted announce job that sends to its configured destination with final omitted and then updates a ledger, both adapters consume this builder without messageToolFinalByDefault. resolveMessageToolSourceReplyFinal consequently defaults to true, and the embedded terminal hook can complete the turn immediately after the send, skipping the ledger update. Forward scheduledAutomation.sourceDelivery.messageTool.finalByDefault here and cover continued execution after the send, preserving the contract from fix(cron): job stops right after sending to its own delivery target #176141.
  • Explain or restore the original intent of Scheduled message-send finality - 075b466: A configured Cron destination must not end the job when final is omitted, because post-send steps still need to run.

Findings

  • [P1] Preserve Cron’s nonfinal default for scheduled message sends — src/auto-reply/reply/agent-runner-run-params.ts:173-177

Provenance

  • Scheduled message-send finality changes intended behavior without addressing why it exists (075b466: A configured Cron destination must not end the job when final is omitted, because post-send steps still need to run.)

Tests

  • Missing end-to-end proof: The supplied proof does not exercise a session-targeted same-destination send with final omitted followed by a real ledger write.
Agent review details

How this fits together

Cron supplies scheduled work and captured authority to the session controller; ordinary reply execution produces tool effects, delivery evidence, and a terminal result for Cron history.

flowchart LR
  A[Cron occurrence] --> B[Session event admission]
  B --> C[Conversation controller]
  C --> D[Reply execution]
  D --> E[Embedded or CLI runtime]
  E --> F[Tools and delivery]
  F --> G[Terminal settlement]
  G --> A
Loading

Technical review

Best possible solution:

Forward Cron’s existing message-tool finality default through the shared candidate builder and preserve send-then-continue behavior through ordinary session execution.

Do we have a high-confidence way to reproduce the issue?

Source establishes the failing path: scheduled candidates omit the finality override, the resolver defaults omitted final to true, and a confirmed same-target send terminates embedded execution; no target code was run during this review.

Is this the best way to solve the issue?

Reusing ordinary session admission is the right ownership direction, and the smallest remaining repair is one shared parameter projection rather than another execution or delivery owner.

Full review comments:

  • [P1] Preserve Cron’s nonfinal default for scheduled message sends — src/auto-reply/reply/agent-runner-run-params.ts:173-177
    This previously reported finding remains unfixed. For a session-targeted announce job that sends to its configured destination with final omitted and then updates a ledger, both adapters consume this builder without messageToolFinalByDefault. resolveMessageToolSourceReplyFinal consequently defaults to true, and the embedded terminal hook can complete the turn immediately after the send, skipping the ledger update. Forward scheduledAutomation.sourceDelivery.messageTool.finalByDefault here and cover continued execution after the send, preserving the contract from fix(cron): job stops right after sending to its own delivery target #176141.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1bc029e59c6c.

Provenance checked

  • Ordinary session-event admission and settlement keeps the original intent (753a7a5: Move immediate notifications into ordinary conversation execution while retaining source authority, FIFO ordering, and terminal settlement.)
  • Managed workspace custody keeps the original intent (300ef39: Use the bound conversation workspace while rejecting foreign, missing, retired, or mismatched worktrees.)
  • Recorded inference account keeps the original intent (d25a316: Keep an automation on its authorized account across default changes, with live revocation and replacement checks.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/auto-reply/reply/agent-runner-execution-session-events.test.ts --maxWorkers=1
  • pnpm test src/agents/embedded-agent-runner/run/message-tool-terminal.test.ts --maxWorkers=1
  • pnpm test src/auto-reply/reply/session-event-config-readmission.test.ts --maxWorkers=1
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 753a7a5 adds src/auto-reply/reply/session-event-handoff.ts:67 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 753a7a57be10; files: src/auto-reply/reply/session-event-handoff.ts)
  • Ayaan Zaidi: Raw commit 075b466 adds src/cron/isolated-agent/run-prompt-executor.ts:469 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 075b46634555; files: src/cron/isolated-agent/run-prompt-executor.ts)
  • Jason (Json): Raw commit d25a316 adds src/cron/isolated-agent/run-prompt-executor.ts:168 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d25a316fc7c3; files: src/cron/isolated-agent/run-prompt-executor.ts)

PR surface

Source +1433, Tests +2099, Docs +4. Total +3536 across 80 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 60 2400 967 +1433
Tests 18 2232 133 +2099
Docs 2 5 1 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 80 4637 1101 +3536

Review metrics

Metric Value Why it matters
Production versus test growth Production +2,400/−967; tests/support +2,232/−133 Growth adds the session cutover while sharing existing authority, inference, workspace, prompt, and telemetry owners; detached and heartbeat paths retain their documented later retirement stages.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a useful scheduled-execution refactor with a focused pre-merge correctness repair.
  • merge-risk: 🚨 message-delivery: A successful scheduled send can prematurely finish the turn, skipping post-send bookkeeping and potentially blocking subsequent deliveries.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-20T22:42:35.598Z sha 3d47d9a :: blocked before merge. :: [P1] Preserve Cron’s nonfinal default for scheduled message sends | [P1] Preserve legacy hook provenance when building the prompt | [P2] Retain scheduled job identity and current-time context
  • reviewed 2026-10-20T23:08:25.514Z sha 7f9573f :: needs changes before merge. :: [P1] Preserve Cron’s nonfinal default for scheduled message sends | [P1] End lane waiting when the session event is adopted
  • reviewed 2026-10-20T23:17:58.536Z sha 7f9573f :: needs changes before merge. :: [P1] Preserve Cron’s nonfinal default for scheduled message sends | [P1] End lane waiting when the session event is adopted
  • reviewed 2026-10-21T00:14:38.824Z sha d04578b :: needs changes before merge. :: [P1] Preserve Cron’s nonfinal default for scheduled message sends | [P2] Include the configured delivery target in scheduled prompt preparation
  • reviewed 2026-10-21T00:35:36.283Z sha 9b4a2ca :: blocked before merge. :: [P1] Preserve Cron’s nonfinal default for scheduled message sends | [P2] Rebuild scheduled hook prompts under the readmitted config
  • reviewed 2026-10-21T01:06:53.337Z sha e94ade2 :: needs changes before merge. :: [P1] Preserve Cron’s nonfinal default for scheduled message sends | [P2] Preserve rejected runner failure details in terminal settlement
  • reviewed 2026-10-21T01:15:06.221Z sha e94ade2 :: needs changes before merge. :: [P1] Preserve Cron’s nonfinal default for scheduled message sends | [P2] Preserve rejected runner failure details in terminal settlement
  • reviewed 2026-10-21T01:25:09.150Z sha 66a8829 :: needs changes before merge. :: [P1] Preserve Cron’s nonfinal default for scheduled message sends | [P2] Include required duration metadata in the overflow fixture

Reviewed October 20, 2026, 9:50 PM ET / October 21, 2026, 01:50 UTC (Revision 10).

Reject malformed explicit models and contradictory agent/session targets while preserving legacy main-session aliases. Route authenticated continuation proof through ordinary session admission and retain its recovery, revocation, and no-duplicate contracts.
Resolve scheduled model and fallback policy through the existing Cron owner at ordinary session admission. Preserve queued configuration changes, Gmail thinking, model locks, and durable conversation preferences. Keep model preparation separate from settlement callbacks and consolidate existing stored-pin selection.
@steipete

Copy link
Copy Markdown
Contributor Author

Updated to 3d47d9a. The three review findings are fixed with boundary regressions: revoked or malformed explicit models fail visibly, and contradictory agent/session targets are refused while legacy main-session aliases retain their behavior.

The repair also preserves scheduled model/fallback precedence and separates turn-local account selection from saved conversation pins. Independently recorded job accounts retain their existing authorization checks and work when an unrelated destination account is unavailable. Focused tests and affected static checks pass; committed-branch review is scoped-clean. The PR body records the proof, costs, and limits. Exact-head CI is running in 39508097052.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Oct 20, 2026
RomneyDa added a commit that referenced this pull request Oct 24, 2026
…essionEvent

The scheduled follow-up authority backport (eb843f7) added fixtures that
only wire runIsolatedAgentJob. The harness backport (c9e4bb5, #180270,
from main 3d2f7ca / #178764) landed on the parallel line and routes
`session:` agent turns through runSessionEvent; merge 4a81b7f combined
them without updating these fixtures, so every explicit-session job failed
with "Session event execution is unavailable" or hung waiting for a payload
that never ran.

Port main's fixture shape: wire runSessionEvent through runCronSessionTurn,
mock only embedded model execution, report execution start from the fake
runner, retire the completed recovery predecessor before admission, and
expect mid-run operator revocation to fail the session turn (main's
contract). One-shot ownership uses a runSessionEvent mock as on main.
obviyus added a commit that referenced this pull request Nov 12, 2026
…n session is used from a DM (#180603)

fix(cron): bind scheduled message capabilities under the keys the run's tools use

Since scheduled conversation work moved through session admission (#178764), a cron or heartbeat run on the main session minted its message-action capability under the plain session key, while the run's own tools looked it up under the peer-scoped runtime policy key when the main session was used from a DM. The lookup missed, so every message send failed with "message action turn capability is no longer active", or the run failed earlier with "plugin delivery capability is no longer active". The scheduled grant is now redeemable under the turn's runtime policy key and records the execution session key as sourceReplySessionKey, as ordinary replies already do (#149131). It is still one capability for the same run with the same lifetime and revocation; nothing is granted, widened or skipped. No text changes.

Evidence: a built Gateway with the real bundled Codex app-server against a local model endpoint that calls message, the real WhatsApp channel with only the Baileys socket stood in, and a Telegram stand-in, two runs each. With the main session used from a WhatsApp DM, a heartbeat on agent:main:main failed the send on main and delivers with this change; from a Telegram DM it failed before the model call on main and delivers with this change. Ordinary DM turns, an isolated job and an announce job with --to deliver on both, a heartbeat whose job is removed mid-decision sends nothing, and a grant minted for one peer is refused for another peer on both. Net 0 test lines; the structured-result test fails on main. Details: #180603 (comment).

Closes #180602. Closes #197181. Thanks @masatohoshino for the fix and @Suiah98 for the report.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 13, 2026
…n session is used from a DM (openclaw#180603)

fix(cron): bind scheduled message capabilities under the keys the run's tools use

Since scheduled conversation work moved through session admission (openclaw#178764), a cron or heartbeat run on the main session minted its message-action capability under the plain session key, while the run's own tools looked it up under the peer-scoped runtime policy key when the main session was used from a DM. The lookup missed, so every message send failed with "message action turn capability is no longer active", or the run failed earlier with "plugin delivery capability is no longer active". The scheduled grant is now redeemable under the turn's runtime policy key and records the execution session key as sourceReplySessionKey, as ordinary replies already do (openclaw#149131). It is still one capability for the same run with the same lifetime and revocation; nothing is granted, widened or skipped. No text changes.

Evidence: a built Gateway with the real bundled Codex app-server against a local model endpoint that calls message, the real WhatsApp channel with only the Baileys socket stood in, and a Telegram stand-in, two runs each. With the main session used from a WhatsApp DM, a heartbeat on agent:main:main failed the send on main and delivers with this change; from a Telegram DM it failed before the model call on main and delivers with this change. Ordinary DM turns, an isolated job and an announce job with --to deliver on both, a heartbeat whose job is removed mid-decision sends nothing, and a grant minted for one peer is refused for another peer on both. Net 0 test lines; the structured-result test fails on main. Details: openclaw#180603 (comment).

Closes openclaw#180602. Closes openclaw#197181. Thanks @masatohoshino for the fix and @Suiah98 for the report.

Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 16, 2026
…n session is used from a DM (#180603)

fix(cron): bind scheduled message capabilities under the keys the run's tools use

Since scheduled conversation work moved through session admission (#178764), a cron or heartbeat run on the main session minted its message-action capability under the plain session key, while the run's own tools looked it up under the peer-scoped runtime policy key when the main session was used from a DM. The lookup missed, so every message send failed with "message action turn capability is no longer active", or the run failed earlier with "plugin delivery capability is no longer active". The scheduled grant is now redeemable under the turn's runtime policy key and records the execution session key as sourceReplySessionKey, as ordinary replies already do (#149131). It is still one capability for the same run with the same lifetime and revocation; nothing is granted, widened or skipped. No text changes.

Evidence: a built Gateway with the real bundled Codex app-server against a local model endpoint that calls message, the real WhatsApp channel with only the Baileys socket stood in, and a Telegram stand-in, two runs each. With the main session used from a WhatsApp DM, a heartbeat on agent:main:main failed the send on main and delivers with this change; from a Telegram DM it failed before the model call on main and delivers with this change. Ordinary DM turns, an isolated job and an announce job with --to deliver on both, a heartbeat whose job is removed mid-decision sends nothing, and a grant minted for one peer is refused for another peer on both. Net 0 test lines; the structured-result test fails on main. Details: #180603 (comment).

Closes #180602. Closes #197181. Thanks @masatohoshino for the fix and @Suiah98 for the report.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit 4f96534)

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui clawsweeper:intake:feature Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant