Repository navigation
fix(cli): move the Windows service port out of the WSL mirrored range - #57428
Conversation
There was a problem hiding this comment.
The fix looks good: it's a constant change in the right place, and the comment, test and docs table match it. I couldn't run it on Windows/WSL, so I only checked it on Linux. With this change, the Windows default comes out as 28894 (28895 for local), and no Windows preview-channel port is now 32768 or above. On Linux the bot's #55918 script behaves the same before and after, as expected. The service tests and packages/cli typecheck pass.
Public API: only the default managed-service port on Windows changes, from 45278 to 28894. A port set with opencode service set port is unchanged, and clients find the service through the registration file. Only something that hardcodes 45278 would need updating.
This doesn't add a fallback when the default port can't be bound. So a Windows machine that reserves or uses 28894 will still hit the misleading "already in use by another process" error (#52234). That's fine for this PR, which keeps the fix small.
## Summary
- Qualify OpenCode **2.1.3** (latest stable, 22 October) with the
existing locked **2.1.0 client/plugin** dependencies, and **recommend**
it.
- Keep the technical **minimum at 2.1.2**: nothing CodeNomad consumes
changed, so the minimum has no new reason to move.
- A 2.1.2 daemon stays ready and gets an optional upgrade offer. 2.1.3
is the `tested` version. Newer and custom labels keep authenticated
contract recognition.
- The reviewed-contract fast path lists 2.1.3 beside the 2.1.2 minimum.
- The recommended version is updated in the help (all ten locales), both
READMEs, `dev-docs/OPENCODE_COMPATIBILITY.md` and the architecture
skill.
## Contract review (v2.1.2 → v2.1.3, 66 commits)
- **Authenticated OpenAPI:** 119 → **121 paths**, 144 → **146
operations**. Every consumed operation is unchanged. The only changes:
- added `GET /api/experimental/voice/models`;
- added `POST /api/experimental/voice/session/{sessionID}/instructions`;
- an optional hosted `session.id` in the `POST
/api/experimental/voice/session` response.
None of these is on the instance proxy allowlist, so they stay closed.
- **Published declarations:** the client adds only `voice.models` /
`voice.instructions`. The schema changes only typing (agent `color`
decoding, `Durable` as a tagged union). The plugin is unchanged.
- **Windows managed services** move their default port from **45278 to
28894** ([#57428](anomalyco/opencode#57428)).
CodeNomad discovers the daemon through the selected CLI's `service
status` and the service registration, and assumes no port.
- Live check: this machine's shared daemon was upgraded to 2.1.3 and
restarted on 28894, and the running CodeNomad desktop kept working
through it.
- **Core:** mostly refactors, plus behaviour fixes that the native
suites below exercise:
- compaction summary output limit;
- `keepID` validated as a message ID;
- MCP media kept out of attachments;
- only changed instruction entries resent;
- relative-directory V1 migration;
- legacy `apply_patch` permission mapped to `edit`.
## Isolated Windows qualification
Base: dev `333d73452`, rebased on `853b14f2f` (#1097) for the final UI
unit run; Node **24.20.0**; exact official CLI **2.1.3**; unchanged
locked client/plugin **2.1.0**.
- **Build and checks:** production server/UI/native plugin builds,
server and root typechecks, native bundle guard.
- **Native runtime (9/9):**
- Code Mode job ordering, plugin runtime, automation;
- complete pruning, history, ownership, worktree and event relay;
- loaded-only pending snapshot;
- Missions contract, family control, native and Compare/Wayfinder
trajectory.
- **Sessions (15/15):** environment, fork, aside, interrupt, lifecycle,
blank cleanup, prompt skills, provider usage/accounts/selection, service
usage, web search, plugin packages, output limit, Promise-tool failure.
- **Recurring (5/5):** all **11 recurring Mission journeys**, subagent
depth, **2 MiB** compaction, permission receipts.
- **Migrations (9/9):**
- history from **2.0.3, beta-19271, 2.0.32, 2.1.0, 2.1.1 and 2.1.2** to
2.1.3;
- Git degraded/init;
- temporary workspaces.
- **Installation (3/3), with the 2.1.3 recommendation:**
- fresh install of the 2.1.2 minimum;
- native **2.0.15 → 2.1.3** upgrade, after which the already-running
daemon keeps its PID and 2.0.15 version;
- explicit OpenCode **1.18.10 → 2.1.3** replacement.
- **After the recommendation change:**
- admission/transport/update/setup units **36/36**;
- full server **2,463 passed, 8 skipped**, no failure or cancellation;
- UI units **1,694/1,694** (with #1097);
- focused browser **126/126**;
- native pruning with the real rendered UI;
- the exact CI invocation of the Code Mode regression (without tsx);
- ten-locale help checks.
The UI unit run on `333d73452` itself had two failures, in
`instances-pending-compaction.test.ts` (`toast.dismiss is not a
function`). They come from #1096 and also fail on unmodified `dev`;
#1097 fixes that fixture.
This is Windows automation evidence. In CI, `latest` now resolves to
2.1.3: the compatibility job runs the native suites against the minimum
and latest on Windows, and the migration and Git-degraded certification
runs them on Ubuntu, Windows and macOS. WSL, packaged desktop,
installers/updater end-to-end and real mobile devices keep their
separate release gates.
Upstream's 52 commits bring Bun 1.4.4 (anomalyco#58087), whose TLS clients reject any chain holding one of the compromised eMudhra keys (oven-sh/bun#46300); Bun 1.4.3, which the fork pinned until now, still trusts them. They also move the Windows service's default port out of WSL's mirrored range, to 28894 (anomalyco#57428). Conflicts: - package.json, bun.lock: upstream's Bun 1.4.4 pins and lock, which bun install leaves unchanged. - codemode/web.ts: the fork's webfetch-gated fetch keeps its imports; `display` validates its arguments as upstream's does and keeps the fork's `Request` type. - config/plugin/command.ts: the fork's configured model, which the command target also names, without the branding upstream dropped. - permission.ts: upstream's `AssertInput` interface over `Request`, which carries the fork's `alternates`; it leaves out `reasons`, which the rules decide. - session.ts: the fork's delegators with upstream's unbranded model. - session/sql.ts: the fork's delegators column beside upstream's typed agent column. - session/runner/to-llm-message.ts: the fork's dropped-reasoning replay, comparing model refs without the String casts upstream dropped. - The cache test helper's session row brands its agent, which the agent column now types.
Issue for this PR
Closes #55918
Closes #56005
Related: #55907
Type of change
What does this PR do?
Moves the Windows default managed service port from 45278 (
0xB0DE) to 28894 (0x70DE).#55547 moved the Windows default out of the range Windows uses for outgoing connections (49152+), where Hyper-V and WinNAT reserve ports. But 45278 sits inside the block that WSL mirrored networking reserves for Linux: 4096 ports, usually 44620–48715 (microsoft/WSL#12228, microsoft/WSL#40169). Those ports don't show up in
netstatorexcludedportrange, so the service fails with "already in use by another process" while nothing is listening. Four users confirmed this: two in #55918, plus #56005 and #55907. All had44620 48715in/proc/sys/net/ipv4/ip_local_port_range, and a port outside it fixed the problem.Every WSL block reported so far is between about 37000 and 48700. 28894 is below 32768, so it's outside the outgoing-connection range on Windows, macOS and Linux, and outside those WSL blocks. IANA lists it as unassigned. The low 12 bits stay the same, like the last move. Preview channels whose hashed port is 32768 or higher move into the same block.
This is the smallest fix. A port that's set with
opencode service set portis unchanged. An existing service on 45278 gets replaced on upgrade through the usual version check, and clients find the new port through the registration file.How did you verify your code works?
bun test test/service.test.ts -t "managed service ports".bun typecheckinpackages/cli.bun typecheck,check:generatedandbuildinservices/www(docs table).Screenshots / recordings
N/A
Checklist
Added by the opencode bot (AI-generated).
Related: #55907, #52234, #50672
Public API: changes the default managed service port on Windows from 45278 to 28894 (configured ports unaffected)