Repository navigation
fix(usage): list service accounts in usage monitoring (OHE-4159) - #1405
Merged
hieptl merged 1 commit intoNov 18, 2026
Merged
Conversation
An automation that runs as a service account is attributed to that account, but the Users tab of Usage Monitoring and the per-user team usage left service accounts out. Their spend still counted in the organization totals, so the per-user rows did not add up to the totals and an admin could not see which service account had spent it. #1049 left them out because a service account has no email or login and showed as "Unknown". It does have a display name, and the budget rows already use it. The per-user usage queries no longer filter on the account type. A row is named by the account's display name, then the git name, and carries account_type. The Users tab shows "Service account" under the name, where a person's email goes. Rows for people are unchanged, and so are the organization totals. The usage tests now expect a service account in both lists, through the ledger and the legacy query, and cover a disabled account and the Users tab label.
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
hieptl
marked this pull request as ready for review
November 17, 2026 02:36
hieptl
deleted the
hiep/ohe-4159-bug-service-account-automation-usage-is-hidden
branch
November 18, 2026 11:35
Contributor
|
🚀 Released in 1.95.0. |
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.
HUMAN:
AGENT:
Why
An automation that runs as a service account is attributed to that account, but Usage Monitoring leaves service accounts out of the Users tab and out of the per-user team usage. Their spend still counts in the organization totals, so the user rows do not add up to the totals, and an admin cannot see which service account spent it.
The per-user queries in
OrgConversationServicefilter onUser.account_type == 'human'. #1049 added that filter because a service account has no email or login and showed as "Unknown". A service account does have adisplay_name, and the budget rows already use it.Summary
team_usagelist ofGET /api/organizations/{org_id}/conversations/usagenow include service accounts. A row is named by the account's display name and carriesaccount_type(humanorservice).Service accountunder its name, where a person's email goes.Issue Number
OHE-4159
How to Test
Unit tests:
Manual steps:
nightly-report.nightly-reporthas a row markedService account, with its conversation count and spend.Only the unit tests were run. The manual steps were not run.
Video/Screenshots
N/A. The Users tab gains one row per service account, with
Service accountin place of the email.Type
Notes
team_usagerows and user-usage rows gainaccount_type.active_usersnow counts a service account that has usage, andteam_usage[].percentageis a share that includes service accounts. The settings UI renders neither field.team_usagechange shows only in the API response.user_nameis still the git name for a person. Only a service account has adisplay_name.Unknownfor a service account's conversations, because that response carries only the email.user.account_typeanduser.display_namealready exist.Enterprise server image for this PR: