fix(me): fall back to the Gmail profile when People returns no email - #173
Merged
Conversation
'gro me' printed the display name but a blank ('-') email, while 'config
test' printed 'Authenticated as: <email>' - inconsistent identity output,
with the canonical identity command being the less useful one.
Root cause: people/me only returns the account's own email when the token
carries an email-bearing scope. gro requests userinfo.profile but not
userinfo.email, so People comes back email-less; the Gmail profile always
knows the address under the always-granted gmail.modify scope.
Fall back to the Gmail profile when People's email is blank (one extra API
call, only in that case; best-effort - a fallback failure degrades to the
old '-' rendering rather than failing me). Covers the one-liner and --id.
Deliberately NOT fixed by adding the userinfo.email scope: a scope-set
change trips the scope-drift gate and forces every existing user through
re-auth, for data we can already read.
piekstra-dev
approved these changes
Aug 12, 2026
piekstra-dev
left a comment
There was a problem hiding this comment.
Automated PR Review
Reviewed commit: 3f3dc302c27c
Profile: reviewer - Posting as: piekstra-dev
Summary
| Reviewer | Findings |
|---|---|
| go:implementation-tests | 0 |
| policies:conventions | 0 |
Reviewer Coverage
| Reviewer | Status | Inspected | Skipped | Constraints |
|---|---|---|---|---|
| go:implementation-tests | complete_broad | internal/cmd/me/me.go, internal/cmd/me/me_test.go, internal/cmd/me/output.go | unavailable | Reviewed only the three assigned files; the external gmail.NewClient/GetProfile implementation in google-cli-common is out of scope and not inspected. |
| policies:conventions | complete_broad | internal/cmd/me/me.go, internal/cmd/me/output.go | unavailable | unavailable |
0 PR discussion threads considered. 0 summarized; 0 resolved.
Completed in 2m 22s | $1.14 | claude-sonnet-5 | cr 0.10.268
| Field | Value |
|---|---|
| Model | claude-sonnet-5 |
| Reviewers | go:implementation-tests, policies:conventions |
| Engine | claude_cli · claude-sonnet-5 |
| Reviewed by | cr · piekstra-dev |
| Duration | 2m 22s wall · 3m 18s compute |
| Cost | $1.14 |
| Tokens | 74 in / 14.2k out |
Per-workstream usage
| Workstream | Model | In | Out | Cache read | Cache create | Cost | Duration |
|---|---|---|---|---|---|---|---|
| orchestrator-selection | claude-sonnet-5 | 6 | 1.4k | 59.0k | 12.8k | $0.12 | 19s |
| go:implementation-tests | claude-sonnet-5 | 22 | 4.9k | 358.4k | 28.6k | $0.35 | 1m 07s |
| policies:conventions | claude-sonnet-5 | 40 | 7.4k | 759.9k | 34.7k | $0.55 | 1m 41s |
| orchestrator-rollup | claude-sonnet-5 | 6 | 383 | 67.8k | 15.2k | $0.12 | 10s |
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.
Why
Identity output was inconsistent, and in the wrong direction:
gro me(the canonical identity surface) printed a blank email —— while
gro config testprintedAuthenticated as: <email>.gro me --id(the scripting surface) printed just-.Root cause
people/meonly returns the account's own email when the token carries an email-bearing scope. gro requestsuserinfo.profilebut deliberately notuserinfo.email, so People comes back email-less. The Gmail profile always knows the address (via the always-grantedgmail.modifyscope) — which is whyconfig testhad it.What
When People's email is blank, resolve it from the Gmail profile (injected
GmailEmailFactoryseam, matching the existingClientFactorypattern):-rendering rather than failingme.--id.Considered and rejected: adding the
userinfo.emailscope. Any scope-set change trips the scope-drift gate and forces every existing user through a full re-auth — for data we can already read with granted scopes.Tests
Fallback fills the one-liner and
--id; fallback failure degrades gracefully; no Gmail call when People already supplied the email.make checkgreen.