143 lines
3.5 KiB
Python
143 lines
3.5 KiB
Python
#!/usr/bin/env python3
|
|
# ruff: noqa: F401
|
|
"""Run durable Codex and Claude workers from Hermes' authoritative Kanban."""
|
|
|
|
from __future__ import annotations
|
|
|
|
# The facade keeps the deployed entry point and compatibility API stable while
|
|
# domain modules own each independently testable reliability boundary.
|
|
import os
|
|
import sqlite3
|
|
import subprocess
|
|
import uuid
|
|
|
|
import cli_lane_goal
|
|
from cli_lane_capabilities import (
|
|
KanbanCapabilities,
|
|
_explicit_keyword,
|
|
detect_kanban_capabilities,
|
|
initialize_kanban_capabilities,
|
|
kanban_capabilities,
|
|
readiness_issue,
|
|
refresh_kanban_capabilities,
|
|
runtime_health,
|
|
)
|
|
from cli_lane_board import (
|
|
_board_call,
|
|
_external,
|
|
_record_board_access_error,
|
|
_resolve_workspace,
|
|
_task_context,
|
|
_task_value,
|
|
)
|
|
from cli_lane_config import (
|
|
ARTIFACT_GC_INTERVAL_SECONDS,
|
|
ARTIFACT_RETENTION_AGE_SECONDS,
|
|
ARTIFACT_RETENTION_BYTES,
|
|
ARTIFACT_RETENTION_COUNT,
|
|
BOARD_CORRUPTION_ERRORS,
|
|
CLAUDE_BIN,
|
|
CODEX_BIN,
|
|
DATA_ROOT,
|
|
DEFAULT_CLAIM_TTL,
|
|
DEFAULT_MAX_RUNTIME,
|
|
MAX_TERMINAL_RECORD_BYTES,
|
|
PROVIDER_HEALTH_PATHS,
|
|
QUARANTINE_HASH_BYTES,
|
|
RESULT_SCHEMA,
|
|
RESULT_SCHEMA_PATH,
|
|
STATE_ROOT,
|
|
ProcessResult,
|
|
Route,
|
|
TerminalFinalizationPending,
|
|
TerminalIdentity,
|
|
canonical_run_id,
|
|
utc_now,
|
|
)
|
|
from cli_lane_dispatch import claim_ready, main, recover_orphans
|
|
from cli_lane_evidence import (
|
|
_persist_conflict_evidence,
|
|
_persist_prepared_evidence,
|
|
_rename_noreplace,
|
|
_retire_terminal_entry,
|
|
_same_terminal_document,
|
|
_terminal_document_digest,
|
|
_terminal_evidence_path,
|
|
_terminal_evidence_valid,
|
|
_write_json_noreplace,
|
|
)
|
|
from cli_lane_execution import execute_claim
|
|
from cli_lane_files import (
|
|
_candidate_path,
|
|
_fsync_directory,
|
|
_result_path,
|
|
_terminal_evidence_identity,
|
|
_terminal_identity,
|
|
_terminal_path,
|
|
atomic_json,
|
|
load_json,
|
|
state_path,
|
|
)
|
|
from cli_lane_finalization import (
|
|
_discard_evidence,
|
|
_finalize_document_db,
|
|
_finalize_terminal_record,
|
|
_promote_prepared_evidence,
|
|
_recover_exact_run,
|
|
_resolve_pending_after_winner,
|
|
_retire_snapshot,
|
|
_retire_snapshot_after_db,
|
|
)
|
|
from cli_lane_prompt import (
|
|
_event_payload,
|
|
_extract_json,
|
|
build_prompt,
|
|
git_handoff,
|
|
workspace_artifacts,
|
|
)
|
|
from cli_lane_provider import (
|
|
_base_env,
|
|
_claude_command,
|
|
_codex_command,
|
|
_descendant_processes,
|
|
_process_identity_matches,
|
|
_process_record,
|
|
_signal_worker_tree,
|
|
_terminate_worker_process,
|
|
run_provider,
|
|
stream_process,
|
|
)
|
|
from cli_lane_quarantine import _quarantine_terminal
|
|
from cli_lane_records import (
|
|
_load_small_json,
|
|
_load_terminal_json,
|
|
_open_small_json_snapshot,
|
|
_open_terminal_recovery_snapshot,
|
|
_open_terminal_snapshot,
|
|
_persist_candidate,
|
|
_read_bounded,
|
|
_terminal_record_valid,
|
|
_write_terminal_record,
|
|
)
|
|
from cli_lane_recovery import (
|
|
_drain_retirement_staging,
|
|
_has_pending_finalization,
|
|
_recover_prepared_finalizations,
|
|
_recover_retirement_staging,
|
|
_restore_staged_terminal_authority,
|
|
_staged_terminal_authority,
|
|
_terminal_entry_absent,
|
|
recover_pending_finalizations,
|
|
)
|
|
from cli_lane_retention import (
|
|
_artifact_gc_candidates,
|
|
_unlink_artifact_if_same,
|
|
gc_lane_artifacts,
|
|
maybe_gc_lane_artifacts,
|
|
)
|
|
from cli_lane_routing import fresh_unavailable_provider, parse_assignee, select_route
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|