Skip to content

Normalize workspace agent session counts into a child table #27410

Closed

Description

@EhabY

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 with ON DELETE CASCADE; clean-cut migration copies the ~1 day ephemeral buffer, drops the four columns, and trims the insights covering index
  • 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
  • Agent: dynamic per-app counters; extractMagicSessionType normalizes 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 separate coderd/idemetadata package. NormalizeAppName strips control characters, trims/truncates names, lowercases, and folds - to _; empty becomes unknown. Unregistered normalized names remain valid.
  • 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
  • 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

Current phase tracking

  1. Normalize workspace agent session counts into a child table #27410: normalized per-app counts and agent map reporting, complete.
  2. 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.
  3. 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.
  4. Report template insights session usage per app #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 feat!: report template insights session usage per app #29796.
  5. 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

  1. added theissue type on Jul 22, 2026
  2. linear-code commented on Jul 22, 2026

    @linear-code
  3. changed the title [-]Normalize workspace agent session counts into a child table (IDE session types phase 1)[/-] [+]Normalize workspace agent session counts into a child table[/+] on Jul 22, 2026
  4. self-assigned this
    on Jul 22, 2026
  5. added a commit that references this issue on Sep 18, 2026
    9974294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions