Skip to content

fix(heartbeat): avoid claiming excluded outcomes were recorded - #125207

Merged
steipete merged 3 commits into
mainfrom
steipete/fix-heartbeat-outcome-persistence
Aug 17, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/fix-heartbeat-outcome-persistence

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where heartbeat responses told the model status: recorded even when the outcome was intentionally excluded from the SQLite handoff. Live QA observed this for quiet no_change heartbeats and visible needs_attention notifications, leaving the model-facing result inconsistent with heartbeat_outcomes.

Why This Change Was Made

The SQLite store remains scoped to meaningful silent work (progress, done, blocked, or silent needs_attention) that the next user turn needs as hidden context. no_change remains an operator heartbeat event, while notify=true remains owned by visible delivery. The tool now reports status: accepted, which accurately describes the only fact known at tool-call time before post-turn persistence or delivery.

This is AI-assisted. The implementation and storage/read lifecycle were reviewed against both OpenClaw runtimes and the Codex tool-output transport.

User Impact

Models no longer receive a false persistence claim after quiet no-change checks or urgent visible notifications. Existing heartbeat delivery and next-turn silent-result handoff behavior are unchanged.

Evidence

  • Pre-fix: node scripts/run-vitest.mjs src/agents/tools/heartbeat-response-tool.test.ts failed both new regressions because the quiet and urgent cases returned recorded instead of accepted.
  • Focused: node scripts/run-vitest.mjs src/agents/tools/heartbeat-response-tool.test.ts src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.subscribeembeddedagentsession.test.ts src/agents/embedded-agent-subscribe.block-reply-rejections.test.ts extensions/codex/src/app-server/dynamic-tools.test.ts src/infra/heartbeat-outcome-store.test.ts src/infra/heartbeat-runner.tool-response.test.ts — 263 passed across four shards.
  • Changed gate: node scripts/check-changed.mjs — passed core/extension typecheck, lint, architecture, SQLite, and guard lanes.
  • Prompt contract: pnpm prompt:snapshots:check and node scripts/run-vitest.mjs test/scripts/prompt-snapshots.test.ts — current; 13 passed.
  • Source-blind behavior probe: quiet no_change and urgent needs_attention both returned status: accepted with outcome, notify, and notification text preserved.
  • Direct Codex contract inspection at openai/codex@9ded177ce7c1c0bd2047f902936c177612ab3434: JsonToolOutput::to_response_item sends the JSON value as model-facing text, while FunctionCallOutputPayload serializes that body directly on the function/custom-tool output wire contract and keeps success metadata internal.
  • Autoreview: clean; no accepted/actionable findings.
  • Production LOC: +9/-9 (net 0). Tests/generated proof: +24/-18 (net +6).

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 17, 2026 10:16
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: codex size: XS maintainer Maintainer-authored PR labels Aug 17, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 6:53 AM ET / 10:53 UTC.

ClawSweeper review

What this changes

The PR replaces heartbeat tool claims that an outcome was recorded with an accepted-for-post-turn-handling contract, including the tool catalog, tests, and Codex prompt snapshots.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer handling: the branch addresses the prior catalog wording finding and the OpenClaw lifecycle fix is coherent, but the required direct Codex source check cannot be completed because the sibling checkout is absent in this read-only environment.

Priority: P2
Reviewed head: 4c8213819f63bcf798c8e064d5f669ef9e950d50

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and consistent with the owning lifecycle, with direct Codex source verification remaining a maintainer review gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR includes focused after-change behavior evidence, so the external-contributor proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR includes focused after-change behavior evidence, so the external-contributor proof gate does not apply.
Evidence reviewed 8 items Current-main mismatch: Current main emits status: recorded in both internal details and model-visible JSON, although the subsequent lifecycle has not run yet.
Persistence owner excludes the reported cases: The SQLite owner returns without writing when notify is true or the outcome is no_change; the runner invokes it only after classifying an acknowledgement.
Branch preserves the owner boundary: The branch changes the emitted status to accepted but leaves normalized response fields unchanged; the runner and Codex bridge consume those normalized fields rather than this status.
Findings None None.
Security None None.

