Skip to content

pilotctl: send-message asks for the daemon's info once - #511

Merged
TeoSlayer merged 2 commits into
mainfrom
perf/pilotctl-one-info
Oct 8, 2026
Merged

TeoSlayer merged 2 commits into
mainfrom
perf/pilotctl-one-info

Conversation

@TeoSlayer

Copy link
Copy Markdown
Collaborator

Summary

pilotctl send-message fetched the daemon's info reply for its first-contact check, then maybeAutoHandshake → daemonHasFeature fetched a second one just to read features. The features now come from the first reply.

The info reply lists every peer and connection, so its cost scales with the node's peer table:

Peers CLI parse (CPU) CLI allocations Daemon encode
57 (a laptop) 0.08 ms 29 KB —
5,400 (a service agent) 7.5 ms 2.9 MB 1.6 ms
7,800 11 ms 4.2 MB —

(encoding/json into map[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

  • Same decisions: the feature set is the one the daemon reported, from a reply fetched in the same command.
  • New test TestSendMessageAsksForInfoOnce counts info requests the fake daemon receives during a full send-message: 1 with this change, 2 on main.
  • go build ./..., go vet ./cmd/pilotctl/, go test ./cmd/pilotctl/ pass.

🤖 Generated with Claude Code

Teo Calin and others added 2 commits October 6, 2026 02:22
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>
@TeoSlayer
TeoSlayer merged commit 9058a84 into main Oct 8, 2026
15 checks passed
@TeoSlayer
TeoSlayer deleted the perf/pilotctl-one-info branch October 8, 2026 08:52
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.

1 participant