Repository navigation
Find the API node when TAILSCALE_HOSTNAME names the desk, not a number - #237
Open
david-hummingbot wants to merge 3 commits into
Open
david-hummingbot wants to merge 3 commits into
david-hummingbot wants to merge 3 commits into
Conversation
`tailnet_api_peers` matched `hummingbot-api` plus a numeric suffix, because
that is the only suffix Tailscale itself appends when a name is taken. But
TAILSCALE_HOSTNAME is a setting, and naming the API per desk --
`hummingbot-api-cornell`, `hummingbot-api-eu` -- is the ordinary way to run
more than one of these.
For those, the search found nothing. "Nothing" is the branch that warns
! No hummingbot-api node is visible on this tailnet yet.
→ Deploy it on that machine first (its setup joins the tailnet), or
→ enter the name/address it is reachable at.
about a node sitting in plain sight in `tailscale status`, and then asks the
operator to type the name it had just declined to recognise. Driven through
the wizard against a tailnet whose only API node was
`hummingbot-api-cornell`, the same run now reports
✓ Found it on your tailnet: hummingbot-api-cornell
and asks nothing. Widening the suffix cannot make the earlier silent-wrong-
node failure worse: more matches means the operator is shown the list and
picks, which is the one outcome that is never wrong.
|
…isions Two things the widened suffix in this branch exposed. Greptile's point first: widening `-[0-9]+` to `-.+` widens what can reach the count==1 branch, and that branch selects silently. A lone `hummingbot-api-staging`, a node someone rebuilt, another desk's API -- each is alone on a tailnet where the intended one has not joined yet, and each is now accepted and written into config.yml with only a "Found it" to show for it. The wrong node is very likely running the same software, so it answers, and the mistake arrives as "401 Incorrect username or password" against a password that was never wrong -- the exact failure #231 set out to stop. Being the only match is not evidence of being the right match. So count==1 splits. The unsuffixed `hummingbot-api` is still taken silently: it is the name hummingbot-api's own setup asks for, and there is nothing to choose between. A suffixed lone match is shown and confirmed, pre-filled, so Enter accepts it when it is right -- which is the common case and the whole point of the search. It costs a keystroke and it means no name the operator never chose lands in config.yml unseen. Second, the pick-one message asserted "Tailscale adds -1, -2 ... when a name is taken, so these are different machines. Pick the one you just deployed." Running several APIs on purpose -- hummingbot-api-1, hummingbot-api-2 alongside the default -- is an ordinary deployment, and there those suffixes are chosen names, not collision artifacts. The old wording told that operator their own naming was an accident, and "the one you just deployed" is the wrong instruction anyway when Condor is being pointed at an instance that has been up for weeks. It now covers both origins and asks which node this Condor should talk to. Plus the assertions over the helper this branch described but never committed: 16 of them, sourcing the real function out of the script with a stubbed `tailscale` rather than restating the regex in Python (a copy of the regex asserts only that the copy matches itself). Four fail against the old `-[0-9]+`. Full suite 5109 passed, 23 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`black --check .` is a CI gate and the file I added in the previous commit had not been through it. Formatting only; the 16 assertions are unchanged and still pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tailnet_api_peers(added in #231) matchedhummingbot-apiplus a numeric suffix, because that is the only suffix Tailscale itself appends when a name is taken. ButTAILSCALE_HOSTNAMEis a setting, and naming the API per desk —hummingbot-api-cornell,hummingbot-api-eu— is the ordinary way to run more than one.For those the search found nothing, and nothing is the branch that warns:
…about a node sitting in plain sight in
tailscale status, and then asks the operator to type the name it had just declined to recognise.A lone match is not a confirmed match
Widening the suffix also widens what reaches the
count == 1branch, and that branch selected silently (thanks @greptile-apps for catching it). A stale node, a colleague's staging box, another desk's API — each is alone on a tailnet the intended machine has not joined yet, and each would be accepted and written intoconfig.ymlwith only a✓ Found itto show for it. The wrong node is very likely running the same software, so it answers, and the mistake arrives as401 Incorrect username or passwordagainst a password that was never wrong — the exact failure #231 set out to stop.So
count == 1splits:hummingbot-api(unsuffixed)hummingbot-api-cornell(suffixed)It costs one keystroke in the common case, and no name the operator never chose lands in
config.ymlunseen."Pick the one you just deployed" was wrong guidance
The multi-match message asserted:
Running several APIs on purpose —
hummingbot-api-1,hummingbot-api-2alongside the default — is an ordinary deployment, and there those suffixes are chosen names, not collision artifacts. That wording told such an operator their own naming was an accident. And "the one you just deployed" is the wrong instruction regardless when Condor is being pointed at an instance that has been up for weeks. Now:Verification
Driven end to end through the real wizard in a container, against a tailnet whose only API node was
hummingbot-api-cornell(tailscalestubbed, a stand-in API bound off-loopback so the localhost probe could not see it). Before:After:
…and Enter is the whole answer. Both runs end with
✓ API reachable and credentials acceptedand the sameconfig.yml. All four branches were also rendered through the real decision block with stubbed prompts.tests/test_setup_tailnet_peers.pyadds 16 assertions over the helper. They source the real function out ofsetup-environment.shwith a stubbedtailscaleahead of it onPATH, rather than restating the regex in Python — a copy of the regex asserts only that the copy matches itself. Four of them fail against the old-[0-9]+, confirmed by reverting it. They cover the numeric fleet (hummingbot-api+-1+-2, which must reach the pick-one branch and never auto-select), desk names, and the nodes that must not be claimed (condor-hackathon,condor1,hummingbot-apis,my-hummingbot-api).Full suite: 5109 passed, 23 skipped.
(An earlier revision of this description claimed 13 stubbed assertions; they were ad-hoc and never committed. They are in the tree now.)
🤖 Generated with Claude Code