diff --git a/hermes_cli/gateway_runtime.py b/hermes_cli/gateway_runtime.py index 09ab0a9aa6..50a08caf50 100644 --- a/hermes_cli/gateway_runtime.py +++ b/hermes_cli/gateway_runtime.py @@ -13,6 +13,12 @@ from urllib.parse import urlsplit if TYPE_CHECKING: from gateway.runtime_contract import RuntimeState +# Total startup deadline a client waits for a cold daemon. A cold boot imports the whole +# runtime, seeds the skill library and warms the turn machinery: ~10-20 s on a loaded +# 32-core CI runner with dozens of sibling boots, where 30 s tipped every attaching client +# of a parallel e2e shard into `starting: deadline`. A minute is still a verdict, not a hang. +DEFAULT_ENSURE_TIMEOUT = 60.0 + @dataclass(frozen=True) class GatewayEndpoint: @@ -168,7 +174,7 @@ def discover_gateway_endpoint(profile_home: str | Path, *, timeout: float = 2.0) return GatewayDiscovery("inaccessible", reason_code="invalid_control_peer") -def ensure_gateway_runtime(profile_home: str | Path, *, timeout: float = 30.0) -> GatewayDiscovery: +def ensure_gateway_runtime(profile_home: str | Path, *, timeout: float = DEFAULT_ENSURE_TIMEOUT) -> GatewayDiscovery: """Ensure once, never install/replace; pending remains pending at deadline. A successful service command or Popen is not session readiness. After an diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 5fd35ccee7..e3d4b3a32a 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -1886,8 +1886,9 @@ def cmd_chat(args): def cmd_gateway(args): """Gateway management commands.""" - _sync_bundled_skills_quietly() - + # `gateway run` seeds skills itself (run_bootstrap._start_gateway_configure_logging) inside its + # own home; a second pass here doubled a cold boot on a fresh home while every attaching client + # waited on the ensure deadline. Management verbs never need the library. from hermes_cli.gateway import gateway_command gateway_command(args) diff --git a/hermes_cli/subcommands/gateway.py b/hermes_cli/subcommands/gateway.py index d9c54edebe..94f0e3acdf 100644 --- a/hermes_cli/subcommands/gateway.py +++ b/hermes_cli/subcommands/gateway.py @@ -97,8 +97,8 @@ def build_gateway_parser( "4 authorization/profile mismatch; 5 deadline; 6 draining/update-paused; " "7 inaccessible/conflicting supervisor. Pending startup is not readiness.") _flag(gateway_ensure, "--json", help="Emit one credential-free JSON result (default)") - gateway_ensure.add_argument("--timeout", default="30", - help="Total startup deadline in seconds (default: 30)") + gateway_ensure.add_argument("--timeout", default="60", + help="Total startup deadline in seconds (default: 60)") gateway_ensure.set_defaults(func=cmd_gateway_ensure) gateway_start = gateway_subparsers.add_parser( diff --git a/website/docs/reference/cli-commands.md b/website/docs/reference/cli-commands.md index 0f38490074..3c249127fd 100644 --- a/website/docs/reference/cli-commands.md +++ b/website/docs/reference/cli-commands.md @@ -369,7 +369,7 @@ Use `hermes gateway run` instead of `hermes gateway start` — WSL's systemd sup ### Local runtime discovery and startup ```bash -hermes gateway ensure --json --timeout 30 +hermes gateway ensure --json --timeout 60 ``` `ensure` targets the active profile and emits one JSON object with `state`, @@ -377,7 +377,8 @@ hermes gateway ensure --json --timeout 30 local discovery reports compatible session readiness. Output contains no bootstrap tickets or bearer credentials. JSON is also the default without `--json`. -The timeout is a finite, positive total deadline in seconds (default `30`). An +The timeout is a finite, positive total deadline in seconds (default `60`, enough for a +cold daemon boot on a loaded host). An existing reservation or starting owner is waited for, not replaced. When absence is established, an existing service takes precedence; an unmanaged process is requested only when no service is found. This command never installs or rewrites