Repository navigation
refactor: keep internal wakes out of message channels - #132986
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 9:57 PM ET / August 30, 2026, 01:57 UTC. ClawSweeper reviewWhat this changesMoves heartbeat, cron, and exec-completion wake identity out of message-channel fields into typed internal context, updates routing and CLI tool grants, and adds regression coverage plus a live cron/exec scenario. Merge readinessKeep open: the branch coherently replaces recently introduced pseudo-message-channel wake labels with a typed internal-source field and preserves real delivery routing; no introduced functional defect was found. It still needs normal exact-head CI completion and compatibility review before landing. Priority: P2 Review scores
Verification
How this fits togetherHeartbeat and system-event jobs enter the reply pipeline with delivery metadata and an internal wake reason. The reply pipeline selects a real reply route, then CLI and embedded runtimes pass only validated message channels to Gateway tool execution. flowchart LR
A[Heartbeat and cron events] --> B[Internal wake context]
B --> C[Reply pipeline]
C --> D[Effective reply route]
D --> E[CLI or embedded runtime]
E --> F[Validated Gateway tool call]
F --> G[Subagent or channel action]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +14, Tests +50, Docs +17, Other +295. Total +376 across 34 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the typed wake-source boundary once exact-head checks pass and maintainers confirm that legacy Provider normalization is the intended compatibility boundary rather than retaining wake labels as message channels. Do we have a high-confidence way to reproduce the issue? Yes: source establishes the reported scheduled system-event to CLI MCP to Gateway validation path, and the PR body reports an after-fix live cron and delayed-exec scenario. Is this the best way to solve the issue? Yes: placing wake identity in typed ingress and producer context while reusing the existing real-channel resolver removes the fake-channel exception rather than expanding it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 731230b6f6fe. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Compatibility boundary confirmed for the ClawSweeper review and rank-up move: The supported compatibility commitment is legacy SDK The final branch has passed 741 focused tests and live embedded/Codex cron+exec delegation; production and live-scenario bytes are unchanged after the CI test-only correction. Exact-head CI is still finishing its final test shard and remains a required pre-merge gate. The latest independent Codex review found no actionable findings at the workflow's default P0 threshold. |
|
Merged via squash.
|
* refactor: keep internal wakes out of message channels * test: align internal wake integration expectations
Keep conversation metadata separate from execution authority. Consume only selected event occurrences, retain reminders after unconfirmed delivery, and settle pending final delivery on its exact execution-session owner. Integrate main at 47b8889 through an ordinary merge while preserving original contributor ancestry. Related: openclaw#132986. Co-authored-by: Marvinthebored <[email protected]>
Related: #132817, #132890
What Problem This Solves
Internal cron and background-process wakes were represented as message providers such as
cron-eventandexec-event. That let a wake reason leak into delivery routing and subagent tool context, requiring downstream exceptions. The CLI MCP grant also preferred this label over an explicit real message channel.Why This Change Was Made
Carry the wake cause in
MsgContext.InternalTurnSourceand keep transport/reply routing separate. The heartbeat owner produces the typed field; session reset, reply-route inheritance, participant observation, and prompt assembly consume it. Shipped SDK legacy inputs normalize at ingress. The CLI grant now uses the same channel precedence and resolver as embedded tools.The transient event queue and wake scheduler remain necessary for work that happens after a user turn, but they no longer need to pretend to be channels. This change does not alter event persistence, notification policy, transcript provenance, execution authority, configuration, or Gateway protocol. Shipped Gateway internal source hints remain accepted; the two unshipped cron-event/exec-event exceptions from #132890 are removed.
Production LOC: +78/-70 (net +8). Tests and QA: +570/-219. Docs: +17/-0. The remaining production growth is the single typed-source and SDK normalization boundary; repeated source predicates and the CLI-specific channel wrapper were removed.
User Impact
Cron and exec completion turns retain their session and reply route and can delegate work without passing a fake channel to a child. Plugin authors can use the typed source directly; legacy SDK callers remain supported.
Evidence
Before-change regression proof: the original ingress and CLI-grant modules fail all six new source/route cases, with 50 existing tests passing. The failures show legacy labels winning over Telegram and missing typed source normalization.
All 741 focused tests passed, including Gateway rejection of the two unshipped pseudo-channels.
node scripts/check-changed.mjspassed all typecheck targets, lint, dependency/boundary guards, dead-export checks, and runtime import-cycle checks. Exact-head CI is required before landing.Independent Codex autoreview passed with no accepted findings at its default P0 threshold; maintainer code reading covered producer, ingress, session metadata, routing, queue handoff, CLI/embedded tool construction, and the pinned Codex turn-input contract.
Live QA requires naturally fired main-session cron and delayed background exec completion to spawn successful children. Each child must actually read and return a random marker absent from the parent instruction. Exec completion is released only after its initial turn ends. The scenario uses the isolated QA channel; current routeless exec-output suppression is deliberately preserved.
Final live proof passed on both embedded OpenClaw and Codex app-server, using real Gateway processes and live models in an isolated Testbox lease. All four cron/exec children succeeded, read and returned their hidden random markers, and reached delivered status. No tool errors appeared in retained parent or child transcripts. Both exec timelines prove initial-turn completion before process completion, followed by accepted spawn and successful child completion. The lease and its two retained temporary roots were cleaned up after evidence collection.
Reproduction: run
openclaw qa suite --provider-mode live-frontier --runtime-pair openclaw,codex --scenario internal-event-subagent-spawn-live --concurrency 1through the repository Testbox wrapper. The final 30-file source snapshot is SHA-256c1b73f892aaeb579847739d1612b0793a013e76898b63025e14b1c0dd5ccf224. Ordinary CLI execution is covered by focused grant-context tests, not this live runtime matrix.Earlier live attempts corrected fixture assumptions: completion output is intentionally truncated, and the Codex tool is named
gateway_exec. The final fixture gives prior user authorization and short completion metadata within that contract. An intermediate fixture additionally requestedsessions_yieldand exposed requester settlement retrying despite transcript-visible child output. The final scenario does not request yield; its original spawn, real-read, hidden-marker, and chronology assertions remain intact.Named follow-up: Yielded internal-turn requester settlement rejects transcript-visible results without confirmed requester delivery. The settlement and visibility owners are unchanged, but the captured intermediate artifacts do not expose the exact requester origin, delivery target, and final delivery status. Capture those inputs and compare the identical yielding scenario on the base before classifying this as preexisting or attributing it to this refactor. This PR does not claim to repair that separate settlement path.
The first hosted CI run exposed missed test expectations in the real-heartbeat cron integration, CLI grant/tool projection, and QA lane catalogue. The follow-up changes only those four test files: assert the typed cron source and absent pseudo-provider, preserve explicit Telegram precedence, and include the new scenario in the exact catalogue count/list. The full affected suites passed (124 cron/CLI tests and 150 QA tests), and the test-only follow-up passed independent review. Production and live-scenario bytes remain identical to the recorded live snapshot.