Skip to content

fix(directsdk): a relay starts without asking DNS for its own name - #412

Closed
metahacker wants to merge 2 commits into
NousResearch:mainfrom
metahacker:fix/directsdk-relay-no-reverse-dns
Closed

metahacker wants to merge 2 commits into
NousResearch:mainfrom
metahacker:fix/directsdk-relay-no-reverse-dns

Conversation

@metahacker

Copy link
Copy Markdown
Contributor

Found while running the plugin's tests on our macOS host. It is cut from main (e726eb7) and touches claude-subscription-directsdk/ only.

Before

Every model call starts a loopback relay (admission._Server, an http.server.HTTPServer). HTTPServer.server_bind looks up the bound address's name with socket.getfqdn, only to fill server_name, which the relay never reads. On that macOS host the lookup of 127.0.0.1 took 35 s. So the first call of each process waited 35 s before Claude Code started; later calls hit the resolver's cache.

macOS 26.6.2, a relay's start, twice in one process First Second
main 35.01 s 0.00 s
This branch 0.00 s 0.00 s

After

_Server.server_bind binds as socketserver.TCPServer does and sets server_name and server_port from the bound address, without the lookup. The relay's URL was already built from the literal 127.0.0.1 and the port.

Tests

tests/test_admission_bind.py (new) makes socket.getfqdn stall for 3 s and starts a relay. On main it fails: the relay took 3.0 s. With this branch it passes.

Gate, Linux, at 308882f 2.1.292 2.1.322 2.1.323
Full plugin suite 589 passed 589 passed 589 passed
evals/ci.sh exit 0 exit 0 exit 0

The head, 67d5f36, changes only the wording of a comment, the test's docstring and the changelog line after that gate.

Reviews

Grok and GPT (codex review): no findings. Grok checked that nothing reads server_name; the only stdlib reader is CGIHTTPRequestHandler.

Not in this PR

Windows: not run for this branch. macOS: the relay timing above, not the suite.

@teknium1

Copy link
Copy Markdown
Contributor

Thank you @metahacker! This landed on main through #445, which stacked the 15 reviewed Claude subscription fixes on current main so the shared CHANGELOG lines conflicted only once. Your commits are kept as written, with your authorship; this PR's tip is 7e66a71. hermes plugins install NousResearch/hermes-official-plugins#claude-subscription-directsdk --force gets it now; hermes plugins update claude-subscription-directsdk will too once the catalog pin moves (in progress).

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.

2 participants