feat: add workspace agent session count protocol - #28125
Merged
Merged
Conversation
EhabY
force-pushed
the
feat/agent-session-counts-protocol
branch
from
August 13, 2026 16:29
11e05b6 to
f2663f1
Compare
EhabY
force-pushed
the
feat/agent-session-counts-protocol
branch
from
August 18, 2026 13:05
f2663f1 to
c86cdf4
Compare
EhabY
force-pushed
the
feat/agent-session-counts-protocol
branch
2 times, most recently
from
August 19, 2026 14:14
7994907 to
de7f84c
Compare
EhabY
force-pushed
the
feat/agent-session-counts-protocol
branch
from
August 19, 2026 23:25
de7f84c to
4f7fba6
Compare
EhabY
force-pushed
the
feat/agent-session-counts-protocol
branch
2 times, most recently
from
August 20, 2026 12:28
8f503a2 to
32f11a1
Compare
EhabY
marked this pull request as ready for review
August 20, 2026 12:38
johnstcn
approved these changes
Aug 20, 2026
johnstcn
left a comment
Member
There was a problem hiding this comment.
Depending on who gets in first, you may need to rebase on another PR that adds proto version 2,11.
code-asher
approved these changes
Aug 20, 2026
Base automatically changed from
refactor/normalize-agent-session-metadata
to
main
August 20, 2026 23:22
EhabY
force-pushed
the
feat/agent-session-counts-protocol
branch
3 times, most recently
from
August 20, 2026 23:54
9709052 to
037ebc7
Compare
EhabY
force-pushed
the
feat/agent-session-counts-protocol
branch
from
August 21, 2026 00:04
037ebc7 to
5f2b3ab
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Defines Agent API 2.11: a session count per app instead of four fixed counters.
Stats.session_counts, amap<string, int64>, as field 13, and marks fields 8 through 11 deprecated without removing them.DRPCAgentClient211,ConnectRPC211, andConnectRPC211WithRolealongside the existing 2.9 and 2.10 constructors, and bumpsCurrentMinorso coderd accepts 2.11.normalizedSessionCountsreads the map, normalizes names, drops non-positive counts, and falls back to the deprecated fields only when the map yields nothing, so one ingestion path serves old and new agents.capSessionCountsbounds a report at 64 names, keeping the known families and then the busiest, and sums the remainder intounknownso no count is lost.HasSessionCountsandClearSessionCountsreplace the two places that spelled the four fields out by hand.The agent still connects on 2.10 and the helpers are not on the write path yet, so a 2.11 report would be accepted here but its map not stored. That only matters if coderd is rolled back to this commit while a newer agent is running, and it costs the per-app counts and nothing else:
reporter.goalready gates workspace activity onHasSessionCounts, which reads the map, so such a report still bumps activity and the workspace is not treated as idle.The bump belongs ahead of the agent rather than alongside it.
Validaterejects a requested minor above the server's, and the agent does not negotiate down, so a coderd advertising 2.10 refuses a 2.11 agent outright. Advertising first keeps the skew in the safe direction.The version bump lives here so the whole version story, the field, the client constructors, and the advertised version, reads in one diff.
Depends on #28124. Phase 2 of #27410.