Skip to content

feat: separate connection log methods from app names - #30466

Merged
EhabY merged 4 commits into
mainfrom
feat/connection-log-methods
Oct 12, 2026
Merged

EhabY merged 4 commits into
mainfrom
feat/connection-log-methods

Conversation

@EhabY

@EhabY EhabY commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Connection logs now record how a connection was made (connection_method) separately from which app made it (app_name), as specified in the Completing Scalable IDE Session Tracking RFC. Storage, the HTTP API, search filters, and the UI move to the new fields. Legacy agent reports and the deprecated type field keep working.

What changes

API: GET /api/v2/connectionlog

  • connection_method (new): ssh, reconnecting_pty, workspace_app, port_forwarding, or tunnel.
  • app_name, app_display_name (new, optional): the self-reported name of the connecting app, such as cursor. Workspace app slugs and ports stay in web_info.slug_or_port.
  • type (deprecated): now a plain string, so new methods pass through. The Go SDK's ConnectionLog.Type becomes a string.
{"type": "vscode", "connection_method": "ssh", "app_name": "cursor", "app_display_name": "Cursor"}

Search filters

Filter Matches
method:ssh Connections made with that method
app:cursor SSH and reconnecting PTY connections from that app. Repeat it to match any of several apps: app:vscode app:cursor
type:vscode Deprecated; same results as before this PR

method: and app: intersect, like the existing owner filters. type: can't be combined with method: or app:. List and count always agree.

UI

  • The Type menu becomes a Method menu. Picking a method drops a leftover type: from old links.
  • A warning appears when the filter contains the deprecated type:.
  • Behavior change: the Active SSH connections preset now uses method:ssh instead of type:ssh, so it also includes SSH sessions from VS Code and JetBrains apps.
  • Rows show the app next to the method, for example "Cursor (SSH) session to …".

SDK

  • codersdk.ConnectionLogMethod is generated from the database enum by typegen dbenums instead of being maintained by hand.

Docs

  • The filter docs cover method: and app:, and include a table for replacing each type: value.

Upgrade impact

Migration 617 rewrites connection_logs under an ACCESS EXCLUSIVE lock.

  • vscode and jetbrains rows become ssh rows with app vscode or jetbrains. Other rows keep their method and have no app.
  • Rollback folds apps back into the old types, so per-app names are lost. Apps registered after this migration roll back to ssh.
Rows Lock duration
1 million 5.8 s
10 million 49.7 s
25 million 99.5 s

Single runs on indexed PostgreSQL 13 with 2 CPUs and 6 GB, excluding lock waits. Not a deployment guarantee.

Design decisions

  • Why keep type:? It has shipped since v2.25.0, the old Type menu wrote it into page URLs, and the old "Active SSH connections" preset used type:ssh. Removing it would break saved links and scripts.
  • When does it go away? In a future release, together with the type response field and excluded_app_names. Both follow one rule (db2sdk.ConnectionLogType), so there is no separate invariant to maintain.
  • Why excluded_app_names? Only type:ssh needs it. It means SSH outside the VS Code and JetBrains families, including connections with no reported app.
  • Why can't type: combine with the new filters? Old clients only send type:, and mixing a legacy alias with its replacements has no useful meaning.
  • Why no family: filter? It could never be complete, because new forks can show up before they're in the registry, and several family values would match nothing. A repeatable app: covers the same need.
  • Why are app filters limited to SSH and reconnecting PTY? app: matches what the response returns in app_name. Other methods store a destination slug or port in the same column, which belongs in separate workspace_app: and port: filters (follow-up).

Stack

Land #30466 → #30467. #30467 adds explicit agent reporting on top of this PR. The insights stack (#30497 → #29796 → #29906) is independent. Replaces #29674.

Review guide and line breakdown

Counts are relative to main. Generated API reference counts as generated; stories and fixtures count as tests.

Category Added Deleted Where to look
Source +507 −266 Migration 617, SQL and converters, search filters, SDK, enterprise handlers, UI, typegen dbenums
Generated +351 −247 sqlc output, Swagger, API reference, TypeScript types, codersdk/dbenums_gen.go
Tests +776 −183 Historical mappings, filter list/count consistency, migration up/down, UI
Docs +72 −23 Connection log fields and filters
Total +1,706 −719

Out of scope: explicit agent wire fields (#30467), workspace_app: and port: filters, JetBrains per-product propagation, and a raw port-forward producer.

Generated with Coder Agents on behalf of @EhabY.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@nickvigilante nickvigilante left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs overall LGTM. My robot found some things worth flagging, but you can take them or leave them.

Comment thread coderd/searchquery/search.go Resolved

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it out and it looks good! Mostly just wondering if we need the family filter and thinking we can make app repeatable.

Comment thread coderd/agentapi/connectionlog_test.go Resolved
-- nothing. Other methods store a destination in app_name_or_port.
AND CASE
WHEN @app_names :: text[] IS NOT NULL THEN
connection_method IN ('ssh', 'reconnecting_pty') AND app_name_or_port = ANY(@app_names :: text[])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any harm in letting it match anything, even if not ssh or reconnecting_pty? Could be nice to also get web apps and be able to search ports.

Although app:8080 would be kinda weird, so maybe we would only want to allow workspace apps and eventually add a separate port filter.

@EhabY EhabY Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back and forth on this one. I'd like app: to keep matching what the response shows in app_name, and for workspace apps the slug lives in web_info.slug_or_port, so mixing them felt confusing. I think separate workspace_app: and port: filters would be cleaner, so I'd rather do those in a follow-up. wdyt?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can address this later! Maybe we run it by the dev or design channel to see if folks have opinions.

The ssh/webinfo split we introduce at the API feels kinda odd to me, I wish we simply returned the whole row as it came from the DB. But, most users probably never even see that anyway since they would have to interact with the API.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep agreed, it's an (API) design question and needs product/dev input!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #30650

Comment thread coderd/searchquery/search.go Resolved
Comment thread enterprise/coderd/connectionlog.go Resolved
Comment thread scripts/typegen/main.go Resolved
Comment thread codersdk/connectionlog.go Resolved
Comment thread coderd/searchquery/search.go Resolved
@EhabY EhabY changed the title feat: separate connection log methods from app identities feat: separate connection log methods from app names Oct 9, 2026
@EhabY
EhabY force-pushed the feat/connection-log-methods branch from ae47b7f to 036757d Compare October 9, 2026 12:25

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful!

Comment thread coderd/agentapi/connectionlog_test.go Resolved
EhabY and others added 4 commits October 12, 2026 15:39
- Remove the family filter and its presets, and make app repeatable.
- Drop a legacy type filter when a method is picked, and warn when the
  filter contains type.
- Describe app names as self-reported rather than client identities.
- List every method in convertConnectionLog and panic on unknown ones.
- Compare whole rows in the agentapi connection log test.
- Add a type filter migration table to the docs.
@EhabY
EhabY force-pushed the feat/connection-log-methods branch from 036757d to c33fc14 Compare October 12, 2026 12:42
@EhabY
EhabY merged commit 5b060be into main Oct 12, 2026
36 checks passed
@EhabY
EhabY deleted the feat/connection-log-methods branch October 12, 2026 12:56
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 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.

3 participants