Skip to content

fix: regression where commitment safety handling can disable tools for unrelated due heartbea... - #75344

Merged
vincentkoc merged 1 commit into
mainfrom
clawsweeper/clawsweeper-commit-openclaw-openclaw-b277ae3f4c40
May 1, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
clawsweeper/clawsweeper-commit-openclaw-openclaw-b277ae3f4c40

Conversation

@clawsweeper

@clawsweeper clawsweeper Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Found one regression where commitment safety handling can disable tools for unrelated due heartbeat tasks in the same heartbeat turn.

What ClawSweeper Is Fixing

  • Medium: Due commitments disable tools for due HEARTBEAT.md tasks (regression)
    • File: src/infra/heartbeat-runner.ts:1324
    • Evidence: resolveHeartbeatRunPrompt appends the commitment prompt to a due periodic-task prompt when preflight.tasks has due tasks (src/infra/heartbeat-runner.ts:856 and src/infra/heartbeat-runner.ts:870). Later, any prompt with due commitments sets { disableTools: true, skillFilter: [] } for the whole run (src/infra/heartbeat-runner.ts:1324). That means the model receives “Run the following periodic tasks…” but the run is forced into no-tools mode.
    • Impact: A user with opt-in commitments and normal heartbeat tasks can have scheduled heartbeat work silently degraded whenever a commitment is due in the same session. Tasks that need tools, MCP, skills, or CLI-backed execution will not be able to run even though they are unrelated to the untrusted commitment metadata.
    • Suggested fix: Keep commitment turns no-tools, but do not merge them into the same prompt as due heartbeat tasks. Run due tasks first with their normal tool policy, then process commitments in a separate no-tools turn, or defer commitment delivery until no heartbeat tasks are due.
    • Confidence: high

Expected Repair Surface

  • src/infra/heartbeat-runner.ts

Source And Review Context

Expected validation

  • pnpm check:changed

ClawSweeper already ran:

  • pnpm docs:list
  • pnpm install
  • pnpm test src/infra/heartbeat-runner.commitments.test.ts src/commitments/store.test.ts src/commitments/commitments-full-chain.integration.test.ts src/agents/cli-runner/prepare.test.ts passed.
  • git diff --check a102f4dede6af52523473ac29575c7e442493d15..b277ae3f4c402596402cb8be5be4dca2106483f4 passed.

Known review limits:

  • I did not run the new Docker E2E lane or full changed gate; the focused tests passed and CI for the PR was green.

ClawSweeper Guardrails

  • Re-check the finding against latest main before changing code.
  • Keep the patch to the narrowest behavior change and matching regression coverage.
  • Do not merge automatically; this PR stays for maintainer review.

ClawSweeper 🐠 replacement reef notes:

  • Cluster: clawsweeper-commit-openclaw-openclaw-b277ae3f4c40
  • Source PRs: none
  • Credit: Detected by ClawSweeper commit review for b277ae3.; Original commit author: Vignesh.
  • Validation: pnpm check:changed

fish notes: model gpt-5.5, reasoning medium; reviewed against f85787a.

@clawsweeper clawsweeper Bot added clawsweeper Tracked by ClawSweeper automation clawsweeper:commit-finding PR created from a ClawSweeper commit finding labels May 1, 2026
@clawsweeper

clawsweeper Bot commented May 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex review: passed for ClawSweeper automerge.

What this changes:

The PR changes heartbeat preflight and prompt resolution so due HEARTBEAT.md tasks remain tool-capable when due commitments also exist, defers commitment delivery for that turn, and adds regression coverage.

Automerge follow-up:

No repair job is needed; this PR is already the narrow repair and has no actionable review findings. The ClawSweeper automerge lane can gate the exact head on checks and mergeability.

Security review:

Security review cleared: The diff only changes heartbeat runner routing logic and tests, adds no dependencies or execution surfaces, and preserves no-tools handling for commitment-only delivery turns.

Review details

Best possible solution:

Land this narrow PR through the existing ClawSweeper automerge path if the exact head remains green and mergeable, preserving no-tools commitment-only turns while keeping unrelated due heartbeat tasks tool-capable.

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

Yes. A high-confidence reproduction is a session with commitments enabled, heartbeat target set to last, one due commitment, and a due tasks block in HEARTBEAT.md; current main couples the commitment path to the heartbeat run, and the PR adds a focused test for that setup.

Is this the best way to solve the issue?

Yes. The PR is the narrowest maintainable fix for the regression because it separates due task prompts from untrusted commitment metadata and keeps the existing no-tools commitment safety rule intact; a second no-tools follow-up turn would be broader product policy work.

