fix: set Role on agentsdk.Client to skip connection monitoring#168
Merged
fix: set Role on agentsdk.Client to skip connection monitoring#168
Conversation
230bf5f to
a784d6c
Compare
Closed
1 task
coder-logstream-kube connects to the agent RPC endpoint using the agent
token, which triggers connection monitoring in coderd and causes false
connectivity state changes (disconnected_at/first_connected_at updates).
This leads to VSCode/JetBrains disconnections and incorrect dashboard status.
coder/coder PR #22052 added a role query parameter to the RPC endpoint.
We now check the server version via the buildinfo endpoint: if the server
is v2.31.0 or newer (which includes the role support), we use
ConnectRPC28WithRole("logstream-kube") to skip connection monitoring.
For older servers, we fall back to ConnectRPC20.
Also migrates cdr.dev/slog to cdr.dev/slog/v3 as required by the updated
coder SDK, and adds the ReportBoundaryLogs stub to the test fake.
Fixes coder/coder#21625
a784d6c to
43f81cd
Compare
deansheather
approved these changes
Feb 20, 2026
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
coder-logstream-kube connects to the agent RPC endpoint using the agent token, which triggers connection monitoring in coderd and causes false connectivity state changes (
disconnected_at/first_connected_atupdates). This leads to VSCode/JetBrains disconnections and incorrect dashboard status.Changes
/api/v2/buildinfoendpoint to determine capabilitiesConnectRPC28WithRole("logstream-kube")to skip connection monitoringConnectRPC20(no role sent)github.com/coder/coder/v2to include theWithRoleAPIcdr.dev/slog→cdr.dev/slog/v3(required by updated SDK)ReportBoundaryLogsstub to test fake for updated proto interfaceBackward-compatible: older coderd versions that don't support the role parameter will use
ConnectRPC20as before.Fixes coder/coder#21625