libpilot: register the webhook plugin in the embedded daemon - #39
Merged
Conversation
PilotSetWebhook forwards to the daemon's set-webhook IPC command, which calls Daemon.SetWebhookURL. That method returns immediately when no WebhookManager is registered, so on an embedded daemon the call was acknowledged and then discarded: callers got a success reply and no events were ever delivered. Construct and register the webhook plugin alongside the trust, handshake and policy plugins, and install the daemon-side adapter so SetWebhookURL has a target. Composition moves out of the cgo file into plugins.go so it can be exercised from a Go test (test files cannot import "C"), and the "mirrors cmd/daemon composition root" comment is replaced with the actual set plus why skillinject and the app-store supervisor are left out of a daemon running inside a host application process. Tests cover the registered set and assert that SetWebhookURL now reaches the plugin, in both the set and clear directions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What
PilotSetWebhookforwards to the daemon'sset-webhookIPC command, which callsDaemon.SetWebhookURL. That method returns immediately when noWebhookManageris registered — and the embedded daemon registered only three of the daemon's plugins (trustedagents, handshake, policy), never webhook. Result: the call was acknowledged with a success reply and then discarded, and no events were ever delivered.Changes
webhook.NewService("")alongside the existing three plugins, and install the daemon-sideWebhookManageradapter soSetWebhookURLhas a target.plugins.go(noimport "C"), because Go test files cannot compile against a cgo import — this is what makes the composition testable at all.skillinjectand the app-store supervisor are deliberately not part of a daemon running inside a host application process.Tests
zz_plugins_test.go:trustedagents, handshake, policy, webhookDaemon.SetWebhookURLnow reaches the plugin (observed via the URL the plugin persists), in both the set and clear directionsBoth webhook tests fail without the registration and pass with it.
Notes
github.com/pilot-protocol/webhook v0.2.0— the same versionpilotprotocolitself depends on.go build ./... && go test -race -count=1 ./...green.🤖 Generated with Claude Code