fix(registrar): bound slow consistency runs

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a02b22-9638-76d2-bbff-b7ea1770b118
This commit is contained in:
tegwick 2026-08-23 11:58:43 +02:00
parent 7a15f1da21
commit 7b9fdaa734
4 changed files with 65 additions and 2 deletions

View file

@ -25,6 +25,7 @@ from repo_manager.parse.workplan import parse_workplan_file
from repo_manager.record_identity import scan_record_identities
LOCK_PATH = Path("/tmp/repo-manager-identifier-registrar.lock")
STATEHUB_TIMEOUT_SECONDS = 900
@dataclass
@ -382,7 +383,7 @@ def _run_statehub(command: list[str], *, env: dict[str, str]) -> subprocess.Comp
capture_output=True,
text=True,
check=False,
timeout=300,
timeout=STATEHUB_TIMEOUT_SECONDS,
env=env,
)
@ -573,7 +574,26 @@ def registrar_reconcile(
]
if bootstrap_empty_projection:
command.append("--bootstrap-empty-projection")
completed = _run_statehub(command, env=child_env)
try:
completed = _run_statehub(command, env=child_env)
except subprocess.TimeoutExpired as exc:
stdout = exc.stdout.decode() if isinstance(exc.stdout, bytes) else (exc.stdout or "")
stderr = exc.stderr.decode() if isinstance(exc.stderr, bytes) else (exc.stderr or "")
evidence["statehub_stdout_tail"] = stdout[-4000:]
evidence["statehub_stderr_tail"] = stderr[-2000:]
evidence["missing_after"] = _missing_identifiers(repo)
return RegistrarResult(
"failed",
evidence,
{
"code": "statehub_timeout",
"message": (
"State Hub reconciliation exceeded "
f"{STATEHUB_TIMEOUT_SECONDS} seconds"
),
},
cid,
)
evidence["statehub_exit_code"] = completed.returncode
evidence["statehub_stdout_tail"] = completed.stdout[-4000:]