Skip to content

gut: fix heartbeat and cron agent resolution (#1579)#2284

Merged
alexey-pelykh merged 1 commit intomainfrom
gut/fix-heartbeat-cron-agent-resolution
Apr 11, 2026
Merged

gut: fix heartbeat and cron agent resolution (#1579)#2284
alexey-pelykh merged 1 commit intomainfrom
gut/fix-heartbeat-cron-agent-resolution

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

  • Heartbeat: Rewrite isHeartbeatEnabledForAgent() so agents.defaults.heartbeat applies to ALL configured agents as baseline, with per-agent overrides. No agents → skip heartbeat entirely. Removes the binary either/or logic from hasExplicitHeartbeatAgents.
  • Cron resolveCronAgent: Throw on unknown agentId instead of silently falling back to default agent (catches typos like agentId: "helpr").
  • Cron assertMainSessionAgentId: Validate against sole agent (resolveSoleAgentId) instead of deprecated resolveDefaultAgentId.
  • Session reaper: Use explicit agent from each job, not default fallback.
  • Isolated agent run.ts: Three-level cascade uses resolveSoleAgentId instead of resolveDefaultAgentId.

Closes #1579

Test plan

  • isHeartbeatEnabledForAgent tests rewritten — defaults.heartbeat enables all agents, per-agent override, no-agents returns false, unknown agent returns false
  • resolveHeartbeatAgents returns all agents with heartbeat enabled (not just explicit ones)
  • assertMainSessionAgentId tests updated for sole-agent validation (rejects non-sole, rejects when no sole agent, allows sole agent)
  • Session reaper test passes with explicit agent from jobs
  • All 427 heartbeat+cron tests pass
  • Type-check clean (tsgo --noEmit)
  • Lint clean (oxlint --type-aware)
  • Format clean (oxfmt --check)

🤖 Generated with Claude Code

Heartbeat:
- Rewrite isHeartbeatEnabledForAgent — agents.defaults.heartbeat now
  applies to ALL configured agents as baseline, not just the default
- Per-agent heartbeat config overrides defaults for that agent
- No agents configured → skip heartbeat entirely
- Remove hasExplicitHeartbeatAgents binary either/or logic

Cron:
- resolveCronAgent throws on unknown agentId instead of silently
  falling back to the default agent (catches typos like "helpr")
- assertMainSessionAgentId validates against sole agent (via
  resolveSoleAgentId) instead of the deprecated resolveDefaultAgentId
- Session reaper uses explicit agent from each job, falling back to
  sole/default agent only when no job-specific paths are collected
- Isolated agent run.ts cascade uses resolveSoleAgentId instead of
  resolveDefaultAgentId

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh enabled auto-merge (squash) April 11, 2026 10:01
@alexey-pelykh alexey-pelykh merged commit a4ef6be into main Apr 11, 2026
10 checks passed
@alexey-pelykh alexey-pelykh deleted the gut/fix-heartbeat-cron-agent-resolution branch April 11, 2026 10:07
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.

gut: fix heartbeat and cron agent resolution

1 participant