Skip to content

Add external facing gql-ws for agent websockets#3438

Merged
maciaszczykm merged 19 commits intomasterfrom
agent-facing-gql-ws
Apr 17, 2026
Merged

Add external facing gql-ws for agent websockets#3438
maciaszczykm merged 19 commits intomasterfrom
agent-facing-gql-ws

Conversation

@michaeljguarino
Copy link
Copy Markdown
Member

@michaeljguarino michaeljguarino commented Apr 16, 2026

This has a more stable, usable websocket client (hopefully), so should be a better solve for delivering these pushes into our agents

Fixes PROD-4699 PROD-4700

Test Plan

unit test

Checklist

  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a meaningful title and summary to convey the impact of this PR to a user.

Plural Flow: console

@michaeljguarino michaeljguarino requested a review from a team April 16, 2026 15:57
@michaeljguarino michaeljguarino added the enhancement New feature or request label Apr 16, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 16, 2026

Greptile Summary

This PR introduces an external-facing graphql-transport-ws WebSocket endpoint (/ext/socket/gql-ws) for agent communication, backed by a new ExternalGraphqlWSSocket that authenticates via deploy token. It adds a deploy_agent_notification GQL subscription that pushes resource notifications scoped to the authenticated cluster, wired into the existing PubSub broadcast pipeline.

The only notable concern is that event_to_resource uses a prefix match on \"service\" <> _, which means \"service.manifests\" events (manifest-fetch requests) are forwarded to the subscription as :service notifications alongside genuine \"service.event\" updates.

Confidence Score: 5/5

Safe to merge — the only finding is a P2 concern about an overly broad prefix match that may or may not be intentional.

Auth is correctly enforced via deploy token and cluster context. The new socket, schema subscription, and broadcast integration all follow existing patterns faithfully. The one open question (service.manifests matching) is a logic style issue that doesn't break the primary use case.

lib/console/deployments/pubsub/consumers/broadcast.ex — verify whether service.manifests events should be forwarded as :service notifications.

Important Files Changed

Filename Overview
lib/console/deployments/pubsub/consumers/broadcast.ex Adds do_gql_broadcast to fan out cluster room events to Absinthe subscriptions; event_to_resource pattern could unintentionally forward service.manifests events as :service notifications.
lib/console/external_graphql.ex Adds subscription block importing public_deployment_subscriptions to the external-facing GraphQL schema.
lib/console/graphql/deployments.ex Adds agent_notification_resource enum, deploy_agent_notification object, and public_deployment_subscriptions with cluster-auth config; types and auth logic look correct.
lib/console_web/channels/graphqlws_socket.ex Adds ExternalGraphqlWSSocket authenticated via deploy token; mirrors existing GraphqlWSSocket pattern correctly.
lib/console_web/endpoint.ex Registers the new ExternalGraphqlWSSocket at /ext/socket/gql-ws with graphql-transport-ws subprotocol; no path conflict with existing /ext/socket route.

Reviews (1): Last reviewed commit: "Add external facing gql-ws for agent web..." | Re-trigger Greptile

Comment thread lib/console/deployments/pubsub/consumers/broadcast.ex
This has a more stable, usable websocket client (hopefully), so should be a better solve for delivering these pushes into our agents
@linear
Copy link
Copy Markdown

linear bot commented Apr 16, 2026

@maciaszczykm maciaszczykm merged commit 80a144b into master Apr 17, 2026
42 checks passed
@michaeljguarino michaeljguarino deleted the agent-facing-gql-ws branch April 17, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants