Fix: opencode run --attach should pass auth headers from env vars#16119
Fix: opencode run --attach should pass auth headers from env vars#16119hobostay wants to merge 1 commit intoanomalyco:devfrom
opencode run --attach should pass auth headers from env vars#16119Conversation
Fixes anomalyco#16096 When using `opencode run --attach=localhost:<port>` with OPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD env vars, the command failed with "Error: Session not found". This commit adds auth header support to the `run` command's `--attach` mode, matching the behavior of the `attach` TUI command. Changes: - Read OPENCODE_SERVER_PASSWORD and OPENCODE_SERVER_USERNAME env vars - Create Basic auth headers when password is provided - Pass headers to createOpencodeClient
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate found:
This appears to be addressing the exact same issue as PR #16119. Both are fixing the |
|
Closing as duplicate of #16097 which already fixes this issue with the correct title format. |
Fixes #16096
Description
When using
opencode run --attach=localhost:<port>withOPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD env vars,
the command failed with "Error: Session not found".
The
runcommand did not pass auth headers tocreateOpencodeClient,while the
attachTUI command correctly builds Basic auth headers from env vars.Changes
Modified
packages/opencode/src/cli/cmd/run.tsto:OPENCODE_SERVER_PASSWORDandOPENCODE_SERVER_USERNAMEenv varscreateOpencodeClientThis matches the behavior of the
attachTUI command inpackages/opencode/src/cli/cmd/tui/attach.ts.