[Bug] Login OAuth URL output is truncated/mangled at terminal border, rendering auth link unusable
What happened?
When initiating the authentication flow, the CLI outputs a long OAuth URL. However, the output formatter fails to handle line wrapping correctly at the terminal border. Specifically, the last character of each line is being swallowed or overwritten by the line break or the border (happens randomly in my case). This corrupts the URL parameters (e.g., user becomes usr, content becomes cntent), making the URL invalid unless the user manually reconstructs the missing characters.
The copied URL is like:
https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=...&scope=...usrinfo.email...&client_id=...googleusercntent.com
Which should be:
https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=...&scope=...userinfo.email...&client_id=...googleusercontent.com
What did you expect to happen?
The URL should wrap cleanly without losing characters, or be printed without boarder deco to make it easier to copy. Currently the url needs to be joined and fixed by hand after copying.
Client information
Client Information
Run gemini to enter the interactive CLI, then run the /about command.
> /about
About Gemini CLI
CLI Version 0.18.4
Git Commit 2e8d7831c
Model auto
Sandbox no sandbox
OS win32
Auth Method OAuth
User Email <...>
I'm on windows 10 and using cmd.exe to launch gemini.
Login information
By using browser authentication, however gemini only launches the default browser which I'm logging no account on, so I need to manually copy the link and open it.
Anything else we need to know?
After the initial login fail, if I exit gemini and launch it the second time, it won't print the OAuth URL link on screen. Instead, it will try to launch the browser and hang there. I need to manually delete the ~/.gemini folder to get the TUI back.
Found possible duplicate issues:
- #12137
- #13349
- #12893
- #12387
If you believe this is not a duplicate, please remove the status/possible-duplicate label.
I would suggest modifying the CLI to output the auth URL to a temporary file (e.g., inside ~/.gemini) as a fallback. Since this wrapping issue persists despite several fix attempts, and is blocking people from using this, I think we need a mechanism that doesn't rely on terminal rendering. Alternatively, implementing a --text-login flag to output only the link string would be a another sufficient workaround. The priority should be ensuring authentication isn't blocked by cosmetic formatting errors.
I've also seen this bug with the URL outputted by the /bug command. Normally that just results in mysteriously missing characters in the issue description, but it can produce a broken link if you're unlucky (which is how someone noticed it).
In other words, there's evidence that this is a broader issue with terminal rendering, rather than something narrowly affecting just the login URLs.
In other words, there's evidence that this is a broader issue with terminal rendering, rather than something narrowly affecting just the login URLs.
Agreed. Ideally, there should be an option for users to choose the non-TUI based plain cli. This would eliminate many mysterious issues including copy-pasting and rendering glitches.