Enforce lowercase usernames, per-field validation, and InfoTip requirements - #229
Conversation
…ip for requirements - Onboarding + login username fields auto-lowercase input on every keystroke - Per-field real-time validation: each username field shows its own error status/message independently, so it's clear which field(s) fail - Username format requirements moved from description text to InfoTip (circle-with-? icon) next to the field label, shown on hover/focus - validateSetupDetails now checks raw (untrimmed) value against isValidUsername so leading/trailing spaces are properly rejected - Review stage account summary reformatted: 'kawah - friend4 (agent)' instead of 'kawah · agent friend4'
Remove the effect that reset loginUsername back to snapshot.username whenever the field was cleared, allowing proper backspace-to-empty.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86ab5b54f5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return { message: "Username is required.", step }; | ||
| } | ||
| if (!isValidUsername(username)) { | ||
| if (!isValidUsername(rawUsername)) { |
There was a problem hiding this comment.
Enforce username rules at the setup syscall
This check rejects padded names only in the web wizard. buildSetupPayload/SessionService.setup still trim before sending, and gateway/src/kernel/sys/setup.ts trims in readRequiredString/readOptionalString before applying USERNAME_RE, so direct sys.setup/SDK callers can still submit " alice " or " friday " and get silently-created alice/friday while the UI rejects the same input. Because username format is setup syscall semantics, enforce or normalize it at that boundary instead of only this caller.
AGENTS.md reference: AGENTS.md:L22-L26
Useful? React with 👍 / 👎.
| setLoginUsername(snapshot.username); | ||
| } | ||
| }, [loginUsername, snapshot.username]); | ||
|
|
There was a problem hiding this comment.
Keep the login username in sync after setup
After a first-boot setup, this hook has been mounted since the pre-setup snapshot, so loginUsername was initialized as empty and this deletion removes the only path that copied the newly-created snapshot.username into the login form. If the session later locks without a full reload, the login screen no longer pre-fills the account that was just created; consider tracking whether the user has edited/cleared the field before suppressing snapshot updates.
Useful? React with 👍 / 👎.
…ill after setup - Validate raw (untrimmed) username/agentName against USERNAME_RE in parseSetupIdentity/parseSetupAgentName so padded names are rejected at the setup syscall, not only in the web wizard - Add loginUsernameTouched flag so login field syncs from snapshot.username after first-boot setup, but stops syncing once user manually edits
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0146d49907
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!loginUsernameTouched && snapshot.username) { | ||
| setLoginUsername(snapshot.username); | ||
| } |
There was a problem hiding this comment.
Mark login username edits as touched
When snapshot.username changes after the user has typed or cleared the login field, this effect still overwrites the field because loginUsernameTouched is initialized to false and is never set to true in the returned onUsername handler. The new guard therefore does not actually mean “the user hasn't manually edited,” so session updates during setup/lock/reconnect can replace in-progress login input; set the touched flag when handling username edits before relying on it here.
Useful? React with 👍 / 👎.
| const usernameValue = draft.account.username; | ||
| const usernameInvalid = usernameValue.length > 0 && !isValidUsername(usernameValue); | ||
| const agentValue = draft.account.agentName; | ||
| const agentInvalid = agentValue.length > 0 && !isValidUsername(agentValue); |
There was a problem hiding this comment.
Keep optional agent validation consistent
If the optional personal-agent field contains only spaces, this marks the field invalid because agentValue.length > 0, but validateSetupDetails trims the same value, treats it as blank, and allows the user to advance while buildSetupPayload omits the agent name. That leaves a red error visible on a form that can still submit successfully; base the inline invalid state on the same trimmed value, or make submit validation block whitespace-only input too.
Useful? React with 👍 / 👎.
…ation with submit - Set loginUsernameTouched=true in onUsername handler so the snapshot sync effect stops overwriting user input after manual edits - Use trimmed agentValue for the inline invalid check so whitespace-only input doesn't show a red error while submit treats it as blank
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Summary
Improves the onboarding and login username experience with lowercase enforcement, real-time per-field validation, and cleaner requirements display.
Changes
Lowercase enforcement
HankshowshankinstantlyPer-field validation errors
validateSetupDetailsnow checks the raw (untrimmed) value againstisValidUsername, so leading/trailing spaces are properly rejected instead of silently passing after trimRequirements as InfoTip
Review stage formatting
kawah - friend4 (agent)instead ofkawah · agent friend4Login username clear fix
Files changed
web/src/app/features/session/setup/AccountDetails.tsxweb/src/app/features/session/LoginScreen.tsxweb/src/app/features/session/sessionDomain.tsweb/src/app/features/session/setup/ReviewStage.tsxweb/src/app/features/session/useSessionScreensState.ts