chore(consistency): sync task status from DB [auto]

Updated by fix-consistency on 2026-09-04:
  - update .custodian-brief.md for rein-aharness

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a06ba0-10aa-7ea0-b20a-4f3fac39efe9
This commit is contained in:
custodian-sync 2026-09-04 11:00:20 +02:00
parent 7641fcde40
commit f01b765668
20 changed files with 1027 additions and 165 deletions

View file

@ -11,6 +11,12 @@ from typing import Any
import httpx
from rein_aharness.execution_cancel import (
ExecutionCancel,
ExecutionCancelled,
resolve_cancel,
)
_SAFE_RESPONSE_METADATA_KEYS = frozenset(
{
"finish_reason",
@ -50,20 +56,27 @@ class LLMConnectClient:
*,
model: str = "",
config: dict[str, Any] | None = None,
cancel: ExecutionCancel | None = None,
) -> str:
run_config = dict(config or {})
if model and "model_name" not in run_config:
run_config["model_name"] = model
run_config.setdefault("timeout_seconds", int(self.timeout_seconds))
payload: dict[str, Any] = {"prompt": prompt, "config": run_config}
url = f"{self.base_url}/execute"
guard = resolve_cancel(cancel)
if guard is not None:
guard.check()
try:
resp = httpx.post(
f"{self.base_url}/execute",
json=payload,
timeout=self.timeout_seconds,
)
resp = self._post(url, payload, guard)
except ExecutionCancelled:
raise
except httpx.HTTPError as exc:
if guard is not None and guard.cancelled:
raise ExecutionCancelled(guard.reason or "cancelled") from None
raise LLMConnectError(f"llm-connect request failed: {exc}") from exc
if guard is not None:
guard.check()
if resp.status_code >= 400:
raise LLMConnectError(_llm_connect_error_text(resp))
try:
@ -76,6 +89,18 @@ class LLMConnectClient:
raise LLMConnectError("llm-connect response missing string content")
return content
def _post(
self,
url: str,
payload: dict[str, Any],
guard: ExecutionCancel | None,
) -> httpx.Response:
if guard is None:
return httpx.post(url, json=payload, timeout=self.timeout_seconds)
with httpx.Client(timeout=self.timeout_seconds) as client:
guard.register_stop(client.close)
return client.post(url, json=payload)
def _llm_connect_error_text(resp: httpx.Response) -> str:
"""Keep llm-connect's safe cause without copying an upstream response blob."""