fix(coderd): add role param to agent RPC to prevent false connectivity by kacpersaw · Pull Request #22052 · coder/coder
…connectivity updates coder-logstream-kube and other tools that use the agent token to connect to the RPC endpoint were incorrectly triggering connection monitoring, causing false connected/disconnected timestamps on the agent. This led to VSCode/JetBrains disconnections and incorrect dashboard status. Add a 'role' query parameter to /api/v2/workspaceagents/me/rpc: - role=agent: triggers connection monitoring (default for the agent SDK) - any other value: skips connection monitoring (for logstream-kube, etc.) - omitted: triggers monitoring for backward compatibility with older agents The agent SDK now sends role=agent by default. A new Role field on the agentsdk.Client allows non-agent callers to specify a different role. Fixes #21625
kacpersaw
changed the title
fix: add role query parameter to agent RPC endpoint to prevent false connectivity updates
fix(codcerd): add role query parameter to agent RPC endpoint to prevent false connectivity updates
kacpersaw
changed the title
fix(codcerd): add role query parameter to agent RPC endpoint to prevent false connectivity updates
fix(coderd): add role query parameter to agent RPC endpoint to prevent false connectivity updates
kacpersaw
changed the title
fix(coderd): add role query parameter to agent RPC endpoint to prevent false connectivity updates
fix(coderd): add role param to agent RPC to prevent false connectivity
Address review feedback: - Remove exported Role field from agentsdk.Client (race condition risk) - Add role parameter to internal connectRPCVersion() - Add ConnectRPCWithRole() and ConnectRPC28WithRole() public methods - SDK defaults to not sending role (new callers don't trigger monitoring) - Workspace agent explicitly sends role=agent via ConnectRPC28WithRole - Update agent Client interface and agenttest mock
kacpersaw
deleted the
kacpersaw/add-role-to-agent-rpc
branch
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