Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/nullius/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
A name is a slug the user typed, or two words picked at random.

The cache is keyed by a *signature* of the job directory (every result.json,
and each trial's trajectory.json, trace.json and verifier/score.json, with
size and mtime), never by time: a run
and each trial's trajectory.json, trace.json, gateway.log, verifier/score.json
and verifier/parts.json, with size and mtime), never by time: a run
still going changes its files, the signature moves, the job is parsed again.
A cached job that was parsed by an older version of ``parse`` is refreshed
too — the signature carries ``parse.SCHEMA`` and the Job and Trial field names, so a
Expand Down Expand Up @@ -416,7 +416,8 @@ def stat(path):
continue
own = [s for s in (stat(os.path.join(sub, rel)) for rel in
("result.json", os.path.join("agent", "trajectory.json"), os.path.join("agent", "trace.json"),
os.path.join("verifier", "score.json"))) if s]
os.path.join("agent", "gateway.log"), os.path.join("verifier", "score.json"),
os.path.join("verifier", "parts.json"))) if s]
parts += own
trials[sub] = "\n".join(own)
return hashlib.sha256("\n".join(parts).encode()).hexdigest(), trials
Expand Down
21 changes: 21 additions & 0 deletions app/tests/test_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,27 @@ def test_a_standard_trial_s_stop_reason_follows_its_score_file_alone(self):
workspace._DECODED.clear() # a new process: the cache on disk, by its signature
self.assertEqual(workspace.load_job(self.ws, self.job_dir)[0].trials[1].ended_by, "")

def test_a_trial_s_parts_and_rate_limits_follow_their_files_alone(self):
self._end(n_running_trials=1)
trial = os.path.join(self.job_dir, "tau3-bench__t1__abc")
parts, log = os.path.join(trial, "verifier", "parts.json"), os.path.join(trial, "agent", "gateway.log")

def seen():
t = workspace.load_job(self.ws, self.job_dir)[0].trials[1]
return t.part_groups, t.n_rate_limited_retries
self.assertEqual(seen(), ({}, None))
_write_json(parts, {"by": "category", "parts": [{"group": "a", "score": 1.0}]})
self.assertEqual(seen(), ({"a": [1.0, 1]}, None))
os.makedirs(os.path.dirname(log), exist_ok=True)
with open(log, "w", encoding="utf-8") as fh:
fh.write("2026-09-04T01:00:20+00:00 openai/m status 429\n")
self.assertEqual(seen(), ({"a": [1.0, 1]}, 1))
os.remove(parts)
self.assertEqual(seen(), ({}, 1))
os.remove(log)
workspace._DECODED.clear() # a new process: the cache on disk, by its signature
self.assertEqual(seen(), ({}, None))

def test_a_host_run_s_trial_copied_after_its_job_is_read_once_the_run_ends(self):
"""A host run's copy can bring the job's final result.json with a trial's
file still mid-write, and the next copy correct the trial alone."""
Expand Down