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)) {
|
if (getRunEligibilityFailure(agent, connector, null)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Extended heartbeat policy checks (Paperclip parity)
|
// Extended heartbeat policy checks (Paperclip parity).
|
||||||
let heartbeatPolicy = { cooldownSec: 10, maxConcurrentRuns: 1, wakeOnDemand: true };
|
// Let getHeartbeatPolicy throw — a missing row signals data corruption
|
||||||
try {
|
// and silently falling back hides the gate that decides whether the
|
||||||
heartbeatPolicy = db.getHeartbeatPolicy(agent.id);
|
// agent runs at all.
|
||||||
} catch {
|
const heartbeatPolicy = db.getHeartbeatPolicy(agent.id);
|
||||||
// Non-fatal: use defaults
|
|
||||||
}
|
|
||||||
|
|
||||||
// maxConcurrentRuns check: count active runs for this agent
|
// maxConcurrentRuns check: count active runs for this agent
|
||||||
const activeRunCount = db.countActiveRunsForAgent(agent.id, companyId);
|
const activeRunCount = db.countActiveRunsForAgent(agent.id, companyId);
|
||||||
|
|||||||
Reference in new issue
Block a user