Skip to content

clampTimeout

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/libs/agent-core/src/benchmark/agent-hardening.ts

Agent Hardening — Defensive Patterns for Benchmark Execution

Utilities adopted from SWE-agent and Claude Code:

  • Bash timeout clamping utility (prevents single commands from hogging budget)
  • Pager-disabling environment (PAGER=cat, etc.)
  • Cost limit per task ($3-5 budget)
  • Autosubmission on error (partial patch > no patch)
  • Zero-progress detection (3 consecutive zero-token turns)

Note: Task-level timeout is 1800s (30 min, matching SWE-agent). Setup time is excluded — timer starts AFTER setupTask() completes. Per-command bash timeout is 120s (benchmark) / 60s (interactive).

These are pure utility functions — no side effects, easy to test.

Signature

ts
function clampTimeout(requested: number | undefined, ceiling: number, defaultMs: number): number

Parameters

NameType
requested`number
ceilingnumber
defaultMsnumber

Returns: number

Was this page helpful?

Download as PDF