Skip to content

Commit 94b22e8

Browse files
Everyday defaults: guards on, no time limit in the console
The loop detector, the stop check (task mode) and the time budget are on in the built-in profiles, and Claude clears old tool results server-side. The snapshot stays a benchmark setting. The built-in config sets no time limit: the console runs without one, and -p, schedules and the SDKs fall back to 30 minutes. Docs explain the defaults and how the benchmark passes each task's time limit.
1 parent a03b977 commit 94b22e8

15 files changed

Lines changed: 102 additions & 47 deletions

File tree

‎BLUEPRINT.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ gitagent 3 is a single static Rust binary that runs **agents defined as git repo
4444
gitagent is measured on Terminal-Bench 2.1, and Terminal-Bench runs through **Harbor**, an open framework for running agents against containerised tasks. Harbor matters for four reasons.
4545

4646
1. **It is the same yardstick as the published results.** The leaderboards for Terminal-Bench 2.1 were produced with Harbor: the same task images, the same time limits, the same hidden tests, the same scoring. Running gitagent through it is what makes 93.03% comparable with the published 87.6% for Terminus 2 on the same model, rather than a number from a home-made runner.
47-
2. **Grading is independent of the agent.** Harbor starts each task's container, hands the agent the instruction and the time limit, and when the agent has finished it runs the task's hidden tests itself and records the reward. gitagent never sees, reads or writes the tests. The result is a pass or a fail decided outside the agent, which is the only kind worth publishing.
47+
2. **Grading is independent of the agent.** Harbor starts each task's container, hands the agent the instruction, stops it at the task's time limit, and when the agent has finished it runs the task's hidden tests itself and records the reward. gitagent never sees, reads or writes the tests. The result is a pass or a fail decided outside the agent, which is the only kind worth publishing.
4848
3. **It fits a static binary.** Harbor's "installed agent" model uploads the agent into the task container and runs it there. gitagent is one binary with no runtime, so installing it is a single file copy, and nothing in the container has to change. The shim that does this, `gitagent_harbor/agent.py`, is about two hundred lines.
4949
4. **It produces evidence others can check.** Harbor runs many trials in parallel, resumes trials that failed for reasons outside the agent (a revoked key, a full Docker network), keeps every trajectory and verifier log, and uploads a job publicly. The headline run's nine jobs, one per time limit, are public, so anyone can read every trial behind the number.
5050

5151
Harbor also hosts other benchmarks with the same task shape, SWE-bench Verified and SWE-bench Pro among them, so the same shim can be pointed at them without changes to the agent.
5252

53-
**How gitagent runs under Harbor.** The shim uploads the binary for the container's CPU to `/opt/gitagent/`, then runs `gitagent --bench --instruction-file … --model … --profile … --linger`. `--bench` makes the run depend only on files committed in the repository: no project or home configuration, no memory, no learning, no telemetry, repo mode refused, writes under `/tests` refused. `--linger` keeps the agent's shells open after it finishes, so a server it started is still up when the tests connect. The trajectory and counters are written to Harbor's log folder every turn, so even a timed-out trial keeps its record. A test, `bench_prompt_and_tools_match_the_published_run`, fails if the prompt or tool list sent to the model in `--bench` ever changes, so features built for agent folders can never leak into a scored run.
53+
**How gitagent runs under Harbor.** The shim uploads the binary for the container's CPU to `/opt/gitagent/`, then runs `gitagent --bench --instruction-file … --model … --profile … --linger`. `--bench` makes the run depend only on files committed in the repository: no project or home configuration, no memory, no learning, no telemetry, repo mode refused, writes under `/tests` refused. `--linger` keeps the agent's shells open after it finishes, so a server it started is still up when the tests connect. Harbor enforces each task's time limit, but the shim is not given it, so `scripts/run-dev-pass.sh` reads the limit from each task's `task.toml`, starts one job per limit, and passes `--timeout-s` 60 seconds below it; the time budget then counts down against the real limit, and the run ends cleanly before Harbor stops the container. The trajectory and counters are written to Harbor's log folder every turn, so even a timed-out trial keeps its record. A test, `bench_prompt_and_tools_match_the_published_run`, fails if the prompt or tool list sent to the model in `--bench` ever changes, so features built for agent folders can never leak into a scored run.
5454

