Title: Normalize workspace agent session counts into a child table · Issue #27410 · coder/coder · GitHub
Open Graph Title: Normalize workspace agent session counts into a child table · Issue #27410 · coder/coder
X Title: Normalize workspace agent session counts into a child table · Issue #27410 · coder/coder
Description: Phase 1 of the Scalable Approach for Adding New IDE Session Types RFC. Before this phase, adding an IDE session type (Cursor, Windsurf, ...) required changing 15+ files across migrations, proto, server, SDK, and UI. Replace the fixed ses...
Open Graph Description: Phase 1 of the Scalable Approach for Adding New IDE Session Types RFC. Before this phase, adding an IDE session type (Cursor, Windsurf, ...) required changing 15+ files across migrations, proto, se...
X Description: Phase 1 of the Scalable Approach for Adding New IDE Session Types RFC. Before this phase, adding an IDE session type (Cursor, Windsurf, ...) required changing 15+ files across migrations, proto, se...
Opengraph URL: https://github.com/coder/coder/issues/27410
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Normalize workspace agent session counts into a child table","articleBody":"Phase 1 of the [Scalable Approach for Adding New IDE Session Types RFC](\u003chttps://app.notion.com/p/coderhq/Scalable-Approach-for-Adding-New-IDE-Session-Types-2d2d579be5928044bfd3cab09f1466b7>). Before this phase, adding an IDE session type (Cursor, Windsurf, ...) required changing 15+ files across migrations, proto, server, SDK, and UI.\n\nReplace the fixed `session_count_*` columns on the ephemeral `workspace_agent_stats` table with a normalized child table keyed by app name, and report session counts from the agent as a dynamic proto map, so new IDEs flow end-to-end with zero schema, proto, or server changes.\n\n### Scope\n\n* New `workspace_agent_session_counts (workspace_agent_stats_id, app_name, count)` child table with `ON DELETE CASCADE`; clean-cut migration copies the \\~1 day ephemeral buffer, drops the four columns, and trims the insights covering index\n* Proto `Stats.session_counts` map (field 13, Agent API v2.11); fields 8–11 stay deprecated and the server converts them, so old agents keep reporting without changes\n* Agent: dynamic per-app counters; `extractMagicSessionType` normalizes instead of classifying against a fixed set; JetBrains process detection and SSH metric labels grouped by family\n* Shared normalization, families, and presentation live in `codersdk/appname.go`, not a separate `coderd/idemetadata` package. `NormalizeAppName` strips control characters, trims/truncates names, lowercases, and folds `-` to `_`; empty becomes `unknown`. Unregistered normalized names remain valid.\n* Bounded input: a stats report is capped at 64 distinct normalized names, excess names folded into the reserved `overflow` accounting value; workspace usage API and `coder ssh --usage-app` accept arbitrary app names\n* Read paths: latest-row queries aggregate the child table via `LEFT JOIN LATERAL`; rollup and template insights use plain hash joins (benchmarks in the PR description)\n* External surfaces stay byte-identical: deployment stats API, Prometheus gauge names, and telemetry snapshots are unchanged until phase 2 (coder/coder#27411)\n\n### Done when\n\n- [X] Per-app count storage and map-based agent reporting landed; the final producer work merged in coder/coder#28338. coder/coder#27952 was superseded and closed without merging.\n- [ ] Deployment stats, Prometheus, telemetry, and insights output are identical before and after the migration\n- [ ] Old agents (fixed proto fields) and new agents (map) both report correctly against the new server\n\n### Current phase tracking\n\n1. coder/coder#27410: normalized per-app counts and agent map reporting, complete.\n2. coder/coder#27411: external count API, metrics, and UI projection, complete; legacy-removal timing remains TBD in [CLIENT-980](https://linear.app/codercom/issue/CLIENT-980/remove-deprecated-session-count-outputs-after-an-agreed-compatibility).\n3. coder/coder#27412: connection-log method/app storage, API, filters, and UI, complete. Remaining explicit agent reporting is tracked separately in [CLIENT-1037](https://linear.app/codercom/issue/CLIENT-1037/report-agent-connection-methods-and-app-identities) / coder/coder#30467.\n4. coder/coder#27413: session rollup already uses `template_usage_stats_session_apps` (migration 000596), not shared `app_usage_mins` JSONB. Per-app insights reads/UI remain in coder/coder#29796.\n5. coder/vscode-coder#1044 and coder/jetbrains-coder#599: actual editor reporting. Registry additions landed in coder/coder#30116; client and JetBrains watcher readiness are separate from registry availability.\n\nThe [Completing Scalable IDE Session Tracking RFC](\u003chttps://app.notion.com/p/3e9d579be5928178b37ce324b8ba0c8b>) supersedes the obsolete phase descriptions. [CLIENT-998](https://linear.app/codercom/issue/CLIENT-998/optional-move-workspace-app-usage-jsonb-into-a-child-table)'s web-app storage migration and [CLIENT-1010](https://linear.app/codercom/issue/CLIENT-1010/expose-per-app-session-duration-from-the-connection-log)'s duration feature are optional follow-ups, not release gates.\n\n---\n\n🤖 Created by Coder Agents on behalf of @EhabY.\n\nStale architecture and phase text corrected by Coder Agents on behalf of @EhabY; status remains Done.","author":{"url":"https://github.com/EhabY","@type":"Person","name":"EhabY"},"datePublished":"2026-07-22T09:20:27Z","url":"https://github.com/coder/coder/issues/27410"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7848b84d-956f-a32c-9e8a-c506f296e29f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DFA:14F601:1FCBEA8:286B2B3:6B0153CE |
| html-safe-nonce | 04e2ce10fba575e4a96073f58a09ecf7aafb9cb80d8eda3620fda43b230f8c30 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REZBOjE0RjYwMToxRkNCRUE4OjI4NkIyQjM6NkIwMTUzQ0UiLCJ2aXNpdG9yX2lkIjoiMzU4OTg2Nzk0NTY0OTU5MTI0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 800ae796f6e6c42edc104f096adba63826050d7b1cb708c2ca3e8e85c8d08ea1 |
| hovercard-subject-tag | issue:4947440647 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/27410/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0fd5b8683e42542137baa2da425e5988a0bb4059c5d980216d43f1ce9fef00a2/coder/coder/issues/27410 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0fd5b8683e42542137baa2da425e5988a0bb4059c5d980216d43f1ce9fef00a2/coder/coder/issues/27410 |
| og:image:alt | Phase 1 of the Scalable Approach for Adding New IDE Session Types RFC. Before this phase, adding an IDE session type (Cursor, Windsurf, ...) required changing 15+ files across migrations, proto, se... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | EhabY |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width