verifiers 0.3.2.dev152__py3-none-any.whl → 0.3.2.dev153__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.
@@ -13,7 +13,7 @@ from pydantic import BaseModel, ConfigDict, Field
13
13
 
14
14
  from verifiers.v1.clients import ModelContext
15
15
  from verifiers.v1.configs.harness import HarnessConfig
16
- from verifiers.v1.errors import HarnessError
16
+ from verifiers.v1.errors import HarnessError, InterceptionError
17
17
  from verifiers.v1.harness import Harness, HarnessSession
18
18
  from verifiers.v1.runtimes import ProgramResult, Runtime, RuntimeProcess
19
19
  from verifiers.v1.semantic import (
@@ -308,6 +308,12 @@ class ACPHarnessSession(HarnessSession):
308
308
  detail = response.get("error") or "ACP session request failed"
309
309
  if stderr := self._stderr():
310
310
  detail = f"{detail}\n\nACP process stderr:\n{stderr}"
311
+ error_data = response.get("error_data")
312
+ if (
313
+ isinstance(error_data, dict)
314
+ and error_data.get("kind") == "model_transport"
315
+ ):
316
+ raise InterceptionError(detail)
311
317
  raise RuntimeError(detail)
312
318
  harness = cast(ACPHarness, self.harness)
313
319
  harness._consume_protocol_metadata(self.trace, turn.response_metadata)
@@ -224,9 +224,6 @@ async def prompt(
224
224
  if client.stop_reason != "cancelled":
225
225
  raise
226
226
  await connection.cancel(session_id=session_id)
227
- except RequestError as error:
228
- detail = error.data.get("details") if isinstance(error.data, dict) else None
229
- raise RuntimeError(detail or str(error)) from error
230
227
  finally:
231
228
  client.prompt_task = None
232
229
  return client.turn_result()
@@ -377,6 +374,9 @@ async def serve_stream() -> None:
377
374
  "ok": False,
378
375
  "error": f"{type(error).__name__}: {error}",
379
376
  }
377
+ if isinstance(error, RequestError) and isinstance(error.data, dict):
378
+ response["error"] = error.data.get("details") or str(error)
379
+ response["error_data"] = error.data
380
380
  if operation == "prompt":
381
381
  response["result"] = asdict(session.client.turn_result())
382
382
  write_packet(sys.stdout.buffer, response)
verifiers/v1/errors.py CHANGED
@@ -42,6 +42,11 @@ class ProviderError(RolloutError):
42
42
  self.status_code = status_code
43
43
 
44
44
 
45
+ MODEL_TRANSPORT_ERROR_EXIT_CODE = 97
46
+ """Reserved harness exit code for an exhausted model transport failure.
47
+ `Harness._check_result` maps it to `InterceptionError`."""
48
+
49
+
45
50
  class HarnessError(RolloutError):
46
51
  """The harness failed to install or launch, or its agent process exited unsuccessfully."""
47
52
 
@@ -65,7 +70,7 @@ class TaskError(RolloutError):
65
70
 
66
71
 
67
72
  class InterceptionError(RolloutError):
68
- """The host interception server (model calls + `/state` + `/task` channels) couldn't be reached."""
73
+ """Communication with the host interception server failed."""
69
74
 
70
75
 
71
76
  class TunnelError(InterceptionError):
verifiers/v1/harness.py CHANGED
@@ -9,7 +9,13 @@ from typing import TYPE_CHECKING, ClassVar, Generic, TypeVar
9
9
 
10
10
  from verifiers.v1.clients import ModelContext
11
11
  from verifiers.v1.configs.harness import HarnessConfig, skill_destination
12
- from verifiers.v1.errors import HarnessError, SandboxError, boundary
12
+ from verifiers.v1.errors import (
13
+ MODEL_TRANSPORT_ERROR_EXIT_CODE,
14
+ HarnessError,
15
+ InterceptionError,
16
+ SandboxError,
17
+ boundary,
18
+ )
13
19
  from verifiers.v1.runtimes import ProgramResult, Runtime
14
20
  from verifiers.v1.task import TaskData
15
21
  from verifiers.v1.types import Messages
@@ -178,6 +184,10 @@ copy_failed=$(
178
184
  f"runtime died under harness {self.config.id!r} "
179
185
  f"(exit {result.exit_code}): {detail}"
180
186
  )
187
+ if result.exit_code == MODEL_TRANSPORT_ERROR_EXIT_CODE:
188
+ raise InterceptionError(
189
+ f"harness {self.config.id!r} model connection to interception failed: {detail}"
190
+ )
181
191
  raise HarnessError(
182
192
  f"harness {self.config.id!r} exited {result.exit_code}: {detail}"
183
193
  )
@@ -69,7 +69,7 @@ class CompactionConfig(BaseConfig):
69
69
 
70
70
  class RLMHarnessConfig(HarnessConfig):
71
71
  version: str = Field(
72
- default="ec0335baa434eb726146e330be391ee92bf3a0c8", min_length=1
72
+ default="38c44a06fdef484a19d8d6c4e5697100971f9ecd", min_length=1
73
73
  )
74
74
  """Git ref (branch, tag, or commit) of nano-rlm to install. Must know every
75
75
  field this harness puts on the wire, i.e. be at least the default ref."""
@@ -5,6 +5,7 @@ import asyncio
5
5
  import json
6
6
  import logging
7
7
  import subprocess
8
+ import traceback
8
9
  from contextlib import AsyncExitStack
9
10
  from pathlib import Path
10
11
  from typing import TYPE_CHECKING
@@ -39,6 +40,10 @@ if TYPE_CHECKING:
39
40
  )
