Repository navigation
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 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.
Scope
- New
workspace_agent_session_counts (workspace_agent_stats_id, app_name, count)child table withON DELETE CASCADE; clean-cut migration copies the ~1 day ephemeral buffer, drops the four columns, and trims the insights covering index - Proto
Stats.session_countsmap (field 13, Agent API v2.11); fields 8–11 stay deprecated and the server converts them, so old agents keep reporting without changes - Agent: dynamic per-app counters;
extractMagicSessionTypenormalizes instead of classifying against a fixed set; JetBrains process detection and SSH metric labels grouped by family - Shared normalization, families, and presentation live in
codersdk/appname.go, not a separatecoderd/idemetadatapackage.NormalizeAppNamestrips control characters, trims/truncates names, lowercases, and folds-to_; empty becomesunknown. Unregistered normalized names remain valid. - Bounded input: a stats report is capped at 64 distinct normalized names, excess names folded into the reserved
overflowaccounting value; workspace usage API andcoder ssh --usage-appaccept arbitrary app names - 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) - External surfaces stay byte-identical: deployment stats API, Prometheus gauge names, and telemetry snapshots are unchanged until phase 2 (Expose per-app session counts in deployment stats, Prometheus, and the UI #27411)
Done when
- Per-app count storage and map-based agent reporting landed; the final producer work merged in feat: report arbitrary workspace agent session types #28338. feat: normalize workspace agent session counts into a child table #27952 was superseded and closed without merging.
- Deployment stats, Prometheus, telemetry, and insights output are identical before and after the migration
- Old agents (fixed proto fields) and new agents (map) both report correctly against the new server
Current phase tracking
- Normalize workspace agent session counts into a child table #27410: normalized per-app counts and agent map reporting, complete.
- Expose per-app session counts in deployment stats, Prometheus, and the UI #27411: external count API, metrics, and UI projection, complete; legacy-removal timing remains TBD in CLIENT-980.
- Separate connection log methods from app identities #27412: connection-log method/app storage, API, filters, and UI, complete. Remaining explicit agent reporting is tracked separately in CLIENT-1037 / feat: report agent connection methods and app identities #30467.
- Report template insights session usage per app #27413: session rollup already uses
template_usage_stats_session_apps(migration 000596), not sharedapp_usage_minsJSONB. Per-app insights reads/UI remain in feat!: report template insights session usage per app #29796. - Report the actual IDE (Cursor, Devin Desktop, ...) for session tracking vscode-coder#1044 and Send the specific JetBrains IDE name for session tracking jetbrains-coder#599: actual editor reporting. Registry additions landed in feat: recognize VS Code forks and JetBrains IDEs as session apps #30116; client and JetBrains watcher readiness are separate from registry availability.
The Completing Scalable IDE Session Tracking RFC supersedes the obsolete phase descriptions. CLIENT-998's web-app storage migration and CLIENT-1010's duration feature are optional follow-ups, not release gates.
🤖 Created by Coder Agents on behalf of @EhabY.
Stale architecture and phase text corrected by Coder Agents on behalf of @EhabY; status remains Done.
Activity
linear-code commentedon Jul 22, 2026
ENG-3074
[-]Normalize workspace agent session counts into a child table (IDE session types phase 1)[/-][+]Normalize workspace agent session counts into a child table[/+]refactor: normalize workspace agent session metadata (coder#28124)
feat: add workspace agent session count protocol (#28125)
refactor: normalize workspace agent session metadata (#28124)
feat: add workspace agent session count protocol (#28125)
feat: store session usage per app and family in template usage stats (#…
feat: report arbitrary workspace agent session types (coder#28338)