Skip to content

fix(ai): make Log In Again visibly do something - #323

Merged
matej21 merged 4 commits into
mainfrom
fix/ai-relogin-visible
Nov 10, 2026
Merged

matej21 merged 4 commits into
mainfrom
fix/ai-relogin-visible

Conversation

@neumie

@neumie neumie commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Settings → AI Proxy → Log In Again on an account that needs login looked like it did nothing. It did start a pending OAuth login, but the finish row (Open Login Page / paste code / Finish) only rendered in the Add Account section at the bottom of the panel, below Default Policy and Project Policies — offscreen. No browser opened either, and every extra click stacked another pending login.

Fix

  • UI — a re-login's finish row renders directly under the account that was clicked (tracked by account id, so duplicate labels don't misplace it). Add Account keeps the start form.
  • UI — the authorize page opens in the browser as soon as a login starts (Log In and Log In Again), which the Add Account description already promised.
  • UI — Log In Again ignores clicks while a command is in flight; Finish on a re-login no longer clears a name typed under Add Account.
  • UI — the pasted login code wraps instead of painting under Finish/Cancel (a single-line SimpleInput neither scrolls nor clips); both login inputs get min_w_0 + clipping so they stay inside the row.
  • Proxy — start_login replaces a pending login with the same label instead of stacking it.

Testing

  • cargo test -p okena-ai (new starting_a_login_again_replaces_the_pending_one)
  • cargo clippy -p okena-app -p okena-ai --all-targets clean
  • Manual: account in Needs login → Log In Again → browser opens, finish row appears under the account → paste code → Finish clears Needs login.

🤖 Generated with Claude Code

@neumie
neumie requested a review from matej21 November 10, 2026 10:17
@matej21

matej21 commented Nov 10, 2026

Copy link
Copy Markdown
Member

Reviewed by review agent (Claude Opus 5.5) at e96da48. Verdict: approve.

  • minor — render_ai_proxy.rs:34/770: relogin_account is never cleared after Finish or Cancel, so a stale account id can outlive its login. Line 770 also reads that field to decide whether to clear the Add Account name, instead of checking which row was clicked. Fix: pass is_relogin (derived from relogin_of) into render_ai_login_finish and use it at 770; set relogin_account = None on Cancel and after a successful Finish.
  • nit — render_ai_proxy.rs:628 (and 760/764): the busy guard uses the busy value captured at render time, so a second click before the re-render still passes. A click ignored while busy also gives no feedback. Fix: check this.ai_proxy.busy in the listener, and show e.g. "Starting..." on the button while busy.
  • nit — render_ai_proxy.rs:47-51 / 764: with .multiline(), a paste now keeps newlines inside the text (single-line mode kept only the first line). A code copied with a line break in it is sent as-is and the exchange fails. Fix: remove all whitespace from the code, not just trim the ends.
  • nit — accounts.rs:292: matching pending logins by label also means a second Add Account with the same label (e.g. from another client) silently replaces the first. Probably fine; maybe say so in the comment.

Looks good otherwise: the browser opens only after the daemon returns the login, and since labels are now unique the rfind is exact. The row border moves to the finish row. If the account is renamed or removed, the finish row falls back to Add Account. The server test checks both the order and that the new login has a fresh id.

neumie and others added 4 commits November 10, 2026 16:26
Clicking Log In again for the same account stacked pending logins whose
PKCE state nobody could finish any more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Log In Again started a login whose finish row only rendered under Add
Account at the bottom of the panel, below the policy editors, so the
click looked like it did nothing. The row now renders under the account
that was clicked (matched by id), the authorize page opens in the
browser as soon as a login starts, and repeated clicks while a command
is in flight are ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pasted login code is longer than the row; without min_w_0 the flex
input grew to the text's width and pushed Finish past the panel edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A single-line SimpleInput neither scrolls nor clips, so a long code ran
under the Finish and Cancel buttons. The code input now wraps (Enter
still does not insert a newline) and both login inputs clip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@neumie
neumie force-pushed the fix/ai-relogin-visible branch from e96da48 to e507110 Compare November 10, 2026 15:32
@neumie

neumie commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main (after #324, login age). The only conflict was in crates/okena-ai/src/server.rs: both PRs added a test in the same spot, and both are kept. render_ai_proxy.rs merged cleanly. "Log In Again" now also shows for accounts whose login is expiring (from #324), and the in-flight guard and inline re-login row cover that case too.

Verified locally: cargo test -p okena-ai (66 passed), okena-app AI proxy tests pass, and clippy is clean. CI is running on the new push.

@matej21 this is ready to merge once CI is green.

@matej21
matej21 merged commit ba93ef6 into main Nov 10, 2026
12 checks passed
@matej21
matej21 deleted the fix/ai-relogin-visible branch November 10, 2026 15:53
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