5555
---
5656

@@ -127,6 +127,7 @@ Steps 4 to 9 repeat until the stop check accepts, the agent replies in conversat
127127
| D21 | The terminal is the interface | One console with tool lines, approvals, a task board and command suggestions; no web server to secure |
128128
| D22 | Landlock and seccomp around the agent's shell, not around gitagent | The agent cannot write outside its folders, while gitagent can still record |
129129
| D23 | `--bench` reads only committed files, and a test pins its prompt and tools | Product features cannot change a scored run by accident |
130+
| D24 | Everyday defaults keep the benchmark's guards, except the snapshot; the console has no time limit unless one is set | The loop detector, stop check and context clearing help in any repository; a person at the console stops a turn with Ctrl-C, while runs nobody watches keep a 30-minute ceiling; the snapshot costs up to 15 seconds per start in a project the user already knows |
130131

131132
**Left out on purpose:** critics that rewrite answers; best-of-N on benchmarks; memory or learning during a scored run; automated rewriting of the harness; masking every turn; third-party multi-provider frameworks; a web interface; voice; remote sandboxes.
132133

‎README.md‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ In interactive mode, Ctrl-C stops the current task and Ctrl-D or `exit` quits.
9898
| `--config <file>` | A `gitagent.yaml` to use; its `prompts/` and `profiles/` override the built-ins |
9999
| `--conversation` | A plain reply ends the run, instead of `task_complete` (always on in the console) |
100100
| `--max-turns <n>` | Stop after this many model calls |
101-
| `--timeout-s <seconds>` | Time budget for the run |
101+
| `--timeout-s <seconds>` | Time limit for the run. Without one, the console has no limit and `-p` runs stop after 30 minutes |
102102
| `--allowed-tools <a,b>`, `--disallowed-tools <a,b>` | Offer only these tools, or never these |
103103
| `--append-system-prompt <text>` | Text added after the system prompt |
104104
| `--workflow <name>`, `--input key=value` | Run one of the agent's workflows instead of a task |
@@ -276,6 +276,8 @@ The model is the same across these comparisons, so the difference lies in what t
276276

277277
None of these makes the model more capable. Together they remove the ways a capable model loses a task it could have solved: stopping too early, losing focus in long output, repeating itself, running out of time, and spending its opening turns on orientation. They also reinforce each other. A smaller context makes loops easier to escape, the time reminders leave room for the completion check to send work back before the deadline, and the cache savings make the extra verification turns nearly free.
278278

