OPENCODE_SERVER_PASSWORD in env prevents user from working in TUI
Description
When setting the OPENCODE_SERVER_PASSWORD variable in the env file, the TUI cannot be used anymore.
This is the cli output:
➜ git:(master) opencode
Unauthorized
➜ git:(master) opencode --hostname 127.0.0.1 --port 4096
^[[?2027;0$y^[[?2031;0$y^[[?1004;2$y^[[?2004;2$y^[[?2026;0$yUnauthorized
^[[?2027;0$y^[[?2031;0$y^[[?1004;2$y^[[?2004;2$y^[[?2026;0$y^[[1;1R%
It would be desirable to be able to start opencode in the tui and also keep the web gui open (for notification sounds, checking in from other devices when networking is set up, personal preferences about using tui and web-gui concurrently, ...)
Plugins
No response
OpenCode version
1.1.16
Steps to reproduce
- Run
OPENCODE_SERVER_PASSWORD='secure-password' opencode
Screenshot and/or share link
No response
Operating System
macOS Sequoia
Terminal
Cursor / VSCode
This issue might be a duplicate of existing issues. Please check:
- #5256: [FEATURE]: Adding Authentication to
opencode serverapi
Feel free to ignore if none of these address your specific case.
This issue is sadly not fixed, could you please reopen the issue?
Setting the env variables for server password still leads to the TUI crashing / not starting:
OPENCODE_SERVER_PASSWORD='test' OPENCODE_SERVER_USERNAME="opencode" bun dev . --hostname localhost --port 4096
$ bun run --cwd packages/opencode --conditions=browser src/index.ts . --hostname localhost --port "4096"
^[[?1016;2$y^[[?2027;0$y^[[?2031;0$y^[[?1004;2$y^[[?2004;2$y^[[?2026;0$y^[[1;1R^[[1;1R^[[4;315;1351t^[[<35;27;8MUnauthorized
OPENCODE_SERVER_PASSWORD='test' bun dev . --hostname localhost --port 4096
$ bun run --cwd packages/opencode --conditions=browser src/index.ts . --hostname localhost --port "4096"
^[[?2027;0$y^[[?2031;0$y^[[?1004;2$y^[[?2004;2$y^[[?2026;0$y^[[1;1R^[[1;1R^[[4;315;1351tUnauthorized
➜ opencode git:(dev) 2027;0$y2031;0$y1004;2$y2004;2$y2026;0$yRR;315;1351t
Currently not sure why previously thought that this issue was solved. Maybe something changed in the codebase elsewhere in the meantime OR I probably just forgot to provide "--hostname" and "--port" flags when checking - a few version ago opencode changed its behaviour about not starting a server instance that way anymore and therefore doesnt crash.