How this fits together

A heartbeat agent submits an outcome and optional notification through a one-shot tool. The runner later chooses visible delivery or persistence of eligible silent outcomes, while the Codex bridge returns the tool’s text to the model.

flowchart LR
A[Heartbeat agent] --> B[Heartbeat response tool]
B --> C[Runtime tool result]
C --> D[Heartbeat runner]
D --> E[SQLite silent handoff]
D --> F[Visible notification]
Loading

Before merge

  • Resolve merge risk (P1) - The model-facing Codex transport assertion remains unverified by this reviewer because the repository-required sibling Codex source checkout is unavailable; do not treat this review as sufficient transport-contract proof.
  • Complete next step (P2) - A maintainer must complete the required direct Codex transport-contract check; no narrow repair is identified.
Agent review details

Security

None.

PR surface

Source 0, Tests +6. Total +6 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 2 9 9 0
Tests 6 24 18 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 33 27 +6

Review metrics

Metric Value Why it matters
Production versus test LOC production net 0; tests and snapshots net +6 The patch updates an existing model-facing contract without expanding the runtime control flow.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/agents/tools/heartbeat-response-tool.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the model-facing transport (recommended)
    Inspect the exact pinned Codex source before merge to confirm that the changed heartbeat result text reaches the model while internal persistence and delivery remain unchanged.

Technical review

Best possible solution:

Merge only after a reviewer directly checks the pinned Codex tool-output source and confirms that the changed JSON text is the model-visible value; retain the accepted-versus-persisted lifecycle split.

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

Yes. Current main returns recorded before the later SQLite owner excludes no_change and visible notifications, making the contradiction directly source-reproducible.

Is this the best way to solve the issue?

Yes for the OpenClaw lifecycle: the tool can only accept a response, while the runner owns later delivery and persistence. The dependent Codex transport contract still needs the required direct source inspection.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against bb95d106d813.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR includes focused after-change behavior evidence, so the external-contributor proof gate does not apply.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This corrects a misleading heartbeat result with limited blast radius.
  • merge-risk: 🚨 compatibility: The PR changes model-facing tool status text and the tool catalog description used by existing runtime clients.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR includes focused after-change behavior evidence, so the external-contributor proof gate does not apply.

Evidence

What I checked:

Likely related people:

  • steipete: Commit 8f145789… introduced the current heartbeat response tool, and current-main blame assigns its relevant result construction to that commit. (role: introduced the current heartbeat-response implementation and recent area contributor; confidence: high; commits: 8f145789b586; files: src/agents/tools/heartbeat-response-tool.ts, src/infra/heartbeat-outcome-store.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Verify the pinned Codex tool-output contract from the required sibling source checkout before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-17T10:22:39.602Z sha 1a959f0 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T10:32:31.993Z sha cf4072b :: found issues before merge. :: [P2] Align the client tool catalog with the accepted-outcome contract

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 17, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper rank-up moves are complete on 4c8213819f63bcf798c8e064d5f669ef9e950d50:

  • The static client catalog now says “Accept heartbeat outcomes for post-turn handling” (src/agents/tool-catalog.ts:347).
  • I directly inspected the pinned sibling Codex source at openai/codex@9ded177ce7c1c0bd2047f902936c177612ab3434. JsonToolOutput::to_response_item sends the JSON value as the model-facing function/custom-tool output text. FunctionCallOutputPayload serializes that body directly on the wire while keeping success internal.

Exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/32021792565

@steipete
steipete merged commit 6d04fe5 into main Aug 17, 2026
223 of 224 checks passed
@steipete
steipete deleted the steipete/fix-heartbeat-outcome-persistence branch August 17, 2026 10:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
…law#125207)

* fix(heartbeat): report accepted outcomes honestly

* test(heartbeat): refresh response tool snapshots

* fix(heartbeat): align tool catalog wording
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant