verifiers 0.4.2.dev10__py3-none-any.whl → 0.4.2.dev12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. verifiers/v1/agent.py +75 -61
  2. verifiers/v1/cli/debug.py +2 -3
  3. verifiers/v1/cli/gepa.py +2 -3
  4. verifiers/v1/cli/run.py +2 -3
  5. verifiers/v1/cli/validate.py +5 -5
  6. verifiers/v1/clients/train.py +8 -7
  7. verifiers/v1/dialects/base.py +2 -2
  8. verifiers/v1/env.py +47 -4
  9. verifiers/v1/gepa/runner.py +2 -2
  10. verifiers/v1/grading.py +15 -4
  11. verifiers/v1/harness.py +13 -7
  12. verifiers/v1/harnesses/__init__.py +3 -0
  13. verifiers/v1/harnesses/codex/harness.py +4 -4
  14. verifiers/v1/harnesses/kimi_code/harness.py +3 -5
  15. verifiers/v1/harnesses/openclaw/harness.py +3 -3
  16. verifiers/v1/harnesses/pi/harness.py +4 -4
  17. verifiers/v1/harnesses/prime_agent/harness.py +3 -3
  18. verifiers/v1/harnesses/rlm/harness.py +3 -3
  19. verifiers/v1/harnesses/stirrup/__init__.py +3 -0
  20. verifiers/v1/harnesses/stirrup/harness.py +80 -0
  21. verifiers/v1/harnesses/stirrup/program.py +383 -0
  22. verifiers/v1/harnesses/terminus_2/harness.py +3 -3
  23. verifiers/v1/interception/pool.py +13 -10
  24. verifiers/v1/interception/server.py +58 -61
  25. verifiers/v1/interception/tunnel/prime.py +2 -1
  26. verifiers/v1/mcp/launch.py +7 -7
  27. verifiers/v1/mcp/server.py +3 -5
  28. verifiers/v1/rollout.py +127 -33
  29. verifiers/v1/runtimes/backends/docker.py +8 -5
  30. verifiers/v1/runtimes/backends/prime.py +21 -11
  31. verifiers/v1/runtimes/base.py +14 -2
  32. verifiers/v1/runtimes/compose.py +2 -2
  33. verifiers/v1/runtimes/deployment.py +4 -3
  34. verifiers/v1/runtimes/native_compose.py +2 -2
  35. verifiers/v1/runtimes/private_network.py +4 -4
  36. verifiers/v1/runtimes/strategies.py +10 -5
  37. verifiers/v1/session.py +13 -4
  38. verifiers/v1/task.py +5 -4
  39. verifiers/v1/taskset.py +2 -2
  40. verifiers/v1/tasksets/harbor/taskset.py +2 -2
  41. verifiers/v1/utils/artifacts.py +18 -8
  42. verifiers/v1/utils/compile.py +4 -4
  43. verifiers/v1/utils/format.py +9 -9
  44. verifiers/v1/utils/interrupt.py +5 -4
  45. verifiers/v1/utils/logging.py +104 -5
  46. verifiers/v1/utils/prime.py +3 -2
  47. verifiers/v1/utils/retries.py +13 -12
  48. verifiers/v1/utils/scope.py +3 -2
  49. {verifiers-0.4.2.dev10.dist-info → verifiers-0.4.2.dev12.dist-info}/METADATA +1 -1
  50. {verifiers-0.4.2.dev10.dist-info → verifiers-0.4.2.dev12.dist-info}/RECORD +53 -50
  51. {verifiers-0.4.2.dev10.dist-info → verifiers-0.4.2.dev12.dist-info}/WHEEL +0 -0
  52. {verifiers-0.4.2.dev10.dist-info → verifiers-0.4.2.dev12.dist-info}/entry_points.txt +0 -0
  53. {verifiers-0.4.2.dev10.dist-info → verifiers-0.4.2.dev12.dist-info}/licenses/LICENSE +0 -0
verifiers/v1/agent.py CHANGED
@@ -8,7 +8,6 @@ what spans agents, never to one agent); an entered agent (`async with`) owns one
8
8
  server; un-entered, each run brings its own."""
9
9
 
10
10
  import asyncio
11
- import logging
12
11
  import uuid
13
12
  from collections.abc import AsyncIterator, Awaitable, Callable, Mapping
14
13
  from contextlib import asynccontextmanager, nullcontext
@@ -57,11 +56,18 @@ from verifiers.v1.utils.compile import (
57
56
  resolve_runtime_config,
58
57
  validate_pairing,
59
58
  )
59
+ from verifiers.v1.utils.format import format_time
60
+ from verifiers.v1.utils.logging import (
61
+ clip,
62
+ get_logger,
63
+ scope,
64
+ short_id,
65
+ )
60
66
  from verifiers.v1.utils.retries import RetryState, backoff
61
67
 
62
68
  __all__ = ["Agent", "AgentConfig", "Agents", "TimeoutConfig", "make_agent"]
63
69
 
64
- logger = logging.getLogger(__name__)
70
+ logger = get_logger(__name__)
65
71
 
66
72
  # Only nested runs in this scoring attempt participate in its rollback.
67
73
  _scoring_runs: ContextVar[list[tuple["_EpisodeAgent", Trace]] | None] = ContextVar(
@@ -138,11 +144,11 @@ def _check_borrowed_placement(
138
144
  box_image = getattr(runtime.config, "image", None)
139
145
  if box_image != task.data.image:
140
146
  logger.warning(
141
- "task %r requires image %r, but borrowed box %r runs %r; a borrowed box "
142
- "is never re-provisioned, so the run proceeds in the box's world",
147
+ "Running task %s in borrowed box %s on its image - the task requires %s "
148
+ "but the box runs %s, and a borrowed box is never re-provisioned",
143
149
  task.data.idx,
144
- task.data.image,
145
150
  runtime.name,
151
+ task.data.image,
146
152
  box_image,
147
153
  )
148
154
 
@@ -571,6 +577,8 @@ class Agent:
571
577
  sampling=config.sampling,
572
578
  )
573
579
  self._closed = False
580
+ # The name in this agent's log prefix; an episode names it after its role.
581
+ self._log_name: str | None = None
574
582
  self.runtime_config: RuntimeConfig = config.runtime
575
583
  self.interception = interception
576
584
  self.limits = RolloutLimits(
@@ -686,38 +694,40 @@ class Agent:
686
694
  retry_state = RetryState(retry)
687
695
  history: list = []
688
696
  trace_id = uuid.uuid4().hex
689
- for attempt in range(retry_state.max_retries + 1):
690
- trace = await self._run_once(
691
- task,
692
- runtime,
693
- tools,
694
- on_trace,
695
- collect_artifacts,
696
- on_score,
697
- trace_id=trace_id,
698
- attempt=attempt + 1,
699
- )
700
- if attempt == retry_state.max_retries or trace.ok:
701
- break
702
- if runtime is not None:
697
+ with scope(trace=short_id(trace_id), agent=self._log_name):
698
+ for attempt in range(retry_state.max_retries + 1):
699
+ trace = await self._run_once(
700
+ task,
701
+ runtime,
702
+ tools,
703
+ on_trace,
704
+ collect_artifacts,
705
+ on_score,
706
+ trace_id=trace_id,
707
+ attempt=attempt + 1,
708
+ )
709
+ if attempt == retry_state.max_retries or trace.ok:
710
+ break
711
+ if runtime is not None:
712
+ logger.warning(
713
+ "Not retrying rollout on a borrowed box - its state is no "
714
+ "longer the task's start state"
715
+ )
716
+ break
717
+ cause = retry_state.next_error(trace.errors)
718
+ if cause is None:
719
+ break
720
+ history.extend(trace.errors)
721
+ delay = backoff(attempt)
703
722
  logger.warning(
704
- "not retrying the rollout on a borrowed box (its state is no "
705
- "longer the task's start state); the error stands"
723
+ "Retrying rollout in %s (attempt %d/%d) - %s: %s",
724
+ format_time(delay),
725
+ attempt + 2,
726
+ retry_state.max_retries + 1,
727
+ cause.type,
728
+ clip(cause.message),
706
729
  )
707
- break
708
- cause = retry_state.next_error(trace.errors)
709
- if cause is None:
710
- break
711
- history.extend(trace.errors)
712
- delay = backoff(attempt)
713
- logger.warning(
714
- "retrying agent rollout (retry %d/%d) in %.1fs after error: %s",
715
- attempt + 1,
716
- retry_state.max_retries,
717
- delay,
718
- cause.type,
719
- )
720
- await asyncio.sleep(delay)
730
+ await asyncio.sleep(delay)
721
731
  if history:
722
732
  # The full history rides the final trace either way; success is the
723
733
  # `ok` stamp, never errors-emptiness.
@@ -805,34 +815,37 @@ class Agent:
805
815
  if self._closed:
806
816
  raise RuntimeError("Agent is closed; create a new agent")
807
817
  self._check_resume_support()
808
- params = self._rollout_params(task, runtime, dict(tools or {}))
809
- run = Rollout(
810
- task=task,
811
- has_user=True,
812
- on_trace=on_trace,
813
- **params,
814
- )
815
- interaction = Interaction(run, gate=self._gate)
816
- async with self._gate or nullcontext():
817
- opened = await run.open()
818
- if not opened and (failure := run.failure) is not None:
819
- trace = await run.close()
818
+ trace_id = uuid.uuid4().hex
819
+ with scope(trace=short_id(trace_id), agent=self._log_name):
820
+ params = self._rollout_params(task, runtime, dict(tools or {}))
821
+ run = Rollout(
822
+ task=task,
823
+ has_user=True,
824
+ on_trace=on_trace,
825
+ trace_id=trace_id,
826
+ **params,
827
+ )
828
+ interaction = Interaction(run, gate=self._gate)
829
+ async with self._gate or nullcontext():
830
+ opened = await run.open()
831
+ if not opened and (failure := run.failure) is not None:
832
+ trace = await run.close()
833
+ if trace.agent.runtime is not None:
834
+ trace.agent.runtime.borrowed = runtime is not None
835
+ raise failure
836
+ try:
837
+ yield interaction
838
+ except Exception as e:
839
+ run.fail(e)
840
+ raise
841
+ except BaseException:
842
+ await interaction._cancel_deliveries()
843
+ await run.abort()
844
+ raise
845
+ finally:
846
+ trace = run.trace if run.closed else await interaction.close()
820
847
  if trace.agent.runtime is not None:
821
848
  trace.agent.runtime.borrowed = runtime is not None
822
- raise failure
823
- try:
824
- yield interaction
825
- except Exception as e:
826
- run.fail(e)
827
- raise
828
- except BaseException:
829
- await interaction._cancel_deliveries()
830
- await run.abort()
831
- raise
832
- finally:
833
- trace = run.trace if run.closed else await interaction.close()
834
- if trace.agent.runtime is not None:
835
- trace.agent.runtime.borrowed = runtime is not None
836
849
 
837
850
  def _rollout_params(
838
851
  self, task: Task, runtime: Runtime | None, shared_tools: dict
@@ -922,6 +935,7 @@ class _EpisodeAgent(Agent):
922
935
  self._completed = completed
923
936
  self._on_trace = on_trace
924
937
  self._on_discard = on_discard
938
+ self._log_name = name
925
939
 
926
940
  def _shared_for(self, task: Task) -> Mapping[str, SharedToolServer]:
927
941
  return self._shared_tools if isinstance(task, self._task_cls) else {}
verifiers/v1/cli/debug.py CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  import asyncio
4
4
  import contextlib
5
- import logging
6
5
  import os
7
6
  import shlex
8
7
  import sys
@@ -33,10 +32,10 @@ from verifiers.v1.trace import AgentInfo, Error, Trace, TraceTask
33
32
  from verifiers.v1.utils.compile import resolve_runtime_config
34
33
  from verifiers.v1.utils.decorators import invoke
35
34
  from verifiers.v1.utils.interrupt import install_interrupt
36
- from verifiers.v1.utils.logging import setup_logging
35
+ from verifiers.v1.utils.logging import get_logger, setup_logging
37
36
  from verifiers.v1.utils.trace_store import append_trace
38
37
 
39
- logger = logging.getLogger(__name__)
38
+ logger = get_logger(__name__)
40
39
 
41
40
  USAGE = (
42
41
  "usage: uv run vf-debug [<taskset-id>] (--command <cmd> | --script-path <path>) "
verifiers/v1/cli/gepa.py CHANGED
@@ -8,7 +8,6 @@ leading bare token is the taskset id, the `env` subconfig is narrowed from the i
8
8
  and the actual parse is `pydantic_config.cli`.
9
9
  """
