Skip to content

OpenAI: reduce repeated heartbeat alerts#65148

Merged
pashpashpash merged 1 commit into
mainfrom
codex/openai-heartbeat-repeat-alerts
Apr 12, 2026
Merged

OpenAI: reduce repeated heartbeat alerts#65148
pashpashpash merged 1 commit into
mainfrom
codex/openai-heartbeat-repeat-alerts

Conversation

@pashpashpash

Copy link
Copy Markdown
Contributor

Summary

  • Problem: the OpenAI heartbeat overlay strongly nudged GPT-5 toward repeated user-facing heartbeat notifications.
  • Why it matters: in practice that can turn unchanged heartbeat state into low-value repeated alerts instead of more tasteful proactive behavior.
  • What changed: softened the heartbeat overlay by removing the explicit notify/stay-quiet instructions and replacing them with a narrower anti-repeat warning.
  • What did NOT change (scope boundary): this does not change the core heartbeat contract, delivery routing, or dedupe logic outside the OpenAI overlay.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: the OpenAI overlay explicitly told heartbeat turns to be opinionated and notify when something seemed important, which could reinforce repeated unchanged alerts.
  • Missing detection / guardrail: the overlay did not discourage duplicate unchanged notifications.
  • Contributing context (if known): heartbeats already have a separate core reply contract, so the overlay-level notify bias was stronger than necessary.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/openai/index.test.ts
  • Scenario the test should lock in: the friendly OpenAI overlay includes the revised heartbeat guidance and no longer asserts the old explicit notify/stay-quiet wording.
  • Why this is the smallest reliable guardrail: the change is pure prompt text in the OpenAI overlay.
  • Existing test that already covers this (if any): extensions/openai/index.test.ts
  • If no new test is added, why not: existing focused coverage was updated.

User-visible / Behavior Changes

  • GPT-5/OpenAI heartbeat guidance is less likely to encourage repeated unchanged alerts.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local repo checkout
  • Model/provider: openai-codex/gpt-5.4
  • Integration/channel (if any): N/A
  • Relevant config (redacted): N/A

Steps

  1. Inspect the OpenAI heartbeat overlay text.
  2. Update the heartbeat wording to reduce explicit alert bias and add anti-repeat guidance.
  3. Run the focused overlay test.

Expected

  • The overlay reflects the new heartbeat wording.
  • The focused OpenAI overlay test passes.

Actual

  • Matches expected.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: inspected the final overlay text and ran pnpm test extensions/openai/index.test.ts after rebasing onto latest origin/main.
  • Edge cases checked: verified the focused test assertion matches the revised heartbeat copy.
  • What you did not verify: end-to-end heartbeat behavior in a live session.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: prompt-only changes can shift behavior in ways the focused test cannot fully capture.
    • Mitigation: scope is limited to the OpenAI overlay heartbeat block, and the core heartbeat contract is unchanged.

@greptile-apps

greptile-apps Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR softens the heartbeat guidance in the OPENAI_FRIENDLY_PROMPT_OVERLAY constant by removing explicit notify/stay-quiet instructions and adding a concise anti-repeat warning ("Avoid spamming the user with the same notification over and over again."). The corresponding test in extensions/openai/index.test.ts is updated to assert the revised wording. No logic, routing, or dedupe changes are involved — this is a pure prompt-text edit scoped entirely to the OpenAI extension overlay.

Confidence Score: 5/5

Safe to merge — minimal, well-scoped prompt-text change with matching test coverage.

The change is entirely contained to the heartbeat section of the OpenAI overlay constant and its test; no logic, routing, or contract surfaces are touched. All test assertions in both the updated and pre-existing test cases align with the current overlay text, and no P0/P1 issues were found.

No files require special attention.

Reviews (1): Last reviewed commit: "OpenAI: reduce repeated heartbeat alerts" | Re-trigger Greptile

