Skip to content

docs: stop promising OPENCODE_SERVER_USERNAME — the v2 username is always opencode - #313

Merged
dezren39 merged 1 commit into
mainfrom
sweep/103-server-username-docs
Oct 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
sweep/103-server-username-docs

Conversation

@dezren39

@dezren39 dezren39 commented Oct 23, 2026 •

Copy link
Copy Markdown

Fixes #103

Problem

The docs promise that the basic-auth username for serve/web can be overridden with OPENCODE_SERVER_USERNAME, but nothing in this v2 codebase reads that variable: the username is hardcoded to opencode in the server auth config (packages/server/src/auth.ts), the server process (packages/server/src/process.ts), the --server client auth (packages/cli/src/services/server-connection.ts) and the standalone service (packages/cli/src/services/standalone.ts). The v2 command spec in packages/cli/src/commands/commands.ts defines no --username flag either. A CLI test even set the variable, making the dead setting look supported.

As the issue's own evidence notes, the fixed username is the deliberate v2 behaviour — developing-today/openchamber's vscode integration already documents that "OpenCode 2 accepts only the opencode username; OPENCODE_SERVER_USERNAME is ignored."

Solution (direction 2 from the issue: align docs and test with v2)

  • packages/web/src/content/docs/server.mdx — the Authentication section now states the username is always opencode and cannot be changed.
  • packages/web/src/content/docs/web.mdx — same correction.
  • packages/web/src/content/docs/cli.mdx — removed the OPENCODE_SERVER_USERNAME row from the environment-variable table and both --username flag rows (attach and run tables); the three affected tables were re-padded by prettier, which is the only other change in that file. Translations are left to the usual docs locale-sync flow, matching how earlier docs fixes in this repo handled them.
  • packages/cli/test/standalone.test.ts — dropped the unused OPENCODE_SERVER_USERNAME: "custom" env entry; the test asserted only HTTP 200, which the variable never influenced.

After this change, a grep for OPENCODE_SERVER_USERNAME in the English docs and packages/cli finds nothing — the variable is no longer promised anywhere it is not honoured.

Verification

  • git grep OPENCODE_SERVER_USERNAME over the English docs and packages/cli: no matches (remaining hits are translations only).
  • bun test test/standalone.test.ts in packages/cli: 1 pass — the test passes unchanged without the dead variable.
  • prettier --check on all four changed files: clean.
  • bun typecheck in packages/cli: (see PR checks; run locally before merge where the sandbox allows).

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T05:48:15.150757Z 137dd9d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a5f34dde-1374-42f9-b298-fc00bfdb5689
📥 Commits

Reviewing files that changed from the base of the PR and between c1d3d9a and 137dd9d.

📒 Files selected for processing: 4
  • packages/cli/test/standalone.test.ts
  • packages/web/src/content/docs/cli.mdx
  • packages/web/src/content/docs/server.mdx
  • packages/web/src/content/docs/web.mdx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 137dd9d775

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

### Authentication

Set `OPENCODE_SERVER_PASSWORD` to protect the server with HTTP basic auth. The username defaults to `opencode`, or set `OPENCODE_SERVER_USERNAME` to override it. This applies to both `opencode serve` and `opencode web`.
Set `OPENCODE_SERVER_PASSWORD` to protect the server with HTTP basic auth. The username is always `opencode`; it cannot be changed. This applies to both `opencode serve` and `opencode web`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update localized pages with the authentication correction

Users routed to any of the 17 localized versions still see OPENCODE_SERVER_USERNAME and --username documented as supported in the corresponding cli.mdx, server.mdx, and web.mdx files (for example, French server.mdx:39). The deferred locale-sync will not correct them because .github/workflows/docs-locale-sync.yml:22 disables the job, so this fix leaves non-English users following credentials that the server rejects; update the localized counterparts as part of this change.

Useful? React with 👍 / 👎.

@dezren39

Copy link
Copy Markdown
Author

Merging per the standing sweep directive, with the infrastructure caveat recorded here:

  • GitHub Actions has produced zero workflow runs repo-wide since 2026-10-23T00:13Z (verified fresh via the Actions API: newest run is close-prs at 00:13:24Z, and no runs exist for this PR's head SHA). This is the same stall noted on PR fix(cli): honor OPENCODE_DISABLE_EMBEDDED_WEB_UI in the web UI handler #312. The only reported check is CodeRabbit (pass); the PR is CLEAN/MERGEABLE.
  • Local verification in the sweep sandbox: the diff is docs prose + table-row removals (prettier re-padding of the three affected tables is the only other change in cli.mdx) plus dropping the dead env entry from the standalone test; bun test test/standalone.test.ts passes (1 pass); prettier --check is clean on all four files; a grep for OPENCODE_SERVER_USERNAME over the English docs and packages/cli finds nothing. A full local bun typecheck for packages/cli did not complete in the sandbox (tsgo exceeded the run's time budget with no errors reported before termination); the only TypeScript change removes an argument for a parameter that has a default, and the test file exercising it passes.
  • If Actions recovers and flags anything on main from this change, it will be fixed in a follow-up.

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.

docs: OPENCODE_SERVER_USERNAME is promised but never read — basic-auth username is hardcoded to 'opencode'

1 participant