feat: add durable success-first modelhub agent

This commit is contained in:
CoolBoy
2026-08-15 19:24:26 +08:00
parent 91d1d3d87d
commit 4260793c03
22 changed files with 2420 additions and 86 deletions

View File

@@ -3,6 +3,7 @@ from __future__ import annotations
import importlib.util
import os
import unittest
import tempfile
from pathlib import Path
from unittest.mock import patch
@@ -28,6 +29,16 @@ class HostedAgentEntrypointTests(unittest.TestCase):
command = ENTRYPOINT._worker_command()
self.assertEqual(["--max-submits-per-run", "0"], command[-2:])
self.assertIn("--state-sync", command)
def test_readiness_file_is_separate_from_liveness(self) -> None:
with tempfile.TemporaryDirectory() as temporary_dir:
path = Path(temporary_dir) / "readiness.json"
path.write_text('{"ready": false, "reason": "state_sync_unhealthy"}', encoding="utf-8")
with patch.object(ENTRYPOINT, "READINESS_PATH", path):
readiness = ENTRYPOINT._readiness()
self.assertFalse(readiness["ready"])
self.assertEqual("state_sync_unhealthy", readiness["reason"])
if __name__ == "__main__":