Skip to content

feat(heartbeat): re-apply heartbeat protocol improvements from v2026.3.1#2257

Merged
alexey-pelykh merged 1 commit intomainfrom
feat/heartbeat-protocol-improvements-2206
Apr 10, 2026
Merged

feat(heartbeat): re-apply heartbeat protocol improvements from v2026.3.1#2257
alexey-pelykh merged 1 commit intomainfrom
feat/heartbeat-protocol-improvements-2206

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Re-applies upstream heartbeat protocol improvements from v2026.3.1 that were lost during PR #2191 wholesale restoration of heartbeat-runner.ts. Closes #2206.

Changes re-applied:

  • ackMaxChars configuration — configurable max chars for heartbeat ack responses, preventing verbose acks from flooding channels
  • HEARTBEAT.md file gating — skip heartbeat when file is effectively empty, with bypass for exec/cron/wake events and ENOENT handling
  • HEARTBEAT_TOKEN structured protocol — heartbeat OK uses structured token (HEARTBEAT_OK) instead of raw text, paired with stripHeartbeatToken extraction
  • buildOutboundSessionContext — session-aware outbound delivery for heartbeat-originated messages
  • Exec fallback text — better exec-completion handling when token stripping empties the response
  • HeartbeatSkipReason type — typed skip reasons for more specific heartbeat skip reporting
  • stripLeadingHeartbeatResponsePrefix — regex boundary fix preventing short prefixes like "Hi" from stripping words like "History"

Intentionally NOT re-applied (gutted subsystem code):

All dependency modules verified to exist before importing.

Test plan

  • All 86 heartbeat tests pass (12 test files)
  • Auto-reply heartbeat tests pass (9 tests)
  • Type-check passes (no errors in heartbeat-runner.ts)
  • Lint passes (0 warnings, 0 errors)
  • Format check passes
  • CI build + test jobs pass

🤖 Generated with Claude Code

…3.1 (#2206)

Re-apply upstream heartbeat protocol improvements that were lost during
PR #2191 wholesale restoration of heartbeat-runner.ts.

Changes re-applied:
- ackMaxChars configuration — configurable max chars for heartbeat ack
  responses, preventing verbose acks from flooding channels
- HEARTBEAT.md file gating — skip heartbeat when file is effectively
  empty, with bypass for exec/cron/wake events and ENOENT handling
- HEARTBEAT_TOKEN structured protocol — heartbeat OK uses structured
  token instead of raw text, paired with stripHeartbeatToken extraction
- buildOutboundSessionContext — session-aware outbound delivery for
  heartbeat-originated messages
- Exec fallback text — better exec-completion handling when token
  stripping empties the response
- HeartbeatSkipReason type — typed skip reasons for heartbeat skip
  reporting
- stripLeadingHeartbeatResponsePrefix — regex boundary fix preventing
  short prefixes like "Hi" from stripping words like "History"

Intentionally NOT re-applied (gutted subsystem code):
- bootstrapContextMode / lightContext (Pi bootstrap)
- includeReasoning / resolveHeartbeatReasoningPayloads (Pi reasoning)
- resolveHeartbeatPrompt signature change (deferred to #2194)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh enabled auto-merge (squash) April 10, 2026 23:08
@alexey-pelykh alexey-pelykh merged commit ac9587e into main Apr 10, 2026
10 checks passed
@alexey-pelykh alexey-pelykh deleted the feat/heartbeat-protocol-improvements-2206 branch April 10, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-apply heartbeat protocol improvements from v2026.3.1

1 participant