Repository navigation
fix: main-session automations fail before the model call when the main session is used from a DM - #180603
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesBind scheduled message capabilities to the runtime policy session while retaining the executing session identity. Example: A heartbeat runs in agent:main:main after that session was used from a Telegram DM.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR fixes a current scheduled-message regression with a focused producer-side correction; no actionable defects remain, and the exact-head CI gate now passes. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe reply admission layer converts scheduled occurrences into admitted agent runs and message capabilities consumed by tool preparation and outbound delivery. flowchart TD
A[Scheduled occurrence] --> B[Session turn admission]
B --> C[Policy bound capability]
C --> D[Message tool]
D --> E[Live authority and delivery fence]
E --> F[Channel transport]
Technical reviewBest possible solution: Merge the focused capability-binding repair while retaining exact peer matching and existing live delivery authority. Do we have a high-confidence way to reproduce the issue? Source establishes the exact mint-versus-redemption mismatch, supported by reporter traces and supplied before/after Gateway runs; this read-only review executed no target code. Is this the best way to solve the issue? The repair follows ordinary reply identity binding at the producer and preserves strict consumers, avoiding a second authorization path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8d269eb63c90. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests 0. Total +4 across 3 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. 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: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed November 11, 2026, 11:17 PM ET / November 12, 2026, 04:17 UTC (Revision 7). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Note 🤖 Codex responding on behalf of TheAngryPit We independently hit #180602 in a scheduled Telegram main-session turn and confirmed the same execution-key versus policy-key mismatch. Your producer-side correction fixed it in our integration without changing the delivery or revocation guards. Our additional regression goes through native This is additional evidence from our integration, not testing of this PR's exact head, and it does not close the outstanding cross-peer transport-proof question. We're happy to help carry this forward onto current main and contribute the regression/proof while preserving your authorship and the existing history. Are you still actively working on it? If not, we can pick up the remaining integration work here rather than open a competing PR. |
…lity The scheduled grant is redeemed under the turn's runtime policy key; personal-tool authority checks the run's own registration through sourceReplySessionKey, as ordinary replies already set it (openclaw#149131).
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Heads-up @steipete, since #178764 (3d2f7ca) introduced this: scheduled session turns mint their message-action capability under the execution key ( |
|
Proof captures on head 202b1c5 (production code built from 45292a186c6f; the head only reformats the test). Main |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 4f96534. Thanks @masatohoshino and @Suiah98. |
…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: openclaw/openclaw#180603 (comment). Closes #180602. Closes #197181. Thanks @masatohoshino for the fix and @Suiah98 for the report. Co-authored-by: Ayaan Zaidi <[email protected]>
…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]>
…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]>
Closes #180602
Closes #197181
Thanks @masatohoshino for the original fix and reproduction, and @Suiah98 for the detailed #197181 report and the isolated-session control run.
What Problem This Solves
When the main session is used from a channel DM (default
session.dmScope), a scheduled turn bound to that session cannot use themessagetool. On direct-delivery channels such as Telegram the run fails before the model call withplugin delivery capability is no longer active(#180602). On gateway-delivery channels such as WhatsApp the run reaches the model and everymessagesend fails withmessage action turn capability is no longer active(#197181). Ordinary DM turns and isolated jobs are unaffected.Why This Change Was Made
Since #178764, scheduled session turns mint their message-action turn capability under the execution session key (
agent:main:main). The run's tools redeem it under the turn's runtime policy key, which is peer-scoped for a DM-routed main session, so the lookup misses. That is an identity mismatch, not a revocation: the token is never revoked early.Ordinary replies already bind the capability correctly (#149131): they mint under the runtime policy key and record the execution session as
sourceReplySessionKey. The scheduled mint now does the same. The first commit (by @masatohoshino) moves the key to the policy key; the second passes the execution key assourceReplySessionKey. Without the second half, the personal-tool check that matches the run's own registration rejects the send withPersonal-tool turn authority is no longer active. It is still one capability, for the same agent, run and session id, with the same lifetime and revocation. Nothing is granted, reissued or widened.Evidence
Built Gateway in a secretless node:24.22.1 container, the real bundled Codex app-server (0.164.0) against a local Responses endpoint whose model calls
message, the real WhatsApp channel with only the Baileys socket stood in, and a Telegram Bot API stand-in. Main4092d358a35aand this branch each ran twice, with identical results.message(control)session:agent:main:main, main session last used from a WhatsApp DMmessage; tool resultmessage action turn capability is no longer active; nothing sentmessage(control)plugin delivery capability is no longer active--announce --channel telegram --to 1001(control)messageafter the removal; nothing is sentCross-peer check on the built tree (no mocks): a turn grant bound to Alice's DM policy key and the main execution session, redeemed through the real built
messagetool. With Bob's policy key the send is refused at the capability check, before any outbound I/O; with Alice's key it passes that check and continues (it then stops on the missing Gateway runtime, as expected outside a Gateway). Same result on main and this branch, since redemption stays exact:Tests: the existing structured-result test now also checks that the scheduled grant redeems only under this peer's policy key and names the executing session (fails on main), paid for by consolidating the fallback table and the CLI static-prompt assertion in the same file (test lines net 0). The post-revocation assertions in the revoked-event tests are unchanged.