40
41
  from verifiers.v1.harnesses.utils.mcp import call_mcp, connect_mcp # noqa: TC004
41
42
 
43
+ # Mirror of verifiers.v1.errors.MODEL_TRANSPORT_ERROR_EXIT_CODE;
44
+ # this bundled script cannot import verifiers.
45
+ MODEL_TRANSPORT_ERROR_EXIT_CODE = 97
46
+
42
47
  SERPER_URL = "https://google.serper.dev/search"
43
48
 
44
49
  BASH_TOOL = {
@@ -260,25 +265,32 @@ async def chat(
260
265
  kwargs["tools"] = tools
261
266
  if tools and tool_choice is not None:
262
267
  kwargs["tool_choice"] = tool_choice
263
- async for attempt in AsyncRetrying(
264
- retry=retry_if_exception_type((APIConnectionError, httpx.TransportError)),
265
- stop=stop_after_attempt(client.max_retries + 1),
266
- wait=wait_random_exponential(multiplier=0.5, max=8.0),
267
- before_sleep=before_sleep_log(logging.getLogger(__name__), logging.WARNING),
268
- reraise=True,
269
- ):
270
- # Reuse the interception server's body-digest replay guard on stream retries.
271
- retry_count = attempt.retry_state.attempt_number - 1
272
- headers = {"x-stainless-retry-count": str(retry_count)} if retry_count else omit
273
- raw_stream = await client.chat.completions.create(
274
- **kwargs,
275
- stream=True,
276
- stream_options={"include_usage": True},
277
- extra_headers=headers,
278
- )
279
- # The SDK retries request setup; only stream consumption is retried here.
280
- with attempt:
281
- return await _read_chat_completion(raw_stream)
268
+ try:
269
+ async for attempt in AsyncRetrying(
270
+ retry=retry_if_exception_type((APIConnectionError, httpx.TransportError)),
271
+ stop=stop_after_attempt(client.max_retries + 1),
272
+ wait=wait_random_exponential(multiplier=0.5, max=8.0),
273
+ before_sleep=before_sleep_log(logging.getLogger(__name__), logging.WARNING),
274
+ reraise=True,
275
+ ):
276
+ # Reuse the interception server's body-digest replay guard on stream retries.
277
+ retry_count = attempt.retry_state.attempt_number - 1
278
+ headers = (
279
+ {"x-stainless-retry-count": str(retry_count)} if retry_count else omit
280
+ )
281
+ raw_stream = await client.chat.completions.create(
282
+ **kwargs,
283
+ stream=True,
284
+ stream_options={"include_usage": True},
285
+ extra_headers=headers,
286
+ )
287
+ # The SDK retries request setup; only stream consumption is retried here.
288
+ with attempt:
289
+ return await _read_chat_completion(raw_stream)
290
+ except (APIConnectionError, httpx.TransportError) as error:
291
+ # Preserve the original transport error in stderr for the host's diagnostic.
292
+ traceback.print_exc()
293
+ raise SystemExit(MODEL_TRANSPORT_ERROR_EXIT_CODE) from error
282
294
 
283
295
 
284
296
  async def _read_chat_completion(raw_stream):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.3.2.dev152
3
+ Version: 0.3.2.dev153
4
4
  Summary: Verifiers: Environments for LLM Reinforcement Learning
5
5
  Project-URL: Homepage, https://github.com/primeintellect-ai/verifiers
6
6
  Project-URL: Documentation, https://github.com/primeintellect-ai/verifiers
@@ -3,9 +3,9 @@ verifiers/v1/__init__.py,sha256=6t2FsosAjmyfJz6qS8tDQ2gWCvQfyRzqk1mYwv5_-EQ,8738
3
3
  verifiers/v1/agent.py,sha256=yBCCBe5tVTeQ8OZDlVSZLw_IDvCmEQSnF3wQ1BZcT14,32342
4
4
  verifiers/v1/env.py,sha256=GqrVxxrvv-9WitXhD8Rre0tKQgnQWeD8mTM2gDHMVBs,18040
5
5
  verifiers/v1/episode.py,sha256=UPtA02aGWA-fY8cJKEuYCMtQVnPN1C0BSN13LggNT8U,5986
6
- verifiers/v1/errors.py,sha256=QFbKFrma1STrN7abYcU2LBQOQBpj43Rm-nOwL9EFeUM,5743
6
+ verifiers/v1/errors.py,sha256=nNabzi55J5aHmAmW9UHZVpI7kcBfy4Xcyt4cQthZbM8,5875
7
7
  verifiers/v1/graph.py,sha256=4EA1TzUBLf9HycfSifKI5J3XkeJzYjbsszZRVwXSGP0,41420
8
- verifiers/v1/harness.py,sha256=incFERkwxSPQvBCWc0BVQPg9IAEMTeelBq4USKWLxWo,15669
8
+ verifiers/v1/harness.py,sha256=AcsCmNHB1UQ75nD7RUawsb65q63NdkcMykD0E6oRDOA,15957
9
9
  verifiers/v1/judge.py,sha256=uqn-djkK2_7Q3kOjkDo6ipOvV_HOvuLa9y6AoDjRux8,9618
10
10
  verifiers/v1/rollout.py,sha256=WiMCJyAypsR1OaXvzJQx7G-T67v__AnnDNoXotuI_VE,25444
11
11
  verifiers/v1/semantic.py,sha256=VQ_buw6Ya6QtRoh_fiYI5Avs5RmIQCfWH0H0bQc4aoc,4704
@@ -15,8 +15,8 @@ verifiers/v1/task.py,sha256=6-Tw0iBLsc4hinvVPl_b2EUX8unAAnxtHMXNSIHXsnU,12886
15
15
  verifiers/v1/taskset.py,sha256=LE_3ogL7itU2Amk-N20cHkZ7Ev6MznJ0HpC8B1xb4w0,9482
16
16
  verifiers/v1/trace.py,sha256=tgzkft4nKF4QGeGXwoqkfXjaUbG65Nn1oBFzMUFp-u0,32234
17
17
  verifiers/v1/types.py,sha256=-In5plgB3mQLqtRKHC3QDCPDvuruAqVd8WIjKrsGB_I,10578
18
- verifiers/v1/acp/__init__.py,sha256=9RySmxFeEMT2XSJy5wYevqEhQdul2jHl9f5XAribG3A,13631
19
- verifiers/v1/acp/runner.py,sha256=zPo-2ZXmFMmQchhD7nNzlZUrabG09qiBvpB67KVGm3M,14095
18
+ verifiers/v1/acp/__init__.py,sha256=Omle2zo7aly_7CCg1N9yQjQcJe4UpqTw9xVBP8_tuT8,13891
19
+ verifiers/v1/acp/runner.py,sha256=OrJ1VSWTnNosV8OklqM2YdERlbF7olT9PHEdQfXvgGQ,14137
20
20
  verifiers/v1/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  verifiers/v1/cli/debug.py,sha256=OgzXCW9HaTNruZil4f70WP5tR6toKliKaVvV98C5qzE,11665
22
22
  verifiers/v1/cli/gepa.py,sha256=IyS3YZCCHVydb-OyPeGdtCYsz6OYqXXddXqYq8RLucM,4374
@@ -113,13 +113,13 @@ verifiers/v1/harnesses/pi/harness.py,sha256=ysKOLSRQnbPkMtwvuUoJU7Hd4uM4bDF1duD0
113
113
  verifiers/v1/harnesses/prime_agent/__init__.py,sha256=xfPC4RrlnyYWaf38tPAOZq4YL6M55lMpj5BoRLmaK8I,171
114
114
  verifiers/v1/harnesses/prime_agent/harness.py,sha256=Zs_f5H2hQgDzUS4zwArM5UxCYJI5Zo0ELmayn1oBkK0,10663
115
115
  verifiers/v1/harnesses/rlm/__init__.py,sha256=hwx51xTdEWzzYgMj-p4ETNcptoub3IPMDbEdJ4uB8Ns,122
116
- verifiers/v1/harnesses/rlm/harness.py,sha256=nX49hTis1x-tR5KYoWeNBKcqsKlThobeAX9JRaIu6Cc,13538
116
+ verifiers/v1/harnesses/rlm/harness.py,sha256=Nh4nBxxYDnRgRE-BljWBEnptX2JnDKAGVXCrAnpjm2w,13538
117
117
  verifiers/v1/harnesses/terminus_2/__init__.py,sha256=l1pwfg1HyVDEqT9efdnFWcXqaZwtKwe7TrplkyxZSA0,166
118
118
  verifiers/v1/harnesses/terminus_2/harness.py,sha256=cKQJluW01mkxEccTLFwSWsVMavyiwq_w-NA4Hb_JkGU,3052
119
119
  verifiers/v1/harnesses/terminus_2/program.py,sha256=X8MZdyItU3gbXGXnGOlJ9LWcUTnqIDaxlhkZvoRiqKY,2703
120
120
  verifiers/v1/harnesses/utils/__init__.py,sha256=eTS-Ft2HwoLiYn5u1t_KueLmaZB_W12cdYmcVsE-G5A,364
121
121
  verifiers/v1/harnesses/utils/compaction.py,sha256=DeY6CYLEsv7-vJm26sT2mRaPHu3W2ywiZhvFr_pi6Hg,10495
122
- verifiers/v1/harnesses/utils/core.py,sha256=tG07WGMiWFGCC3PwHndX2v9MLJVsn2EMsKwRKj3jwAg,19865
122
+ verifiers/v1/harnesses/utils/core.py,sha256=29Usc55cbLQE0vA8y05yk06sbjJMwYjOo2TmdwjPLE8,20397
123
123
  verifiers/v1/harnesses/utils/install.py,sha256=BDkkUVZ1brSzCrbQOvMO5mVIE2DsV2pE7rTC5yROYUw,2992
124
124
  verifiers/v1/harnesses/utils/launch.py,sha256=Kg6x4Fl5y48pSgPiupSBj5ehQkkupk5vihUUvHtpcO8,2894
125
125
  verifiers/v1/harnesses/utils/mcp.py,sha256=oNhKfLjAW-wScJcDIsW_HfuvKY-JkaGBBZrRLqgRK1g,7355
@@ -193,8 +193,8 @@ verifiers/v1/utils/scope.py,sha256=bzUEiWDOVdbj7dXOwGOlzsQ_-Xu0j9NR5TalQB-8TS8,8
193
193
  verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
194
194
  verifiers/v1/utils/trace_store.py,sha256=RsCDonGR-bs-tvEstcppiJm3jFmAdIiG83fA5KtCbAw,2801
195
195
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
196
- verifiers-0.3.2.dev152.dist-info/METADATA,sha256=GPTXqNo6x_F7kc4NNULLjsI0ZcqMJjqU-l9xJqqxm48,4161
197
- verifiers-0.3.2.dev152.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
198
- verifiers-0.3.2.dev152.dist-info/entry_points.txt,sha256=iugElcdWPKbQM7uFF0lZ8iUpHsNr17-BwEAAjJWxV3U,259
199
- verifiers-0.3.2.dev152.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
200
- verifiers-0.3.2.dev152.dist-info/RECORD,,
196
+ verifiers-0.3.2.dev153.dist-info/METADATA,sha256=vSm4TEvKtJXIhjsj8XEopHBKEMcpHh3sm0__6MRxgn8,4161
197
+ verifiers-0.3.2.dev153.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
198
+ verifiers-0.3.2.dev153.dist-info/entry_points.txt,sha256=iugElcdWPKbQM7uFF0lZ8iUpHsNr17-BwEAAjJWxV3U,259
199
+ verifiers-0.3.2.dev153.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
200
+ verifiers-0.3.2.dev153.dist-info/RECORD,,