Repository navigation
pilotctl: send-message asks for the daemon's info once - #511
Merged
Merged
Conversation
The auto-handshake read the daemon's features from a second info request, although send-message had fetched one a moment earlier for its first-contact check. The reply lists every peer and connection; at 5,400 peers, parsing it costs the CLI 7.5 ms of CPU and 2.9 MB of allocations. Keep the features from the first reply. Co-Authored-By: Claude Opus 5.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.
Summary
pilotctl send-messagefetched the daemon'sinforeply for its first-contact check, thenmaybeAutoHandshake→daemonHasFeaturefetched a second one just to readfeatures. The features now come from the first reply.The
inforeply lists every peer and connection, so its cost scales with the node's peer table:(
encoding/jsonintomap[string]interface{}, as the driver does; Apple M-series.)The second request happened on every send to an agent in the trusted list (
list-agents,pilot-mom) and to any public peer not yet trusted; sends to already-trusted peers return before the feature check and were unaffected.Functionality
TestSendMessageAsksForInfoOncecountsinforequests the fake daemon receives during a fullsend-message: 1 with this change, 2 onmain.go build ./...,go vet ./cmd/pilotctl/,go test ./cmd/pilotctl/pass.🤖 Generated with Claude Code