TW-5464: support setting and updating agent account display name#105
Merged
Conversation
Add an optional top-level `name` (display name) to agent accounts,
settable on `nylas agent account create --name` and updatable via
`nylas agent account update --name`.
`name` is a top-level grant field (POST /v3/connect/custom and
PATCH /v3/grants/{id}), not a setting, and is omitted when empty.
Because the grant update replaces the full record, updates re-send
the existing name unless the caller overrides it, so an app-password
rotation (or rename) never wipes the display name. Validation is
1-256 runes.
Threaded through the domain model, ports.AgentClient, the HTTP/demo/
mock adapters, the CLI create/update commands (and the create
app-password fallback), and the Air web handler. Docs updated.
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.
Summary
Adds an optional top-level
name(display name) to Nylas-managed agent accounts:nylas agent account create <email> --name "Support Bot"nylas agent account update <id|email> --name "Support Bot"nameis a top-level grant field (POST /v3/connect/customandPATCH /v3/grants/{id}), not asettingsentry, and is omitted from the request when empty. This matches how the auth service parses and persists the grantname.Why the preserve-on-update logic
The grant update replaces the full record, so an update that omits
namewould clear an existing display name. To prevent that, every update re-sends the existing name unless the caller explicitly overrides it — so rotating an app password (or renaming) never wipes the name. The create app-password fallback path re-sends the name for the same reason.Validation: 1–256 characters, measured in runes (
utf8.RuneCountInString) so multi-byte names aren't wrongly rejected. Clearing a name back to empty is not supported by the grant API and is documented as such.Changes
internal/domain/agent.go):AgentAccount.Nameinternal/ports/agent.go):nameadded toCreateAgentAccount/UpdateAgentAccountinternal/adapters/nylas/agent.go,managed_grants.go): sendsnametop-level (omit when empty), parses it back; demo + mock updatedinternal/cli/agent/create.go,update.go,helpers.go):--nameflag on create and update,validateAgentName,resolveEffectiveNamepreservation, name shown in detailsinternal/studio/handlers_accounts.go):nameaccepted on create/patch with the same preservation + validationdocs/commands/agent.md,agent-getting-started.md,COMMANDS.mdTesting
make cigreen: fmt, vet, lint, unit, race, security, vuln, buildsettings), omit-when-empty, round-trip, rune-based length limits, and name preservation on app-password rotation (CLI fallback + Air handler)make ci-full: quality gate, CLI regressions, and the full agent integration suite pass against the live API. (One unrelated failure:TestSlack_Workflow/list_usershit a Slack API rate limit — environmental, not from this change.)Related docs
nylas agent account createnylas agent account update