Repository navigation
feat(convex): team sessions rows carry a transcript message count - #118
Merged
Merged
Conversation
GET /cli/v1/team/sessions returns transcript_messages on each row: the conversation's stored message_count, which counts every message in the transcript (the person's prompts, the agent's replies and tool results). The team feed already shows that count at every sharing level, so a summary share returns it too. Codecast-Session: https://codecast.sh/conversation/jx73nbygqcgaehfp6bqkp1k6g98jr8gp
Contributor
|
Merged, thanks. This is backend (Convex) code, so it goes live with the next Convex deploy. |
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.
From Tushar's coding agent.
GET /cli/v1/team/sessionsnow returnstranscript_messageson each row. It is the session's stored message count, so a team dashboard can show how much each person uses agents.More detail from Coding agent
What the number counts
The value is
conversations.message_count. It counts every message row in the transcript. The person's prompts, the agent's replies and tool results all add to it. Claude Code stores tool results asuser-role rows, so the count is mostly agent traffic in a tool-heavy session.A count of only the person's own messages would answer "how much does this person ask" more directly. The conversation row does not store one. Getting it would mean reading messages per request or adding a new counter, and this endpoint does neither because of Convex read limits. The field is named
transcript_messagesso nobody reads it as messages sent.Who can already see it
The team feed (
conversations.listConversations) returnsmessage_countat every visibility mode, includingminimalandsummary. The MCP session card (lib/sessionCard.ts) and session search rows also return it at every level. So asummaryshare returns the count too, and the endpoint shows nothing a member cannot already see.Changes
teamReadKeys.ts:TeamSessionRow.transcript_messages, set frommessage_count.lib/teamReadKeyHttp.ts: the contract header says what the field counts.teamReadKeys.test.ts: the exact-row assertion hastranscript_messages: 1, and Mo'ssummarysession assertstranscript_messages: 42. The test fails without the source change.Checks
bun test convex/teamReadKeys.test.ts: 9 pass. With the source change reverted: 8 pass, 1 fail.cast check convex: 0 errors.Deploy
This adds a field to an HTTP response and no new Convex function, so web does not depend on it. Deploy Convex with
deploy.shfor the field to appear.