Skip to content

fix: login form freezes on paste; login command never exits - #4

Merged
vinyex merged 1 commit into
mainfrom
fix/login-flow
Jul 2, 2026
Merged

vinyex merged 1 commit into
mainfrom
fix/login-flow

Conversation

@jpalanco

@jpalanco jpalanco commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the two login failures reported against the dev environment (browser flow errored, headless froze):

  • Paste froze the form: SmartTextInput (and the REPL input) dropped any stdin chunk longer than one character, so pasting plexicus@plexicus.ai did nothing and the form appeared hung. Multi-char chunks are now accepted with control characters stripped.
  • Paste + instant Enter submitted the old value: the submit handler read a stale closure; the latest value is now tracked in a ref.
  • Paste of a full line (trailing newline) never submitted: Ink only sets key.return for a lone CR, so an embedded newline now means insert-then-submit.
  • plexicus login never exited on success: LoginForm rendered null forever after done. A new onDone prop prints ✓ Authenticated as <email> and exits 0 (only wired in the login subcommand; the in-TUI AuthGate flow is unchanged).
  • Actionable errors: 401s now surface the backend's RFC 7807 detail (e.g. Incorrect email or password) instead of the generic Not authenticated, and connection failures include the target URL, so a stale serverUrl pointing at a down server is immediately diagnosable.

Root cause of the reported browser error

Not a TUI bug: POST /sessions on api.app.dev.plexicus.ai rejects the test credentials with Incorrect email or password — the same backend serves the web login, hence the browser error. The dev frontend does have the /auth/cli page and the /auth/cli/exchange endpoint, so the browser flow should work once valid dev credentials exist.

Test plan

  • bun run typecheck — zero errors
  • bun test — 54/54 pass
  • tmux E2E: paste email + Enter, paste password + Enter → form advances, API's real 401 detail displayed, no hang
  • Full success-path E2E (blocked on valid dev credentials)

- SmartTextInput and the REPL input dropped any stdin chunk longer than
  one char, so pasting an email froze the login form. Accept multi-char
  chunks, stripping control characters.
- A newline embedded in a pasted chunk now submits after inserting
  (Ink only sets key.return for a lone CR).
- Track the latest value in a ref: paste followed immediately by Enter
  submitted the pre-paste value from a stale closure.
- The login subcommand never exited after successful auth (LoginForm
  rendered null forever). New onDone prop prints the authenticated
  email and exits 0.
- Surface the backend's 401 detail (e.g. 'Incorrect email or password')
  instead of the generic 'Not authenticated', and include the target
  URL in connection errors so a wrong serverUrl is diagnosable.
@vinyex
vinyex merged commit f07ab50 into main Jul 2, 2026
1 check passed
@vinyex
vinyex deleted the fix/login-flow branch July 2, 2026 16:57
jpalanco pushed a commit that referenced this pull request Oct 24, 2026
… frame shapes' (#4) from ws-auth-subprotocol into main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants