fix(heartbeat): remove silent-default try/catch around getHeartbeatPolicy
P2-35: The policy row is the gate that decides whether the agent runs; pretending cooldown is 10s when the read fails hides data corruption. db.getHeartbeatPolicy already supplies field-level defaults from policy JSON — and the only reason to throw here is 'agent not found', which is already impossible because the caller just loaded db.getAgent.
This commit is contained in:
1 parent
fc47b60d1b
commit
4000854b69
1 file changed
+5
-7
@@ -46,13 +46,11 @@ export function createHeartbeat(
|
||||
if (getRunEligibilityFailure(agent, connector, null)) {
|
||||
return null;
|
||||
}
|
||||
// Extended heartbeat policy checks (Paperclip parity)
|
||||
let heartbeatPolicy = { cooldownSec: 10, maxConcurrentRuns: 1, wakeOnDemand: true };
|
||||
try {
|
||||
heartbeatPolicy = db.getHeartbeatPolicy(agent.id);
|
||||
} catch {
|
||||
// Non-fatal: use defaults
|
||||
}
|
||||
// Extended heartbeat policy checks (Paperclip parity).
|
||||
// Let getHeartbeatPolicy throw — a missing row signals data corruption
|
||||
// and silently falling back hides the gate that decides whether the
|
||||
// agent runs at all.
|
||||
const heartbeatPolicy = db.getHeartbeatPolicy(agent.id);
|
||||
|
||||
// maxConcurrentRuns check: count active runs for this agent
|
||||
const activeRunCount = db.countActiveRunsForAgent(agent.id, companyId);
|
||||
|
||||
Reference in new issue
Block a user