Skip to content

fix(openclaw): load standing-server credential in ACP adapter (#4615) - #4655

Merged
dezren39 merged 1 commit into
mainfrom
queue/6521-4615-openclaw-credential
Nov 2, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6521-4615-openclaw-credential

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #4615 (queue task 6521).

Problem

The OpenClaw gateway launches bin/opencode-acp-adapter.mjs (acpx config in home/openclaw/default.nix) with no OPENCODE_SERVER_PASSWORD, and the adapter only read that env var — so requests from the configured launch path reached the password-protected standing opencode serve unauthenticated.

Change

The adapter now resolves the standing server's password the way the rest of the fleet does (pm-stack dispatch's OpenCodeClient, bin/openchamber-start.sh):

  • Precedence: OPENCODE_SERVER_PASSWORD env, then the JSON state file named by OPENCODE_AUTH_FILE (default ~/.local/state/opencode/service-prod.json, field password), read at runtime and cached per process (acpx launches a fresh adapter per gateway session).
  • Nothing is baked into tracked config or the Nix store; the value is never logged.
  • Missing state file → no auth (passwordless dev serve). Malformed or password-less state file → one stderr warning naming the file and the problem (never any value), requests go out unauthenticated so the serve's 401 names the real problem.

No change needed in home/openclaw/default.nix: the configured command line is unchanged and now authenticates as launched.

Tests

node --test bin/opencode-acp-adapter.test.mjs — 8/8 pass on the laptop:

  • Existing 5 adapter tests (harness made hermetic: tests no longer inherit a real env password or read the real state file).
  • New: gateway-launch-path coverage — adapter spawned with a fixture HOME containing a synthetic-password state file and no env password sends the expected Authorization header, and the synthetic value never appears on stderr.
  • New: OPENCODE_AUTH_FILE fixture authenticates; env password wins over the file.
  • New: malformed state file warns on stderr and sends no auth header, session flow unaffected.

Synthetic fixture values only; no real credential was read, copied, or logged.


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

The OpenClaw gateway launches bin/opencode-acp-adapter.mjs with no
OPENCODE_SERVER_PASSWORD, and the adapter only read that env var, so
requests to the password-protected standing opencode serve went out
unauthenticated from the configured launch path.

The adapter now resolves the password the way the rest of the fleet
does (pm-stack dispatch OpenCodeClient, bin/openchamber-start.sh):
env var first, then the JSON state file named by OPENCODE_AUTH_FILE
(default ~/.local/state/opencode/service-prod.json, field password),
read at runtime and cached per process. Nothing is baked into
tracked config or the Nix store and the value is never logged: a
missing file means no auth; a malformed or password-less file warns
once on stderr (path and problem only) and requests go out
unauthenticated so the serve 401 names the real problem.

Tests: hermetic credential resolution (tests never touch the real
env password or state file), gateway-launch-path coverage via a
HOME fixture with a synthetic password, env-over-file precedence,
and the malformed-file warning path. 8/8 node tests pass.
@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 23:20
@coderabbitai

coderabbitai Bot commented Nov 2, 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 10 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: 34a1bbee-f8ef-4fcf-9fbf-23c19e3fb992
Commits

Reviewing files that changed from the base of the PR and between 17610f5 and 70bbea5.

Files selected for processing: 2
  • bin/opencode-acp-adapter.mjs
  • bin/opencode-acp-adapter.test.mjs
  • 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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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-11-02T23:21:42.334936Z 70bbea5 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.

@dezren39
dezren39 merged commit 16e8e34 into main Nov 2, 2026
2 checks passed
@dezren39
dezren39 deleted the queue/6521-4615-openclaw-credential branch November 2, 2026 23:47
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.

openclaw ACP adapter: load the standing-server credential — gateway launch wires no OPENCODE_SERVER_PASSWORD (#3997)

1 participant