10
10
 
11
- import logging
12
11
  import os
13
12
  import sys
14
13
  import uuid
@@ -26,10 +25,10 @@ from verifiers.v1.cli.resolve import (
26
25
  )
27
26
  from verifiers.v1.gepa import GEPAConfig, run_gepa
28
27
  from verifiers.v1.utils.interrupt import install_interrupt
29
- from verifiers.v1.utils.logging import setup_logging
28
+ from verifiers.v1.utils.logging import get_logger, setup_logging
30
29
  from verifiers.v1.utils.trace_store import TRACES_FILE
31
30
 
32
- logger = logging.getLogger(__name__)
31
+ logger = get_logger(__name__)
33
32
 
34
33
  USAGE = "usage: uv run vf-gepa [<taskset-id>] [--env.id <id>] --model <model> [options] [@ file.toml]"
35
34
 
verifiers/v1/cli/run.py CHANGED
@@ -5,7 +5,6 @@ it directly. For full evaluations, use prime-rl's `uv run eval`.
5
5
  """
6
6
 
7
7
  import asyncio
8
- import logging
9
8
  import os
10
9
  import sys
11
10
  from pathlib import Path
@@ -26,10 +25,10 @@ from verifiers.v1.episode import Episode
26
25
  from verifiers.v1.trace import EvalRunInfo
27
26
  from verifiers.v1.utils.interrupt import install_interrupt
28
27
  from verifiers.v1.utils.loaders import load_environment
29
- from verifiers.v1.utils.logging import setup_logging
28
+ from verifiers.v1.utils.logging import get_logger, setup_logging
30
29
  from verifiers.v1.utils.trace_store import TRACES_FILE, append_episode
31
30
 
32
- logger = logging.getLogger(__name__)
31
+ logger = get_logger(__name__)
33
32
 
34
33
  USAGE = "usage: uv run vf-run [<taskset-id>] [--env.id <id>] [-m <model>] [-n <tasks>] [-r <rollouts>] [options] [@ file.toml]"
35
34
 
@@ -3,7 +3,6 @@
3
3
  import asyncio
4
4
  import contextlib
5
5
  import json
6
- import logging
7
6
  import os
8
7
  import shutil
9
8
  import sys
@@ -45,10 +44,11 @@ from verifiers.v1.utils.aio import run_shielded
45
44
  from verifiers.v1.utils.artifacts import collect
46
45
  from verifiers.v1.utils.compile import resolve_runtime_config
47
46
  from verifiers.v1.utils.decorators import invoke
47
+ from verifiers.v1.utils.format import format_time
48
48
  from verifiers.v1.utils.interrupt import install_interrupt
49
- from verifiers.v1.utils.logging import setup_logging
49
+ from verifiers.v1.utils.logging import get_logger, setup_logging
50
50
 
51
- logger = logging.getLogger(__name__)
51
+ logger = get_logger(__name__)
52
52
 
53
53
  RESULTS_FILE = "results.jsonl"
54
54
  SUMMARY_FILE = "summary.json"
@@ -504,11 +504,11 @@ async def run_validate(config: ValidateConfig) -> list[dict]:
504
504
  await run_shielded(persist())
505
505
  detail = f" - {note}" if (note := _describe(row)) else ""
506
506
  logger.info(
507
- "idx=%s valid=%s reason=%s (%.1fs)%s",
507
+ "idx=%s valid=%s reason=%s (%s)%s",
508
508
  row["index"],
509
509
  row["valid"],
510
510
  row["reason"],
511
- row["elapsed"],
511
+ format_time(row["elapsed"]),
512
512
  detail,
513
513
  )
514
514
  return row
@@ -2,7 +2,6 @@
2
2
 
3
3
  import asyncio
4
4
  import json
5
- import logging
6
5
  import threading
7
6
  from collections.abc import AsyncIterator, Callable, Mapping
8
7
  from contextlib import asynccontextmanager
@@ -34,8 +33,9 @@ from verifiers.v1.types import (
34
33
  Usage,
35
34
  WeightVersionSpan,
36
35
  )
36
+ from verifiers.v1.utils.logging import get_logger, isolated
37
37
 
38
- logger = logging.getLogger(__name__)
38
+ logger = get_logger(__name__)
39
39
 
40
40
  T = TypeVar("T")
41
41
 
@@ -315,11 +315,12 @@ class ElasticRendererPool:
315
315
 
316
316
  slot = RendererSlot(await asyncio.to_thread(build))
317
317
  self.renderers.append(slot)
318
- logger.info(
319
- "renderer pool: %d renderer(s), multiplex=%d",
320
- len(self.renderers),
321
- self.multiplex,
322
- )
318
+ with isolated():
319
+ logger.info(
320
+ "Grew renderer pool to %d renderer(s) multiplex=%d",
321
+ len(self.renderers),
322
+ self.multiplex,
323
+ )
323
324
  return slot
324
325
 
325
326
  @asynccontextmanager
@@ -12,7 +12,6 @@ exception is `apply_overrides` (impose the eval's model + sampling in this forma
12
12
  """