What I checked:

  • Current-main regression surface: Current main still lets due commitments bypass HEARTBEAT.md file gates and later applies disableTools/empty skillFilter whenever the resolved heartbeat prompt has due commitments, which can suppress unrelated heartbeat task tooling. (src/infra/heartbeat-runner.ts:720, bd20f8e07e92)
  • PR separates due tasks from commitment delivery: The PR head removes due commitments from the file-gate bypass, keeps empty HEARTBEAT.md from skipping due commitments, passes precomputed due tasks into prompt resolution, and returns hasDueCommitments false for due-task prompts so normal tools remain available. (src/infra/heartbeat-runner.ts:715, f85787a2c94d)
  • PR defers commitment routing while tasks are due: The PR only uses commitment delivery routing when commitment delivery is allowed and there are no due heartbeat tasks, matching the intended deferral policy for the mixed turn. (src/infra/heartbeat-runner.ts:1024, f85787a2c94d)
  • Regression coverage: The added test seeds a due HEARTBEAT.md task plus a due commitment, asserts the task prompt excludes the commitment prompt, leaves disableTools and skillFilter unset, sends normally, and leaves the commitment pending. (src/infra/heartbeat-runner.commitments.test.ts:156, f85787a2c94d)
  • Documented behavior boundary: The commitments docs say due commitment heartbeat turns run without OpenClaw tools, while heartbeat docs describe HEARTBEAT.md periodic turns as normal scheduled agent turns; the PR preserves that split rather than weakening the commitment safety boundary. Public docs: docs/concepts/commitments.md. (docs/concepts/commitments.md:65, bd20f8e07e92)
  • PR checks and state: Public PR metadata reports the PR open, non-draft, mergeable, and clean; the check-runs snapshot for f85787a shows 90 total checks with 74 success, 13 skipped, 1 neutral, and only two cancelled auto-response checks. (f85787a2c94d)

Likely related people:

  • vignesh07: Recent history shows vignesh07 added inferred commitments, simplified commitment config, and then added the commitment delivery/safety behavior that this PR adjusts. (role: introduced behavior and commitment feature owner; confidence: high; commits: 8e4035d09a88, aecde2b3ac8b, b277ae3f4c40; files: src/infra/heartbeat-runner.ts, src/infra/heartbeat-runner.commitments.test.ts, src/commitments/store.ts)
  • steipete: Recent path history includes multiple heartbeat-runner fixes and refactors by steipete around response prefixes, exec-event handling, cron/nested-lane deferral, and plugin config access. (role: recent adjacent heartbeat-runner maintainer; confidence: medium; commits: 2d1523e573a8, 65c9eddae87e, f5e7557c70c1; files: src/infra/heartbeat-runner.ts)

Remaining risk / open question:

  • The PR intentionally defers commitment delivery whenever heartbeat tasks are due; if maintainers want same-heartbeat commitment freshness for always-due task setups, that would be a follow-up policy change rather than a correctness blocker for this regression.

Codex review notes: model gpt-5.5, reasoning high; reviewed against bd20f8e07e92.

@vignesh07

Copy link
Copy Markdown
Member

@clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 1, 2026
@clawsweeper

clawsweeper Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

🦞🦞
ClawSweeper automerge is enabled for this PR.

I added clawsweeper:automerge and asked ClawSweeper to review this head. If ClawSweeper emits a repair marker or requests changes, I will repair/rebase the branch and ask for another review, up to the configured round limit.

Draft PRs stay fix-only until GitHub marks them ready for review. A maintainer can pause this with /clawsweeper stop.

@clawsweeper

clawsweeper Bot commented May 1, 2026 •

Copy link
Copy Markdown
Contributor Author

🦞🦞
Thanks, ClawSweeper. ClawSweeper saw the passing review, but did not merge yet.

Source: clawsweeper[bot]
Feedback: structured ClawSweeper verdict: pass (sha=f85787a2c94d5d907eba5e69166132e31bd7ac5b)
Merge status: CHANGELOG.md entry is required for user-facing ClawSweeper automerge changes

I left the PR open for the remaining gate instead of bypassing it.

@vignesh07

Copy link
Copy Markdown
Member

@clawsweeper automerge

@vincentkoc
vincentkoc merged commit 955a0e9 into main May 1, 2026
88 of 90 checks passed
@vincentkoc
vincentkoc deleted the clawsweeper/clawsweeper-commit-openclaw-openclaw-b277ae3f4c40 branch May 1, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge clawsweeper:commit-finding PR created from a ClawSweeper commit finding clawsweeper Tracked by ClawSweeper automation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants