Spot the bug in the agent-use boundary

from Agent use boundaries
Node 24 intermediate 6 min 3 issues to find

Find why this generated boundary admits work that should stop or require review.

JavaScript
function mayUseAgent(task) {
  let score = 0;
  if (task.hasTests) score += 2;
  if (task.intentSettled) score += 2;
  if (task.sensitive) score -= 1;
  if (task.irreversible) score -= 1;

  if (task.estimatedCost < 10 || task.maxSteps) {
    return score >= 2;
  }
  return task.approved;
}
Open in playground
Report an error