13
13
 
14
14
  import json
15
- import logging
16
15
  from abc import ABC, abstractmethod
17
16
  from collections.abc import Callable, Mapping
18
17
  from glob import has_magic
@@ -29,12 +28,13 @@ from verifiers.v1.configs.runtime import (
29
28
  )
30
29
  from verifiers.v1.configs.sampling import Sampling, SamplingConfig
31
30
  from verifiers.v1.types import Request, Response
31
+ from verifiers.v1.utils.logging import get_logger
32
32
  from verifiers.v1.utils.network import parse_network_rule
33
33
 
34
34
  RespT = TypeVar("RespT", bound=BaseModel)
35
35
  RawRequest = dict[str, Any]
36
36
 
37
- logger = logging.getLogger(__name__)
37
+ logger = get_logger(__name__)
38
38
 
39
39
  PROVIDER_CAPABILITY_POLICY_CODE = "provider_capability_unavailable"
40
40
  CAPABILITY_NOTICE = (
verifiers/v1/env.py CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import asyncio
4
4
  import contextlib
5
- import logging
5
+ import time
6
6
  import traceback
7
7
  import uuid
8
8
  from abc import ABC, abstractmethod
@@ -33,11 +33,13 @@ from verifiers.v1.mcp import SharedToolServer, serve_shared
33
33
  from verifiers.v1.runtimes import SubprocessConfig, runtime_is_local
34
34
  from verifiers.v1.task import Task
35
35
  from verifiers.v1.trace import Error, Trace, TraceTask
36
+ from verifiers.v1.utils.format import format_time
36
37
  from verifiers.v1.utils.generic import concrete_type
38
+ from verifiers.v1.utils.logging import clip, get_logger, scope, short_id
37
39
  from verifiers.v1.utils.memory import trim_memory_periodically
38
40
  from verifiers.v1.utils.retries import run_episode_with_retry
39
41
 
40
- logger = logging.getLogger(__name__)
42
+ logger = get_logger(__name__)
41
43
 
42
44
 
43
45
  def _as_error(e: Exception) -> Error:
@@ -331,7 +333,7 @@ class Env(ABC, Generic[ConfigT]):
331
333
  attempts = 0
332
334
 
333
335
  async def attempt() -> Episode:
334
- nonlocal attempts
336
+ nonlocal attempts, started
335
337
  attempts += 1
336
338
  slot.traces = [] # a retry shows the fresh attempt's traces
337
339
  live = slot.traces
@@ -347,6 +349,20 @@ class Env(ABC, Generic[ConfigT]):
347
349
  live.remove(trace)
348
350
 
349
351
  async with semaphore or contextlib.nullcontext():
352
+ if started is None:
353
+ started = time.perf_counter()
354
+ data = slot.task.data
355
+ optional = (
356
+ ("name", data.name),
357
+ ("id", data.id),
358
+ ("image", data.image),
359
+ )
360
+ logger.info(
361
+ "Starting episode env=%s idx=%s%s",
362
+ self.config.env_id,
363
+ data.idx,
364
+ "".join(f" {k}={v}" for k, v in optional if v is not None),
365
+ )
350
366
  return await self.run_episode(
351
367
  slot.task,
352
368
  ctx,
@@ -356,7 +372,34 @@ class Env(ABC, Generic[ConfigT]):
356
372
  attempt=attempts,
357
373
  )
358
374
 
359
- episode = await run_episode_with_retry(attempt, self.config.retries)
375
+ started: float | None = None
376
+ with scope(episode=short_id(slot.id)):
377
+ episode = await run_episode_with_retry(attempt, self.config.retries)
378
+ elapsed = format_time(
379
+ time.perf_counter() - (started or time.perf_counter())
380
+ )
381
+ failed = sum(not trace.ok for trace in episode.traces)
382
+ if episode.ok:
383
+ logger.info(
384
+ "Finished episode in %s rollouts=%d failed=%d",
385
+ elapsed,
386
+ len(episode.traces),
387
+ failed,
388
+ )
389
+ else:
390
+ # Name a failed rollout's error first: ok traces keep recovered
391
+ # retry errors, and `episode.errors` starts with earlier attempts'.
392
+ errors = [t.last_error for t in episode.traces if not t.ok]
393
+ errors += episode.errors[-1:]
394
+ error = next((e for e in errors if e is not None), None)
395
+ reason = f" - {error.type}: {clip(error.message)}" if error else ""
396
+ logger.warning(
397
+ "Failed episode in %s rollouts=%d failed=%d%s",
398
+ elapsed,
399
+ len(episode.traces),
400
+ failed,
401
+ reason,
402
+ )
360
403
  slot.traces = list(episode.traces)
361
404
  slot.episode = episode
362
405
  slot.done = True
@@ -6,7 +6,6 @@ and everything is torn down in `finally`. Mirrors how v0 vf-gepa bridged sync GE
6
6
  rollouts — a Ctrl-C raises on the main thread inside `optimize()` and unwinds through teardown."""
7
7
 
8
8
  import asyncio
9
- import logging
10
9
 
11
10
  from gepa.api import optimize
12
11
  from gepa.core.result import GEPAResult
@@ -22,9 +21,10 @@ from verifiers.v1.gepa.dataset import (
22
21
  split_tasks,
23
22
  )
24
23
  from verifiers.v1.gepa.reflection import build_reflection_lm
24
+ from verifiers.v1.utils.logging import get_logger
25
25
  from verifiers.v1.utils.trace_store import append_episode
26
26
 
27
- logger = logging.getLogger(__name__)
27
+ logger = get_logger(__name__)
28
28
 
29
29
 
30
30
  class _GEPALog:
verifiers/v1/grading.py CHANGED
@@ -21,9 +21,10 @@ from verifiers.v1.utils.artifacts import restore
21
21
  from verifiers.v1.utils.compile import resolve_runtime_config
22
22
  from verifiers.v1.utils.decorators import invoke
23
23
  from verifiers.v1.utils.env import resolve_env
24
+ from verifiers.v1.utils.logging import clip, get_logger
24
25
  from verifiers.v1.utils.retries import RetryState, backoff
25
26
 
26
- logger = logging.getLogger(__name__)
27
+ logger = get_logger(__name__)
27
28
  _SCORING_INFO_KEYS = ("judge_calls", "scoring_diagnostics")
28
29
  """Accounting and diagnostics survive failed scoring attempts, unlike partial scores."""
29
30
 
@@ -185,8 +186,13 @@ async def grade_task(
185
186
  trace.info = result.info
186
187
  try:
187
188
  await stack.aclose()
188
- except Exception:
189
- logger.warning("verifier teardown failed", exc_info=True)
189
+ except Exception as e:
190
+ logger.warning(
191
+ "Failed to tear down verifier - %s: %s",
192
+ type(e).__name__,
193
+ e,
194
+ exc_info=logger.isEnabledFor(logging.DEBUG),
195
+ )
190
196
  return
191
197
  except Exception as error:
192
198
  recorded = Error(
@@ -197,7 +203,12 @@ async def grade_task(
197
203
  if attempt == retry.max_retries or retry.next_error([recorded]) is None:
198
204
  raise
199
205
  logger.warning(
200
- "verifier attempt %d failed; retrying", attempt + 1, exc_info=True
206
+ "Retrying grading (attempt %d/%d) - %s: %s",
207
+ attempt + 2,
208
+ retry.max_retries + 1,
209
+ recorded.type,
210
+ clip(recorded.message),
211
+ exc_info=logger.isEnabledFor(logging.DEBUG),
201
212
  )
202
213
 
203
214
 
verifiers/v1/harness.py CHANGED
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
- import logging
5
4
  import os
6
5
  from abc import ABC, abstractmethod
7
6
  from collections.abc import Mapping
@@ -25,13 +24,18 @@ from verifiers.v1.utils.decorators import (
25
24
  seed,
26
25
  unseed,
27
26
  )
27
+ from verifiers.v1.utils.logging import get_logger
28
28
 
29
29
  if TYPE_CHECKING:
30
30
  # Annotation-only: `Trace` appears in signatures only, so this module stays
31
31
  # importable below the trace record.
32
32
  from verifiers.v1.trace import Trace
33
33
 
34
- logger = logging.getLogger(__name__)
34
+ logger = get_logger(__name__)
35
+
36
+ _WARNED_SYSTEM_PROMPT: set[str] = set()
37
+ """Harness ids already warned about folding the system prompt: the warning is per
38
+ config, so it fires once per process, not once per rollout."""
35
39
 
36
40
 
37
41
  ConfigT = TypeVar("ConfigT", bound=HarnessConfig)
@@ -94,11 +98,13 @@ class Harness(ABC, Generic[ConfigT]):
94
98
  f"{'Messages' if prompt is not None else 'None'} prompt; set "
95
99
  "APPENDS_SYSTEM_PROMPT to emit it as a system message."
96
100
  )
97
- logger.warning(
98
- "Harness %r does not support a separate system prompt; prepending "
99
- "task.system_prompt to the user prompt.",
100
- self.config.id,
101
- )
101
+ if self.config.id not in _WARNED_SYSTEM_PROMPT:
102
+ _WARNED_SYSTEM_PROMPT.add(self.config.id)
103
+ logger.warning(
104
+ "Harness %s does not support a separate system prompt - prepending "
105
+ "task.system_prompt to the user prompt",
106
+ self.config.id,
107
+ )
102
108
  return None, f"{system}\n\n{prompt}"
103
109
 
104
110
  def resolve_text_prompt(self, task: TaskData) -> tuple[str | None, str | None]:
@@ -27,6 +27,7 @@ from verifiers.v1.harnesses.prime_agent import (
27
27
  PrimeAgentHarnessConfig,
28
28
  )
29
29
  from verifiers.v1.harnesses.rlm import RLMHarness, RLMHarnessConfig
30
+ from verifiers.v1.harnesses.stirrup import StirrupHarness, StirrupHarnessConfig
30
31
  from verifiers.v1.harnesses.terminus_2 import Terminus2Harness, Terminus2HarnessConfig
31
32
 
32
33
  __all__ = [
@@ -58,6 +59,8 @@ __all__ = [
58
59
  "PrimeAgentHarnessConfig",
59
60
  "RLMHarness",
60
61
  "RLMHarnessConfig",
62
+ "StirrupHarness",
63
+ "StirrupHarnessConfig",
61
64
  "Terminus2Harness",
62
65
  "Terminus2HarnessConfig",
63
66
  ]
@@ -2,7 +2,6 @@
2
2
 
3
3
  import hashlib
4
4
  import json
5
- import logging
6
5
  import tomllib
7
6
  from pathlib import Path
8
7
  from typing import Literal
@@ -17,8 +16,9 @@ from verifiers.v1.harnesses.utils.install import ensure_installed, remove_dir
17
16
  from verifiers.v1.runtimes import Runtime
18
17
  from verifiers.v1.task import TaskData
19
18
  from verifiers.v1.trace import Trace
19
+ from verifiers.v1.utils.logging import get_logger
20
20
 
21
- logger = logging.getLogger(__name__)
21
+ logger = get_logger(__name__)
22
22
 
23
23
  CODEX_DIR = "/var/tmp/vf-codex-{version}-{acp_version}"
24
24
  PACKAGES_DIR = f"{CODEX_DIR}/acp"
@@ -77,8 +77,8 @@ class CodexHarness(ACPHarness[CodexHarnessConfig]):
77
77
 
78
78
  async def setup(self, runtime: Runtime) -> None:
79
79
  await ensure_node(runtime)
80
- logger.info(
81
- "codex: ensuring Codex %s and codex-acp %s are installed",
80
+ logger.debug(
81
+ "Ensuring Codex %s and codex-acp %s are installed",
82
82
  self.config.version,
83
83
  ACP_VERSION,
84
84
  )
@@ -1,6 +1,5 @@
1
1
  """Run Kimi Code's native ACP server against interception."""
2
2
 
3
- import logging
4
3
  import tomllib
5
4
 
6
5
  import tomli_w
@@ -15,8 +14,9 @@ from verifiers.v1.runtimes import Runtime
15
14
  from verifiers.v1.task import TaskData
16
15
  from verifiers.v1.trace import Trace
17
16
  from verifiers.v1.types import Message
17
+ from verifiers.v1.utils.logging import get_logger
18
18
 
19
- logger = logging.getLogger(__name__)
19
+ logger = get_logger(__name__)
20
20
 
21
21
  KIMI_DIR = "/var/tmp/vf-kimi-code"
22
22
  KIMI_BIN = f"{KIMI_DIR}/node_modules/.bin/kimi"
@@ -58,9 +58,7 @@ class KimiCodeHarness(ACPHarness[KimiCodeHarnessConfig]):
58
58
 
59
59
  async def setup(self, runtime: Runtime) -> None:
60
60
  await ensure_node(runtime)
61
- logger.info(
62
- "kimi-code: ensuring Kimi Code %s is installed", self.config.version
63
- )
61
+ logger.debug("Ensuring Kimi Code %s is installed", self.config.version)
64
62
  await ensure_installed(
65
63
  runtime,
66
64
  directory=KIMI_DIR,
@@ -1,7 +1,6 @@
1
1
  """Run OpenClaw's Gateway-backed ACP agent against interception."""
2
2
 
3
3
  import json
4
- import logging
5
4
  from typing import Literal
6
5
 
7
6
  from verifiers.v1.acp import ACPConfig, ACPHarness
@@ -11,8 +10,9 @@ from verifiers.v1.harnesses.utils.install import ensure_installed, remove_dir
11
10
  from verifiers.v1.runtimes import Runtime
12
11
  from verifiers.v1.task import TaskData
13
12
  from verifiers.v1.trace import Trace
13
+ from verifiers.v1.utils.logging import get_logger
14
14
 
15
- logger = logging.getLogger(__name__)
15
+ logger = get_logger(__name__)
16
16
 
17
17
  # OpenClaw and its bundled Node runtime exceed the small /tmp tmpfs in some VMs.
18
18
  OPENCLAW_DIR = "/var/tmp/vf-openclaw-{version}"
@@ -145,7 +145,7 @@ class OpenClawHarness(ACPHarness[OpenClawHarnessConfig]):
145
145
  async def setup(self, runtime: Runtime) -> None:
146
146
  directory = OPENCLAW_DIR.format(version=self.config.version)
147
147
  binary = OPENCLAW_BIN.format(version=self.config.version)
148
- logger.info("openclaw: ensuring OpenClaw %s is installed", self.config.version)
148
+ logger.debug("Ensuring OpenClaw %s is installed", self.config.version)
149
149
  # Borrowed runtimes can share this cache, so one filesystem lock owns both
150
150
  # installation and the transcript adjustment.
151
151
  await ensure_installed(