Skip to content

feat: report agent connection methods and app identities - #30467

Merged
EhabY merged 1 commit into
mainfrom
feat/agent-connection-methods
Oct 14, 2026
Merged

EhabY merged 1 commit into
mainfrom
feat/agent-connection-methods

Conversation

@EhabY

@EhabY EhabY commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Agents now report how a connection was made and which app made it, completing the agent side of the Completing Scalable IDE Session Tracking RFC. Follows merged #30466, which added the matching connection log fields.

Closes CLIENT-1037.

What changes

Agent API v2.13

Connection gains two fields and the nested Method enum. Field numbers for existing fields are unchanged. The METHOD_ prefix follows the protobuf enum naming guidance: enum values share the Connection scope with Type.

Field Number Notes
app_name 9 The client app, such as cursor. Empty when unknown.
connection_method 10 METHOD_SSH, METHOD_RECONNECTING_PTY, or METHOD_PORT_FORWARDING (reserved; not sent yet).
type 3 Deprecated, superseded by connection_method and app_name. Agents no longer send it; coderd still reads it from agents before v2.13.

API v2.12 shipped in v2.38.0; this PR requests v2.13 through ConnectRPC213WithRole. Released servers predating the new fields reject that RPC version before receiving reports, so dual-send provides no compatibility benefit. Advance the minor if it ships without this handler.

Agent

  • SSH and reconnecting PTY handlers set the method themselves, so a client-supplied app name can't change it.
  • SSH sessions report the app from CODER_SSH_SESSION_TYPE. Sessions without one still count as SSH but report no app.
  • Disconnect reports repeat the connect report's method, app, and client session ID.

Coderd

  • If a report has no method, it comes from an agent before v2.13, so coderd maps its type as before: VS Code and JetBrains become SSH with that app.
  • If a report has a method, coderd uses the method and the normalized app name, and ignores type.
  • Unknown methods are rejected, so they are never logged as SSH. The RPC connection stays open.

Compatibility

Agent Coderd Result
New New Method and app logged as reported.
Old New Method and app recovered from type, as before.
New Old Not supported, as with every minor bump: coderd before v2.13 rejects the agent's API version.

Stack

Follows #30466 (merged). Replaces #29675. Out of scope: JetBrains per-product names and a raw port-forward producer.

Review guide and line breakdown

Counts are relative to main.

Category Added Deleted Where to look
Source +84 −40 Reporter, SSH and PTY handlers, agent.proto, sdk2db ingestion, v2.13 client plumbing
Generated +708 −620 agent/proto/agent.pb.go
Tests +154 −52 Ingestion mapping, reporter, real agent reporting through coderd, agent test-client shim
Total +946 −712

Generated with Coder Agents on behalf of @EhabY.

@EhabY
EhabY added this pull request to stack #30469 October 7, 2026 14:01
@EhabY
EhabY force-pushed the feat/agent-connection-methods branch from 98e6a68 to 2ee229b Compare October 7, 2026 17:33
@EhabY
EhabY force-pushed the feat/agent-connection-methods branch 2 times, most recently from 0334811 to 3b02590 Compare October 8, 2026 14:36
@EhabY
EhabY force-pushed the feat/agent-connection-methods branch 3 times, most recently from 79e5cf4 to 527a142 Compare October 9, 2026 12:27
@EhabY
EhabY force-pushed the feat/agent-connection-methods branch from 527a142 to 8e4a0ba Compare October 12, 2026 12:42
Base automatically changed from feat/connection-log-methods to main October 12, 2026 12:56
@EhabY
EhabY force-pushed the feat/agent-connection-methods branch 3 times, most recently from 13db794 to 5319db6 Compare October 12, 2026 13:19
@EhabY
EhabY marked this pull request as ready for review October 12, 2026 13:19
@EhabY
EhabY force-pushed the feat/agent-connection-methods branch 3 times, most recently from d2199df to 9d1fb02 Compare October 12, 2026 21:01
@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

CLIENT-1037

Comment thread coderd/workspaceagentsrpc_test.go Resolved
@EhabY
EhabY force-pushed the feat/agent-connection-methods branch from 98590bc to e61109c Compare October 14, 2026 10:25
@EhabY
EhabY merged commit f573ec3 into main Oct 14, 2026
29 checks passed
@EhabY
EhabY deleted the feat/agent-connection-methods branch October 14, 2026 10:54
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants