fix(agents): keep webhook paths service-agnostic#4366
Open
icehaunter wants to merge 3 commits into
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4366 +/- ##
==========================================
- Coverage 59.73% 55.97% -3.76%
==========================================
Files 290 245 -45
Lines 28579 24870 -3709
Branches 7768 6890 -878
==========================================
- Hits 17072 13922 -3150
+ Misses 11490 10934 -556
+ Partials 17 14 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Motivation
Webhook registration and dispatch were still carrying an old assumption from the closed tenanted cloud implementation: service ids could be prepended to Durable Streams paths and then stripped before runtime delivery. In the OSS agents-server that is the wrong boundary. The service or tenant route belongs in the configured Durable Streams base URL, while subscription patterns, explicit streams, wake streams, webhook wake payloads, and callback acks should all refer to logical stream paths only.
This avoids leaking cloud tenancy details into OSS paths and fixes webhook subscriptions created through agents-server/runtimes without reintroducing service-prefixed stream names.
The end-to-end cloud path also exposed a second boundary issue: Durable Streams calls the agents-server webhook forward endpoint without the cloud bearer token, because DS authenticates the delivery with a webhook signature instead. The OSS server therefore needs to persist the DS signing secret and validate signed deliveries before forwarding them to a runtime.
What changed
pattern,streams,wake_stream, and ack stream fields by stripping only leading slashes at the Durable Streams boundary.agents-runtimewebhook payloads still use paths like/chat/one/main.serviceIdinput for cloud wrappers, while deprecating path conversion hooks so existing adapters can still typecheck.webhook_secretreturned by Durable Streams subscription creation and verifyWebhook-Signaturebefore forwarding webhook deliveries to runtimes.Authorizationheader to Durable Streams.agents-runtimesend callback claim tokens usingelectric-claim-tokenwhen server auth headers are configured, preserving the configured cloudAuthorizationheader.@electric-ax/agents-serverand@electric-ax/agents-runtime.Cloud compatibility
Stratovolt already builds each tenant Durable Streams URL as
.../v1/stream/{serviceId}, which matches this boundary: service id in the base URL, logical paths in the subscription body. The cloud wrapper can keep using its routing adapter for URL routing because the adapter still receivesserviceId; the deprecated path conversion hooks are simply no longer used by agents-server subscription rewriting.This does need to be paired with a cloud-side auth relaxation for
POST /_electric/webhook-forward/*: that endpoint must be routable to the tenant using theservicerouting hint without requiring the normal bearer token. The security check moves to the OSS agents-server, which validates the Durable StreamsWebhook-Signatureagainst the persisted subscription secret before forwarding anything to the runtime. Other cloud agents endpoints should keep the existing bearer auth.