feat: report arbitrary workspace agent session types - #28338
Open
EhabY wants to merge 4 commits into
Open
Conversation
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 20, 2026 12:39
a9d73b0 to
e77e137
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 20, 2026 23:41
e77e137 to
b47e46c
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 20, 2026 23:54
b47e46c to
c2a30ad
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 21, 2026 00:04
c2a30ad to
7998d2e
Compare
EhabY
added a commit
that referenced
this pull request
Aug 21, 2026
Phase 2 of the Scalable Approach for Adding New IDE Session Types RFC, tracked in #27410. Adds a session_counts map to Stats on the Agent API, so an agent can report a count per app name instead of the four fixed fields, which are now marked deprecated. Bumps the API to v2.11. - coderd normalizes names on ingest, caps distinct entries, and sums the overflow under unknown, so an arbitrary client name cannot blow up cardinality. - Agents predating v2.11 set the fixed fields instead, never both, and the ingest path falls back to them. Nothing sends session_counts yet. The agent starts populating it in #28338.
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 21, 2026 00:15
7998d2e to
13e915b
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
2 times, most recently
from
August 23, 2026 14:26
70d874b to
fa9a7ff
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 23, 2026 15:04
fa9a7ff to
b265c63
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 23, 2026 15:33
b265c63 to
73b679d
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 23, 2026 15:50
73b679d to
7ff8185
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 23, 2026 18:00
7ff8185 to
ea0a9dc
Compare
aslilac
pushed a commit
that referenced
this pull request
Aug 24, 2026
Phase 2 of the Scalable Approach for Adding New IDE Session Types RFC, tracked in #27410. Adds a session_counts map to Stats on the Agent API, so an agent can report a count per app name instead of the four fixed fields, which are now marked deprecated. Bumps the API to v2.11. - coderd normalizes names on ingest, caps distinct entries, and sums the overflow under unknown, so an arbitrary client name cannot blow up cardinality. - Agents predating v2.11 set the fixed fields instead, never both, and the ingest path falls back to them. Nothing sends session_counts yet. The agent starts populating it in #28338.
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 25, 2026 14:15
ea0a9dc to
6c8cec9
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 25, 2026 20:41
a9cf035 to
c7a121c
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
August 25, 2026 20:44
c7a121c to
cb7257f
Compare
Contributor
Docs previewCheck 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. |
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
3 times, most recently
from
September 7, 2026 20:11
475165a to
46f985f
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
September 7, 2026 20:31
46f985f to
b8bb260
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
September 8, 2026 16:42
b8bb260 to
320f0b6
Compare
EhabY
changed the base branch from
feat/session-count-family-attribution
to
feat/session-family-usage-rollup
September 8, 2026 16:44
EhabY
removed this pull request from stack #29110
September 9, 2026 14:34
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
September 9, 2026 14:35
320f0b6 to
b1ab129
Compare
EhabY
added this pull request to stack #29135
September 9, 2026 14:35
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
September 10, 2026 11:27
b1ab129 to
1de03a9
Compare
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
September 10, 2026 11:54
1de03a9 to
adc653e
Compare
The agent connects on Agent API 2.11 and reports Stats.session_counts from its normalized map, so a new IDE needs no Coder change to show up in usage reporting. coder ssh --usage-app and the workspace usage API pass any app name through, normalized once at the edge; whitespace-only input is treated as no app name. Agents at this revision require a coderd that serves v2.11, the same coupling as the v2.10 bump. Older agents keep reporting the deprecated fields, which the batcher still ingests.
Bound the agent-controlled session_counts map in the stats RPC handler before normalization, folding the overflow into the unknown app so the batcher's deterministic cap still applies and the rest of the report survives. Count folded entries in a Prometheus counter and log the fold at debug, since a misbehaving agent would repeat it on every report. Log bounded scalars about the stats report instead of the payload, and have NormalizeAppName strip every control character, not just null bytes, so agent-chosen names cannot inject escape sequences.
Discard non-positive raw counts before folding overflow without reviving deprecated fields. Treat control-only usage app names as absent, matching normalization. Generated by Coder Agents for @EhabY.
EhabY
force-pushed
the
feat/arbitrary-session-count-producers
branch
from
September 10, 2026 12:07
adc653e to
ce685f3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable arbitrary app-name reporting through the agent's
Stats.session_countsmap,coder ssh --usage-app, and the workspace usage API. Reconnecting PTY counts are added to the map without overwriting SSH-reported counts. Unrecognized names retain their identity and are attributed to theunknownfamily.Normalize and merge names before applying the existing deterministic 64-name cap: known apps first, then count, then name. Overflow is summed into
unknown. Non-positive counts cannot cancel valid activity. Control characters are stripped, whitespace/control-only HTTP app names are treated as absent, and SSH session-type extraction requires the exact environment-variable prefix. Folded names are counted incoderd_agentstats_session_counts_folded_total; logs avoid raw payloads and repeated warnings.Compatibility: new agents require a server supporting Agent API v2.11 and do not negotiate down. Older agents remain supported through the deprecated count fields. The usage API's
app_namebecomes a string; SDK types and API documentation are updated. No database migration is added.Stacked on #29109; completes the producer portion of #27410. Dynamic API/metrics/UI projections (#27411), per-app insights (#27413), and arbitrary connection-log types (#27412) remain separate. Connection logs still use the existing enum until #27412 lands.
Design decisions and resource bounds
unknown, but temporary processing scales with the input. The agent dRPC transport limits each message to 4 MiB. A local synthetic 200,000-name normalization-and-cap benchmark measured approximately 0.20 s and 25 MB allocated, excluding decoding.Description updated by Coder Agents for @EhabY.