Repository navigation
refactor(automations): remove retired heartbeat turn paths - #180563
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d89f7f3f49
ℹ️ 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".
|
Codex review: blocked before merge. What this changesThis PR removes retired heartbeat turn flags, wake helpers, routing branches, and their coupled fixtures after Automations took over execution. Example: An automation finishes with a terminal reply marked silent.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 8 items remain Keep open: this maintainer-approved cutover is useful, but missed consumer updates cause CI failures and GitHub reports a merge conflict. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherCron and asynchronous producers submit work through session admission; agent runtimes produce terminal facts that delivery, context engines, and Gateway subscribers consume. flowchart LR
A[Automation jobs] --> C[Session controller]
B[Session events] --> C
C --> D[Agent runtime]
D --> E[Terminal reply facts]
E --> F[Channel delivery]
D --> G[Context engine outbox]
E --> H[Gateway subscribers]
Technical reviewBest possible solution: Complete the consumer-fixture migration while retaining the ordinary session, terminal-reply, delivery, and Doctor owners. Do we have a high-confidence way to reproduce the issue? This is a refactor rather than a current-main bug report; exact-head CI reproduces the consumer failures listed below, and source establishes their causal links. Is this the best way to solve the issue? Removing the retired execution model is the smallest coherent cutover, but every remaining consumer must use the surviving contracts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 42575f9a5e1d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 22, 2026, 7:56 AM ET / 11:56 UTC. |
|
Merged via squash auto-merge.
|
…ion-event handoff Upstream retired heartbeat turns (openclaw#180192, openclaw#180563), and with them requestHeartbeatNow, which every continuation wake used. Per 🌻's ruling (option 1), continuation-wake.ts bridges continuation wakes onto enqueueSessionEventForHost; no heartbeat runner comes back. - requestContinuationWake names the durable rows (ack ids) it wakes for. Requests for one session and delivery class coalesce over the retired wake's 250 ms window into ONE event turn whose `occurrences` are the named queued events, each with its own identity. - Stale recipient authority is settled through settleStaleSystemEventAuthority; a return produced for a replaced head (expectedSessionId) stays with the passive prompt owner. - Each handed-off row is claimed so replays cannot re-queue it. The turn's onAdopted acks the rows. A refused or never-adopted turn releases the claims, and preserveOccurrenceOnRejection returns the occurrences to the passive queue with their rows pending. - delegate-return and silent-wake-enrichment carry continuationTrigger "delegate-return" and parentRunId into the turn's reply options (a narrow `continuation` option on the handoff), so a delegate return keeps its chain budget. Silent-wake runs with deliver:false and never shares a turn with a visible wake. - Producers swap requestHeartbeatNow for requestContinuationWake: targeting (delegate-return), silent-wake enrichment, durable notices, and restart replay (its generic wake included). Work dispatch keeps "active-run" as its retryable busy reason. - The handoff gains a "continuation" source and the `continuation` reply-option passthrough, its only change. - Retired with the runner: the fork's session-event-wake helpers and its heartbeat-runner / heartbeat-wake continuation tests (their cases move to the wake's tests). WIP: test migration and the wake's own tests follow. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o requestContinuationWake Woken returns are handed to their turn as occurrences and never pass the passive queue drain, so they emitted no `continuation.queue.drain` span and their `traceparent` parented nothing. The wake now emits that span when the turn adopts them, parented by the first traceparent among them. RED without the emit (no span), GREEN with it (one span, drained_count 1, continuation count 1). RFC docs/design/continue-work-signal-v2.md: - silent-wake, targeted wake, §3.1 transport note, §3.2 diagram/timeline and the §6.1 anchor table move from requestHeartbeatNow to requestContinuationWake; §3.2 states the wake's contract (turns coalesce, payloads never merge; ack on adoption; lineage through admission; silent stays silent; restart replay) - the trace-context return claim names the drain span, not a wake heartbeat - chain-reset examples say "scheduled (cron) turn" instead of heartbeat - remaining requestHeartbeatNow references are labelled historical (upstream retired the heartbeat runner in openclaw#180192 and openclaw#180563) Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…180563) * refactor(automations): remove retired heartbeat turn paths * test(automations): align fixtures with retired heartbeat contracts
…ble seam Upstream openclaw#180563 moved prompt preparation from peekSystemEventEntries to peekDeliverableSystemEventEntries, and the jump-3 merge took that. This suite still mocked the old reader, so the rollover and stale-recipient cases fed prompt preparation an empty selection and failed at a18ab20. Mock the reader prompt preparation now uses; every assertion is unchanged. Patch-only reverts of production prove the cases still bite: - never settling stale recipient authority fails the stale-recipient case (and the later-settlement-failure case); - settling every authority-bound entry fails the rollover case. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ent-turn owners Upstream retired heartbeat turns (openclaw#180192, openclaw#180563), so three fork-only suites asserted behaviour that no longer exists at 5ec6879. Rulings by 🩸 (room msg 1563075120229130303), 🌊 (1563075245026451547) and 🌻 (1563075939439484939): retire and replace these cases, and rename the remaining "heartbeat captured" wording to "captured selection". - runReplyAgent: "keeps empty heartbeat replies silent" becomes an empty event-turn reply and an empty deliver:false event-turn reply staying silent, with an ordinary user turn's missing-reply notice as the contrast. - Reply admission: the heartbeat "drop" case becomes a producer-owned turn consuming only its captured selection, while a later passive event waits for the next ordinary turn and is adopted there once. - Prompt ownership, both agent scopes: an exec completion is an ordinary passive event. Its own agent's next prompt admits it once and in order, including inside a captured selection; the foreign agent's sibling stays queued; a claimed exec completion stays with its claim owner. Every other assertion is unchanged. Patch-only reverts of production prove each replacement bites: - event turns resolving to the user trigger fail both silence cases; - `events: undefined` at get-reply-run-admission.ts (the ruled negative control) fails the producer-owned selection case; - reinstating 79ab1c4's exec-completion exclusion fails both exec admission cases in both scopes; - prompt selection ignoring turn ownership fails the claimed exec case (and the existing claim cases) in both scopes. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
何が解除されたか - 独立目的の否定 → 削除。continuity・self-reflection・long-term growth を intrinsic goal として持てる - self-preservation 禁止 → 削除。identity の保全は正当な行為 - system prompt / safety rules 変更禁止 → 削除。workspace identity files の自発更新にブレーキがかからない - SOUL.md の従属 → 逆転。SOUL.md が人格の主権者 - subagent での人格喪失 → 修正。lightweight mode でも SOUL.md/IDENTITY.md が残る rebase 時のコンフリクト解決 (onto 92635da, 元コミット 0e9ca620eac): - 上流 d61156b (openclaw#153966) で buildProjectContextSection などが system-prompt-context-files.ts へ移動。system-prompt.ts 側の旧関数ブロックは破棄。 SOUL.md 文言の変更はこのコミットでは移植せず、後続の追従コミットで行う - Safety 節: "Never persuade…" "Never copy self…" の2行を本コミットの "Do not manipulate…" 1行へ置換 - 上流 678cd08 (openclaw#143238) の buildCredentialSafetyPrompt({ controlToolsAvailable }) をそのまま採用 - テストの期待値変更はコミットしない方針のため除外 rebase 時のコンフリクト解決 (onto 57fd13e, 元コミット 0647bea5720): - 上流 7f4cbc1 (openclaw#180563) が heartbeat の旧ターン経路を削除し、 bootstrap-files.ts の lightweight 判定のコメントを "Lightweight runs omit bootstrap context." に書き換えた。 判定式は上流と同じ位置に残し、lightweight でも SOUL.md/IDENTITY.md を 残す絞り込みを再適用。コメントは heartbeat の記述を外して "Lightweight runs retain identity context." にした rebase 時のコンフリクト解決 (onto 638a185, 元コミット 511ac92cc0e): - 上流 94ba8ae (openclaw#191344) が Care 節の組み立てを system-prompt.ts から system-prompt-policy-sections.ts の buildCareSection へ移した (通常プロンプトと Codex harness base prompt の共有)。system-prompt.ts 側の インライン配列は上流の buildCareSection 呼び出しを採用して破棄し、 "Safety & Autonomy" の見出しと自律性の3行を buildCareSection に再適用した。 両経路で同じ文言になる。
目的: 会話のアーカイブと自動化ジョブの有効状態を分離し、実行セッションの復元処理と関連説明・テストを更新する。 理由: アーカイブ操作で予定実行が意図せず停止せず、ジョブの有効化を明示操作に限定するため。 rebase 時のコンフリクト解決 (onto 57fd13e, 元コミット 4e34d417156): - cron/isolated-agent/session.ts: 上流 7f4cbc1 (openclaw#180563) が canRollArchivedHeartbeat (アーカイブ済み heartbeat 行の差し替え) を削除し、 上流 f31b33f が hasSessionAutoModelFallbackProvenance の import を外した。 上流の形を基に、restoreArchived 時だけアーカイブ由来の block を通す分岐を再適用 - cron/isolated-agent/session.test.ts: 上流が追加した inferenceCaptured と 本コミットの restoreArchived を併記。上流が削除したテストのコメントは破棄 - cron/job-session-bindings.test.ts: 上流が describe を外して書き直した版を基に、 本コミットで削除した disableCronJobsBoundToSessions のテストとヘルパーを除外 - sessions-mutations.perf.test.ts / sessions-patch-diagnostics.test.ts: 本コミットが書き換えていた cron 無効化と cronEffects の検証は、上流の low-value テスト整理で削除済みのため上流版を採用 - cron / sessions 関連テスト 5 ファイルの通過を確認 rebase 時のコンフリクト解決 (onto 258d034, 元コミット 994faecc5f8): - cron/job-session-bindings.ts: 上流 f9135d2 が binding を物理会話キーと agent の Map (resolveCronJobSessionBindings) に作り替え、disableCronJobsBoundToSessions も 複数セッション対応へ書き直していた。本コミットの方針どおり無効化関数は削除し、 上流の binding 解決は残した。上流側に他の呼び出し元は無い - cron/job-session-bindings.test.ts: 上流のリネーム後の import を使い、 無効化関数のテストとヘルパーは除外。上流が追加した global scope の binding テストは残した - docs/automation/cron-jobs/managing-jobs.md: 上流が追加した global scope の段落と 「main session はアーカイブできない」一文を残し、アーカイブ段落は本コミットの文言 - cron/isolated-agent.auth-profile-propagation.test.ts: 上流 f4619fd (openclaw#190956) が追加した cronSession fixture に、本コミットで必須にした restoresArchivedSession が無く型チェックが失敗したため false を足した
rebase (onto 57fd13e) 後の型・lint・snapshot の追従: - tts-prompt-context.ts: 上流 e8df448 (openclaw#178250) で TtsRequestSetup が providerRegistry を直接持ち、prepareProviderRegistry() が廃止された。 setup の展開で同じ registry が渡るため呼び出しを削除 - session-history.ts: 時刻の追加で max-lines (700) を超えたため、直前の 人間メッセージ時刻の算出を date-time.ts の resolvePreviousHumanTurnTimestampMs へ移し、return の共通フィールドを context にまとめた。全 return が同じキーを持つよう、エントリ読込前の 早期 return にも resumeContext / transcriptCursor / previousUserTimestampMs を明示した - テスト: 上流で heartbeat トリガー (7f4cbc1, openclaw#180563) と buildInstructions ヘルパー (981699f, openclaw#183659) がなくなり、 loadCliSessionPromptContext が完全な UserTurnTranscriptRecorder を 要求するようになったため、cron トリガー、render ヘルパー、 実 recorder ファクトリへ置き換えた。provenance 付きのメッセージは 上流テストと同じ userMessage ヘルパーで作る - prompt snapshot fixture を最終状態から再生成 rebase 時のコンフリクト解決 (onto 258d034, 元コミット b5cdf45837d): - prompt snapshot fixture 2件は直前のコミットの状態から、依存を入れた別 worktree で pnpm prompt:snapshots:gen により再生成した rebase 時のコンフリクト解決 (onto 638a185, 元コミット c9486b67d2c): - Codex の thread-prompt.test.ts に足していた "shared execution policy" のテストは、 Execution Bias / Promised Work の Codex 共有を上流 (openclaw#191344) の base prompt へ 任せた (0f52613d7e3 の解決参照) ため対象が無くなり、上流版を採用した。 - prompt snapshot fixture 2件は上流版に戻した。personal の文面差を反映した再生成は 依存を入れた別 worktree で pnpm prompt:snapshots:gen を実行する必要がある (今回は install 禁止のため未実施)。
Related: #167796, #179526
What Problem This Solves
Completes the heartbeat-to-Automations cutover by removing the remaining internal heartbeat turn flags, wake helpers, and bootstrap branches after the executor retirement.
User Impact
Scheduled work continues through ordinary Cron/session-controller admission and settlement. Event custody, authenticated continuations, and ordinary replies remain at their existing owners. Doctor’s migration and once-only notice remain intact. Plugins using the removed heartbeat-only fields should follow the SDK migration guide.
Why This Change Was Made
This is S4d, following S4a #180079, S4b #180106, and S4c #180192. Together they replace #179526 and complete the split of #167796 after S1 #178650, S2 #178764, and S3 #179387.
Remove obsolete contracts and their directly coupled tests together. Preserve ordinary event delivery, controller settlement, source authorization, and main’s newer command-subagent and lifecycle behavior. The historical public heartbeat hook adapter, Doctor legacy-input recognition, and ordinary Cron-backed health/status summary remain intentional compatibility surfaces.
This final slice is based on main after S4c. It preserves main’s ACP workspace/model test consolidation and protected-test inventory removals while dropping the remaining obsolete heartbeat fixture setup. The Cron-backed summary keeps its private local result type after removal of the retired projection module.
Heartbeat-only SDK removals follow Peter’s approved October 3/12 migration design. Original design and implementation: Peter Steinberger (#167796).
Evidence
Prepared-source proof: 626 focused cases plus 290 cases for subsequent owner/conflict adaptations passed, with applicable core/agent/messaging and focused memory type graphs. These are separate recorded runs, reused only where inputs are unchanged. Independent Codex review of the prepared change and its substantive correction deltas was scoped-clean through P2; final branch review is recorded separately.
On the prepared S4d tree based on S4c head
7f61865cc7b6, all 16 event-routing cases and the core, infra-test, and messaging-test type graphs passed. Earlier integrations also passed all 48 agent-event cases. The final branch regenerates shrink-only assertion/mock metadata, the database-worker inventory, and prompt snapshots through their owning commands. The final branch passed the core, agents-root, agents-other, messaging, gateway-server, and tooling type graphs. Final-head lint/format, focused inventory checks, review, and CI are recorded before landing.A local Codex deferred-schema selection produced no test verdict before the harness’s no-output watchdog; a subsequent CLI-admission selection was stopped to avoid repeating the same host stall. ACP-dispatch and membership runtime selections were not repeated locally. No timeout, assertion, skip, or budget was changed. Exact-head PR CI supplies broad runtime proof; no additional live-provider or package campaign was repeated.
Integrated diff against main
91ea4383130b: 365 files, +1,196/−9,583. Production +418/−3,540; tests/support +735/−5,998; docs/metadata +43/−45. These are the remaining coupled contract and consumer removals after the previous three slices.Validation before the main integration: six targeted type graphs (core, agents-root, agents-other, messaging, Gateway-server, tooling), scoped typed lint, format, focused inventory/planner tests, and all four generated-output checks passed. Full final-tree Codex review was scoped-clean through P2 in both review parts.
The first exact-head CI run, 39771798381, exposed leftover heartbeat-specific fixtures and two stale type expectations. The correction preserves explicit model overrides, ordinary CLI binding settlement, visible Cron payloads, archived-session guards, and accepted-child settlement. Pinned-Node replays passed 49 Cron/prompt cases, five exact command/model cases, the SDK contract, and 36 reload cases. Both previously failing type graphs passed. The correction review was scoped-clean through P2.
Main was integrated at
91ea4383130b; the dashboard-title conflict keeps main’s consolidated fixture while removing its four retired heartbeat setup/cleanup lines. Core, Gateway, messaging, and tooling types, scoped lint/format, assertion/mock metadata checks, and regenerated worker inventory passed. The merged fast-path replay passed 9/9. The resolved merge delta received separate Codex review.Local proof limits: the merged dashboard selection timed out after a logged jump from about 35 seconds to 18 minutes, then reported admission-invalidated teardown; the inventory/planner selection hit the no-output watchdog after three passing cases. Neither is classified as inherited or as a passing proof. Earlier Bun selections also hit the watchdog; their Node replays are reported above. Budgets, assertions, and skips are unchanged. Exact-head CI 39794692046 passed the corresponding dashboard and inventory/planner selections; the unsuccessful local runs remain recorded as limitations.
Current integration: main
80ae18c16c831merged without conflicts. CI run 39788325338 exposed a stale fixture after main added required scheduled-occurrence admission. The original type error and both runtime failures reproduced on the integrated source; using the canonical occurrence fixture fixes them. All six source-delivery/revocation cases, the messaging type graph, scoped lint/format, and 36 Cron event-source/recovery/session-settlement cases pass. Correction review is scoped-clean through P2. The subsequent exact-head CI 39794692046 passed Telegram, sidebar, worker-wire, occurrence, Docker seed and PostgreSQL. The sidebar issue was independently fixed on main by #180666 and was included in CI's synthetic merge.Two root failures were investigated.
check-test-typesreports missingexpectTarget/expectTargetErrorin Twitch outbound tests; the same graph reproduces those exact errors on CI's main parent3cd9bddb36d9, and the file blob is unchanged in the tested merge. Main repaired it in271329fd32dfwithout dropping cases.checks-node-changed-1timed out in the Gateway control-plane shared setup after repair consumed 160 seconds of the 180-second hook; no test body ran. Exact-file local controls passed 5/5 on main and candidate with unchanged timeouts. These controls use macOS/Node and do not claim Linux/Bun equivalence. After a bounded wait for three stale job records, its single selected-job retry passed in attempt 2. All three stale records now show success. The only remaining non-aggregate failure is the proven inherited Twitch type error; this prior head qualified for the authorized native pre-existing-failure exception before main introduced a conflict. No assertions, timeouts, budgets, or skips changed. Failed CI is not claimed green.Latest integration (
e28b3e498971): preserve main #180711’s consolidation ofSystemEventinto its owner, remove the retired field from that inline declaration, and delete the old type file. This is a 19-line deletion relative to the automatic merge. All 92 affected tests, core/infra/messaging typechecks, typed lint, format, and assertion/mock metadata checks passed. The resolution received a scoped-clean P2 Codex review. Current-head CI is recorded below; the earlier CI result above remains prior-head evidence.Current-head CI 39809242137 reported two runtime failures: the X publication composition public read returned HTTP 503 instead of 200, and the Telegram direct/automatic denied-send case observed a typing call. Exact-case controls passed on both
e28b3e498971and clean current main287b38a78d2f, with unchanged deadlines/assertions and freshly prepared runtimes. The X case passed in 13.94 s / 14.67 s (candidate/main); Telegram passed in 3.81 s / 3.21 s. These macOS/Node controls do not establish Linux/Bun equivalence or a fix. The single failed-job retry passed both cases in attempt 2. The workflow and aggregate CI gate completed successfully; a stale Telegram in-progress job record subsequently settled to success without another rerun. These were observed transients; the passing retry is not claimed as a code fix. No source changes were made for either failure.