Skip to content

fix(agent): stop re-probing endpoints that blackhole TCP connects (salvage #71282) - #77847

Merged
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
kshitijk4poor:salvage-71282-blackhole
Aug 3, 2026
Merged

fix(agent): stop re-probing endpoints that blackhole TCP connects (salvage #71282)#77847
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
kshitijk4poor:salvage-71282-blackhole

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Salvages #71282 by @rlaope — the PR's two real commits squashed with authorship preserved. Fixes #71281.

Context — what this fixes, for whom

Anyone with a configured endpoint that's routable but dead (the classic case: a corp-LAN model server address while off-VPN): TCP SYNs blackhole — no SYN-ACK, no RST, no ICMP — so every probe in the model-metadata waterfall waits out its FULL connect timeout. Across detect_local_server_type (4 legs), fetch_endpoint_model_metadata (2 candidates), and the per-model probes, one dead host stalls startup 20+ seconds.

The fix: a module-level blackhole cache keyed host:port, populated when any probe observes a ConnectTimeout (read timeouts deliberately excluded — an accepted connection is not a blackhole), consulted at the top of each guarded function, 30s TTL so VPN recovery is picked up without a restart. A blackholed leg also aborts the remaining waterfall legs instead of letting each stall in turn.

Why a salvage rather than arming the original

The original is content-perfect and nearly current (1 behind, MERGEABLE/CLEAN) — but its branch carries two merge commits, and GitHub refuses rebase-merge on branches with merges ("This branch can't be rebased"). Squash-picked the two real commits (5c5abc1 + 3fc03dd); content verified identical via merge-tree.

Review notes (dossier findings, all resolved by the author's own rebase)

  • Guard ordering on the current branch: blackhole check → disk L2 → HTTP waterfall — coexists correctly with main's disk-L2 probe cache
  • _ensure_requests() preserved in fetch_endpoint_model_metadata
  • The author also dropped the earlier HERMES_ENDPOINT_BLACKHOLE_TTL env var in their second commit (config-policy compliant)
  • Unsynchronized module dict matches the file's established cache pattern

Verification

  • tests/agent/test_endpoint_blackhole.py: 22 passed (cache TTL, host:port keying, per-function guards, refused-vs-blackholed negatives)
  • Full merge-tree verification: 108 agent metadata tests passed; broader tests/agent/ run: 90 passed, 2 skipped
  • Mutation check: revert model_metadata.py to main → 22 errors; restore → 22 passed
  • ruff clean

Closes #71282 (superseded by this salvage — original author credited via squash authorship).

Salvage of NousResearch#71282 (Fixes NousResearch#71281): a routable-but-dead endpoint (corp
LAN address while off-VPN) blackholes TCP SYNs, so every probe in the
model-metadata waterfall waits out its full connect timeout — 20+
seconds of stall per startup across detect_local_server_type,
fetch_endpoint_model_metadata, and the per-model probes.

A module-level blackhole cache keyed on host:port is populated when
any probe observes a ConnectTimeout (httpx or requests; read timeouts
deliberately excluded — an accepted connection is not a blackhole) and
consulted at the top of each guarded function. 30s TTL: long enough to
collapse one startup burst, short enough that VPN recovery is picked
up without a restart. Guard ordering: blackhole check -> disk L2 ->
HTTP waterfall, and a blackholed leg aborts the remaining legs instead
of letting each stall in turn.

Squash of the PR's two real commits (the branch's merge commits made
it un-rebase-merge-able; content verified identical via merge-tree).
@kshitijk4poor
kshitijk4poor enabled auto-merge (rebase) August 3, 2026 16:17
@kshitijk4poor
kshitijk4poor merged commit 1f8acb3 into NousResearch:main Aug 3, 2026
35 checks passed
@kshitijk4poor
kshitijk4poor deleted the salvage-71282-blackhole branch August 5, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Endpoints that blackhole TCP stall startup ~60s — probe waterfall pays the timeout once per leg

2 participants