279+
Outside benchmarks, the same mechanisms are on by default, with two differences. The time reminders appear only when a run has a time limit, and the environment probe stays a benchmark setting. See [Configuration](#configuration).
280+
279281
**The rules behind the numbers** (`docs/INTEGRITY.md`, checked by `scripts/integrity-audit.sh`): the agent never reads a task's tests or verifier output, and a built-in guard refuses writes under `/tests`; the tasks used while developing were kept apart from the ones used to score; benchmark mode uses only the built-in configuration, with a test that fails if the prompt or tool list sent to the model ever changes.
280282

281283
## How gitagent works
@@ -292,7 +294,7 @@ Most agents are a prompt, a model and a bag of tools, and the interesting part i
292294

293295
**Reminders are appended, never injected.** The time left is shown on every result, and a reminder fires when the budget runs low. These go after the turn's results, never into earlier turns. Changing an earlier turn would invalidate the provider's prompt cache and the model's thinking blocks, so the whole history stays byte-identical and 92% of the input is served from cache. That is where the cost per run comes from.
294296

295-
**The loop detector.** If the model issues the same tool call with the same arguments and gets the same output twice, it is told so, with a nudge to change approach. Runaway loops are where other harnesses burn a time budget and a bill: a model that returns empty replies can be re-sent the whole growing conversation until the clock runs out. gitagent stops after the second repeat.
297+
**The loop detector.** If the model makes the same tool call with the same arguments and gets the same output three times in a row, it is told so and asked to change approach. Runaway loops are where other harnesses burn a time budget and a bill: a model that returns empty replies can be re-sent the whole growing conversation until the clock runs out. gitagent breaks the loop at the third identical call.
296298

297299
**Context is managed, not truncated.** Old tool results are cleared in batches through the provider's own context editing, which does not count as a history edit. Near the end of the window the history is replaced by a structured summary, done, pending, key files, last failure, ruled out, with the original task repeated verbatim by the harness rather than paraphrased by the model, so the goal never drifts.
298300

@@ -531,7 +533,14 @@ gitagent reads `gitagent.yaml` from `--config`, else the project folder (`gitage
531533
| `agents/<name>.md` | Sub-agent definitions (`name`, `description`, `tools`, `disallowedTools`, `maxTurns`, `model`, `effort`; the body is the prompt), when the profile enables sub-agents |
532534
| `.claude/agents/`, `.claude/skills/`, `.claude/settings.json` | An existing `.claude/` project layout, read as it is after the layers above: sub-agents and skills, and `PreToolUse` / `PostToolUse` hooks with their matchers, stdin JSON, exit codes and `hookSpecificOutput` answers (tool and argument names are translated both ways) |
533535

534-
`profile: auto` picks `anthropic`, `openai`, `google` or `compat` from the model's provider. Every behavior that changes results is a switch in the profile. Some features stay off until measured: the environment snapshot, the stop check, the time budget, the loop detector and hiding old tool output. Context compaction is on.
536+
`profile: auto` picks `anthropic`, `openai`, `google` or `compat` from the model's provider. Every behavior that changes results is a switch in the profile. The defaults for everyday work:
537+
538+
- **On:** output shaping, context compaction, the loop detector, and the stop check for runs that end with `task_complete` (`-p` and SDK task mode; a reply ends a console turn, so it never fires there).
539+
- **On for Claude models:** old tool results are cleared by the provider once the conversation passes 50,000 tokens.
540+
- **On when the run has a time limit:** the minutes left on every result, a reminder at 70% of the limit and a final call at 90%.
541+
- **Benchmark profiles only:** the environment snapshot, which adds up to 15 seconds to each start.
542+
543+
**Time limits.** Everyday work needs none. In the console a turn runs until it is done or you press Ctrl-C. Runs nobody watches (`-p`, schedules, the SDKs) stop after 30 minutes unless you set another limit with `timeout_s` in `gitagent.yaml`, `--timeout-s`, or `timeoutMs` over IPC. Setting `timeout_s` applies to the console too.
535544

536545
With `learning: online`, gitagent learns from each task it completes. The model reads the run's trajectory and proposes general lessons, which are saved in the project's `.gitagent/prompts/lessons.md`. A lesson is used only once two different tasks support it. Review the file like code: edit or delete lines freely. In repo mode the lessons are committed separately on the branch. `--bench` never learns and never loads project lessons.
537546

@@ -551,9 +560,12 @@ On Linux, outside benchmark runs, the agent's shell runs under Landlock: it may
551560
scripts/build-release.sh
552561
PYTHONPATH=$PWD harbor run -d terminal-bench/terminal-bench-2-1 \
553562
-a gitagent_harbor.agent:GitAgent -m anthropic/claude-opus-5-5 \
554-
--env-file .env --ak timeout_s=840 -k 3 -n 8 -o bench/jobs
563+
--env-file .env --ak timeout_s=840 \
564+
--ak profile=$PWD/bench/profiles/anthropic-m4-nolessons.yaml -k 3 -n 8 -o bench/jobs
555565
```
556566

567+
The profile is the one the published run used. Each task sets its own time limit in its `task.toml`. Harbor stops the agent at that limit, but the shim is not given it, so the limit is passed in with `timeout_s`: the task's limit minus 60 seconds, so gitagent finishes its work and its records before Harbor cuts it off. The example suits the tasks with the common 15-minute limit. `scripts/run-dev-pass.sh` handles every limit: it reads each task's limit, starts one Harbor job per limit, and passes the matching `timeout_s`. That is why the published run has one job per time limit.
568+
557569
The shim (`gitagent_harbor/agent.py`):
558570

559571
- **Install:** uploads the static binary for the container's CPU and runs it with `--bench`, which uses only the built-in configuration.

‎crates/cli/src/main.rs‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ pub(crate) struct Cli {
101101
#[arg(long, default_value = "/tmp/gitagent")]
102102
out_dir: PathBuf,
103103

104-
/// Wall-clock budget for the run in seconds (default: timeout_s from the config).
104+
/// Wall-clock budget for the run in seconds (default: timeout_s from the
105+
/// config; without one, 30 minutes, and no limit in the console).
105106
#[arg(long)]
106107
timeout_s: Option<u64>,
107108

@@ -183,7 +184,11 @@ pub(crate) struct Setup {
183184
pub spec: AgentSpec,
184185
pub provider: Box<dyn Provider>,
185186
pub work_dir: PathBuf,
187+
/// The limit for unattended runs: the one set, or 30 minutes.
186188
pub timeout: Duration,
189+
/// The limit set by `--timeout-s` or `timeout_s`, if any; the console
190+
/// uses only this one.
191+
pub timeout_set: Option<Duration>,
187192
pub events: Events,
188193
/// Directories the sandboxed shell may write to; `None` when the
189194
/// sandbox is off.
@@ -421,7 +426,11 @@ pub(crate) fn setup(cli: &Cli, conversation: bool) -> Result<Setup> {
421426
spec.system_prompt.push('\n');
422427
}
423428
let provider = make_provider(&spec)?;
424-
let timeout = Duration::from_secs(cli.timeout_s.unwrap_or(spec.config.timeout_s));
429+
let timeout_set = cli
430+
.timeout_s
431+
.or(spec.config.timeout_s)
432+
.map(Duration::from_secs);
433+
let timeout = timeout_set.unwrap_or(Duration::from_secs(gitagent_loader::DEFAULT_TIMEOUT_S));
425434
let events = match cli.events {
426435
Some(EventFormat::Jsonl) => Events::stdout(),
427436
None => Events::disabled(),
@@ -447,6 +456,7 @@ pub(crate) fn setup(cli: &Cli, conversation: bool) -> Result<Setup> {
447456
provider,
448457
work_dir,
449458
timeout,
459+
timeout_set,
450460
events,
451461
sandbox,
452462
})

‎crates/cli/src/repl.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub(crate) async fn run(s: Setup, out_dir: &Path) -> Result<()> {
9595
instruction: String::new(),
9696
work_dir: s.work_dir.clone(),
9797
out_dir: out_dir.join(format!("task-{n}")),
98-
timeout: Some(s.timeout),
98+
timeout: s.timeout_set,
9999
session_id: Some(session_id.clone()),
100100
events: s.events.clone(),
101101
resume: None,
@@ -147,7 +147,7 @@ pub(crate) async fn run(s: Setup, out_dir: &Path) -> Result<()> {
147147
instruction: task,
148148
work_dir: s.work_dir.clone(),
149149
out_dir: out_dir.join(format!("task-{n}")),
150-
timeout: Some(s.timeout),
150+
timeout: s.timeout_set,
151151
session_id: Some(session_id.clone()),
152152
events: events.clone(),
153153
resume: resume.take(),
@@ -190,7 +190,7 @@ pub(crate) async fn run(s: Setup, out_dir: &Path) -> Result<()> {
190190
instruction: String::new(),
191191
work_dir: s.work_dir.clone(),
192192
out_dir: out_dir.join("teardown"),
193-
timeout: Some(s.timeout),
193+
timeout: s.timeout_set,
194194
session_id: Some(session_id.clone()),
195195
events: s.events.clone(),
196196
resume: Some(r),

‎crates/cli/tests/cli.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn bench_run_writes_trajectory_and_counters() {
1212
let script = dir.path().join("script.yaml");
1313
std::fs::write(
1414
&script,
15-
"- tool_calls: [{name: exec, arguments: {cmd: 'echo hello > out.txt && cat out.txt'}}]\n\
15+
"- tool_calls: [{name: exec, arguments: {cmd: 'echo hello > out.txt && echo hello | diff - out.txt'}}]\n\
1616
- tool_calls: [{name: task_complete, arguments: {summary: wrote out.txt}}]\n",
1717
)
1818
.unwrap();
@@ -336,6 +336,7 @@ fn repo_mode_clones_commits_and_pushes_without_leaking_the_token() {
336336
std::fs::write(
337337
&script,
338338
"- tool_calls: [{name: write_file, arguments: {path: fix.txt, content: \"fixed\\n\"}}]\n\
339+
- tool_calls: [{name: exec, arguments: {cmd: git status}}]\n\
339340
- tool_calls: [{name: task_complete, arguments: {summary: Add fix.txt}}]\n",
340341
)
341342
.unwrap();
@@ -1028,6 +1029,7 @@ fn agent_hooks_follow_the_session() {
10281029
"first",
10291030
"- tool_calls: [{name: exec, arguments: {cmd: \"rm -rf build\"}}]\n\
10301031
- tool_calls: [{name: write_file, arguments: {path: notes.txt, content: hi}}]\n\
1032+
- tool_calls: [{name: exec, arguments: {cmd: git status}}]\n\
10311033
- tool_calls: [{name: task_complete, arguments: {summary: done}}]\n",
10321034
);
10331035
assert!(out.status.success());

‎crates/core/src/tests.rs‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ use gitagent_loader::Masking;
66
use gitagent_loader::{load, LoadOptions};
77
use gitagent_provider::{Role, ScriptedProvider};
88

9+
/// The built-in configuration with the guards off; each guard's own tests
10+
/// switch it on, so the other tests see the bare loop.
911
fn spec() -> AgentSpec {
10-
load(&LoadOptions {
12+
let mut spec = load(&LoadOptions {
1113
model: Some("scripted:test".into()),
1214
..Default::default()
1315
})
14-
.unwrap()
16+
.unwrap();
17+
spec.profile.stop.enabled = false;
18+
spec.profile.guards.time_budget = false;
19+
spec.profile.guards.loop_detector = false;
20+
spec
1521
}
1622

1723
struct Run {
@@ -705,10 +711,14 @@ fn built_in_stop_patterns_compile() {
705711
.unwrap();
706712
let s = &spec.profile.stop;
707713
StopCheck::new(&s.edit_patterns, &s.verify_patterns, s.max_rejections).unwrap();
708-
assert!(!s.enabled, "the stop check stays off until measured");
714+
assert!(
715+
s.enabled,
716+
"the stop check is on by default (task mode only)"
717+
);
718+
assert!(spec.profile.guards.loop_detector && spec.profile.guards.time_budget);
709719
assert!(
710720
!spec.profile.snapshot,
711-
"the snapshot stays off until measured"
721+
"the snapshot is on only in the benchmark profiles"
712722
);
713723
}
714724
}
@@ -1168,6 +1178,7 @@ async fn subagents_run_with_a_fresh_context_and_return_only_a_summary() {
11681178
.unwrap();
11691179
assert!(spec.agents.is_empty(), "sub-agents are off by default");
11701180
spec.profile.tools.subagents = true;
1181+
spec.profile.stop.enabled = false;
11711182
spec.agents = vec![gitagent_loader::AgentDef {
11721183
name: "checker".into(),
11731184
description: "Runs checks.".into(),

‎crates/loader/src/config.rs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ use std::collections::BTreeMap;
22

33
use serde::Deserialize;
44

5+
/// The time limit of an unattended run when none is set: 30 minutes.
6+
pub const DEFAULT_TIMEOUT_S: u64 = 1800;
7+
58
/// `gitagent.yaml` (BLUEPRINT §6).
69
#[derive(Debug, Clone, Deserialize)]
710
#[serde(deny_unknown_fields, default)]
@@ -10,7 +13,10 @@ pub struct Config {
1013
pub model: Option<String>,
1114
pub fallback_models: Vec<String>,
1215
pub max_turns: u32,
13-
pub timeout_s: u64,
16+
/// Wall-clock limit per run in seconds. When unset, unattended runs
17+
/// (`-p`, schedules, the SDKs) use [`DEFAULT_TIMEOUT_S`] and the console
18+
/// has no limit.
19+
pub timeout_s: Option<u64>,
1420
pub profile: String,
1521
pub sandbox: String,
1622
pub skills: bool,
@@ -36,7 +42,7 @@ impl Default for Config {
3642
model: None,
3743
fallback_models: Vec::new(),
3844
max_turns: 200,
39-
timeout_s: 1800,
45+
timeout_s: None,
4046
profile: "auto".into(),
4147
sandbox: "auto".into(),
4248
skills: true,

0 commit comments

Comments
 (0)