@pashpashpash
pashpashpash force-pushed the codex/openai-heartbeat-repeat-alerts branch from 96884e3 to 4b3b3fd Compare April 12, 2026 06:02
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: S and removed size: XS labels Apr 12, 2026
@blacksmith-sh

This comment has been minimized.

@openclaw-barnacle openclaw-barnacle Bot added channel: msteams Channel integration: msteams gateway Gateway runtime scripts Repository scripts labels Apr 12, 2026
@aisle-research-bot

aisle-research-bot Bot commented Apr 12, 2026

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 1 potential security issue(s) in this PR:

# Severity Title
1 🟠 High Symlink-based file disclosure via unguarded HEARTBEAT.md read in heartbeat runner
1. 🟠 Symlink-based file disclosure via unguarded HEARTBEAT.md read in heartbeat runner
Property Value
Severity High
CWE CWE-59
Location src/infra/heartbeat-runner.ts:560-566

Description

The heartbeat runner reads HEARTBEAT.md directly from the agent workspace using fs.readFile() without the boundary/symlink protections used elsewhere for workspace bootstrap files.

  • Input/control: An attacker (or untrusted integration) able to write to the workspace directory can replace HEARTBEAT.md with a symlink (or other link) to an arbitrary file on disk (e.g., /etc/passwd, SSH keys, cloud credentials).
  • Sink: heartbeat-runner.ts reads the file content and may embed parts of it into the LLM prompt (Additional context from HEARTBEAT.md), which can then be exfiltrated via model output or used to influence tool behavior.
  • Missing defense: Unlike loadWorkspaceBootstrapFiles() which uses openBoundaryFile()/openVerifiedFileSync() (rejects symlinks/hardlinks, enforces root boundary and size limits), the heartbeat preflight bypasses these guards.

Vulnerable code:

const heartbeatFilePath = path.join(workspaceDir, DEFAULT_HEARTBEAT_FILENAME);
heartbeatFileContent = await fs.readFile(heartbeatFilePath, "utf-8");

Recommendation

Use the existing boundary-safe file open/read helpers (the same pattern as loadWorkspaceBootstrapFiles()), which validate the path is within workspaceDir and reject symlinks/hardlinks.

For example:

import syncFs from "node:fs";
import { openBoundaryFile } from "../infra/boundary-file-read.js";

const opened = await openBoundaryFile({
  absolutePath: heartbeatFilePath,
  rootPath: workspaceDir,
  boundaryLabel: "workspace root",
  maxBytes: 2 * 1024 * 1024,
});
if (opened.ok) {
  try {
    heartbeatFileContent = syncFs.readFileSync(opened.fd, "utf-8");
  } finally {
    syncFs.closeSync(opened.fd);
  }
}

Alternatively, refactor to call loadWorkspaceBootstrapFiles(workspaceDir) (or a shared helper) so all workspace reads go through the same guardrails.


Analyzed PR: #65148 at commit 728ced8

Last updated on: 2026-04-12T21:21:37Z

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M and removed size: S labels Apr 12, 2026
@pashpashpash
pashpashpash force-pushed the codex/openai-heartbeat-repeat-alerts branch from a6d236b to fc1b56a Compare April 12, 2026 06:48
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed docs Improvements or additions to documentation channel: msteams Channel integration: msteams gateway Gateway runtime extensions: memory-core Extension: memory-core scripts Repository scripts size: M labels Apr 12, 2026
@pashpashpash
pashpashpash force-pushed the codex/openai-heartbeat-repeat-alerts branch from fc1b56a to 321176f Compare April 12, 2026 08:30
@pashpashpash
pashpashpash force-pushed the codex/openai-heartbeat-repeat-alerts branch from 321176f to 728ced8 Compare April 12, 2026 21:19
@pashpashpash
pashpashpash merged commit f5447aa into main Apr 12, 2026
42 checks passed
@pashpashpash
pashpashpash deleted the codex/openai-heartbeat-repeat-alerts branch April 12, 2026 21:47
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant