Repository navigation
Name an agent profile in me from its person record - #784
Conversation
An agent's self-token has no identity behind it, so Basecamp's
/authorization.json answers it 401 and `basecamp me -P <agent>` failed
with "Authorization failed: invalid or expired token" and a hint to
re-run the client-credentials login, which cannot help: the token is
fine, the endpoint just does not serve agents.
For a stored agent credential, `me` now reads /{account}/my/profile.json
in the account the agent is bound to, the same record `connect setup`
already reads. The output carries the person and that one account, and
omits identity. Other profiles, and anything under BASECAMP_TOKEN, take
the authorization document path as before, with unchanged JSON.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approved
The focused implementation correctly preserves existing behavior and covers the new agent path.
Review effort: Balanced
Findings: None
What changed in this PR
Updates basecamp me to support agent credentials without querying the incompatible authorization endpoint.
Changes:
- Retrieves agent identity from the account-scoped person endpoint.
- Omits nonexistent agent identity data while reporting its bound account.
- Adds coverage for agent routing and JSON output.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
| File | Description |
|---|---|
internal/commands/people.go |
Adds agent-specific profile retrieval and output. |
internal/commands/people_test.go |
Verifies endpoint routing, summary, and JSON shape. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fixes the issue reported on this card:
basecamp me -P <agent-profile>fails with "Authorization failed: invalid or expired token".What was wrong
mealways asked/authorization.jsonwho the credential belongs to. For an agent profile that is Basecamp's own/authorization.json(not Launchpad:AuthorizationEndpointFor("agent")already routes to the Basecamp origin). But that endpoint authenticates throughauthenticate_basecamp_identity, which requirestoken.identity_id, and a client_credentials self-token is minted with an agent and an account, with no identity. So the server answers 401 to a perfectly good token. The CLI then attached the agent login remedy (... | basecamp auth login --with-client-credentials ...), which is the right remedy for a broken agent credential but useless here, since re-minting produces another token the endpoint refuses in the same way.What changed
oauth_type: agentcredential,mereads/{account}/my/profile.jsonin the configured account (the same recordconnect setupreads throughSDKReader.Me) and never calls/authorization.json. No 401 means no misleading hint. A real auth failure on the profile read still gets the agent login remedy, which is right in that case.person(id, name, email),accountsholding the one bound account marked current, and noidentity(an agent has none). Summary:Name <email> - agent in Basecamp account N.MeOutput.Identityis now a pointer withomitemptyso the agent case can leave it out. For every other profile it is always set, so the JSON is byte-for-byte what it was.BASECAMP_TOKENthe stored type says nothing about the token being sent, so that path is unchanged.Tests
TestMeOnAnAgentProfileReadsTheAgentsPersonstores an agent credential against a fake server whose/authorization.jsonanswers 401. It assertsmeasks only/555/my/profile.jsonand checks the summary and JSON shape. On main it fails withAuthorization failed: invalid or expired token: Run: basecamp auth login, the error from the report.Not changed here
auth status --checkand doctor's "API Connectivity" check also probe/authorization.jsonwith the active credential, so they probably report an agent's valid token as rejected in the same way. I left them out to keep this change scoped to the report. They could get the same agent branch, or/authorization.jsonin bc3 could learn to describe agent tokens, which would fix all three at once.Summary by cubic
Fixes
basecamp me -P <agent-profile>failing with "Authorization failed: invalid or expired token" for agent credentials. Agent self-tokens have no identity, so/authorization.jsonrejects them;menow reads the agent's person record from/{account}/my/profile.jsoninstead, outputs that person and the bound account, and omits identity. Other profiles and theBASECAMP_TOKENpath are untouched, butauth status --checkand doctor's API connectivity check still probe/authorization.jsonand may report agent tokens as rejected.Written for commit 0276079. Summary will update on new commits.