Add WSL OpenCode runtime bootstrap#95
Conversation
📝 WalkthroughWalkthroughThis PR implements a complete WSL-specific OpenCode runtime bootstrap system that enables Settings-driven installation and repair of a loopback ChangesWSL OpenCode Runtime Bootstrap
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/server/src/provider/openCodeRuntimeBootstrap.ts`:
- Around line 284-289: The redactBootstrapMessage function currently mangles the
key name for client_secret; update its replacement so the key is preserved like
the token/password rule. In redactBootstrapMessage, change the client_secret
replace call (the regex matching (client_secret)=([^\s&]+)) to replace with the
original key and a redacted value (e.g., use the capture group to produce
"client_secret=<redacted>" or "$1=<redacted>") so the output pattern is
consistent with the token/password replacement and tests continue to remove
secrets.
- Around line 157-177: The final return that builds a "ready" snapshot is
unreachable because input.profileReachable is already handled earlier; remove
the redundant return block that constructs the "ready" snapshot (the snapshot
call referencing JCODE_OPENCODE_SERVICE_NAME, binaryPath, serverUrl, profileId
WSL_OPENCODE_PROFILE_ID and checkedAt input.now) so only the error branch and
any intended earlier ready return remain; ensure there are no leftover
references to that removed block in openCodeRuntimeBootstrap (check usages
around input.profileReachable and the snapshot helper).
In `@docs/runbooks/local-opencode-runtime.md`:
- Around line 145-162: The docs disagree on the generated helper script
location: update the design spec
(docs/superpowers/specs/2026-06-11-wsl-opencode-runtime-bootstrap-design.md) and
the implementation plan
(docs/superpowers/plans/2026-06-11-wsl-opencode-runtime-bootstrap.md) to match
the runbook canonical XDG path
(~/.local/share/jcode/runtime/opencode/jcode-opencode-start) or alternatively
change the runbook table row "OpenCode helper script" to the legacy
~/.local/bin/jcode-opencode-start—pick one canonical value and make the three
files consistent; specifically modify the string literal for the helper path in
each doc and adjust the explanatory note about legacy layouts so all three
documents (design, plan, runbook) state the same generated helper path and
rationale.
In `@docs/superpowers/plans/2026-06-11-wsl-opencode-runtime-bootstrap.md`:
- Around line 338-339: The test stub currently sets startScriptPath to the
legacy "/home/alice/.local/bin/jcode-opencode-start"; update the stub and any
related expectations to the XDG-based canonical path used by the Settings
bootstrap: "~/.local/share/jcode/runtime/opencode/jcode-opencode-start". Locate
the occurrence by searching for startScriptPath in the test stub and change its
value and any assertions that reference the old path to the new
Settings-generated path so tests align with the runbook and design spec.
In `@docs/superpowers/specs/2026-06-11-wsl-opencode-runtime-bootstrap-design.md`:
- Around line 129-133: Update the "Suggested generated artifacts" entry that
currently lists "~/.local/bin/jcode-opencode-start" so it uses the XDG-based
helper path "~/.local/share/jcode/runtime/opencode/jcode-opencode-start" and add
a brief note that this differs from older manual deployments which may have used
"~/.local/bin/jcode-opencode-start" as a legacy operator-chosen layout; make
sure the "~/.config/systemd/user/jcode-opencode.service" line remains unchanged
and that the spec text references the Settings bootstrap behavior documented
elsewhere.
In `@packages/contracts/src/providerDiscovery.ts`:
- Line 615: Replace the strict literal schema on serviceName with a more
flexible trimmed non-empty string: change the field currently declared as
serviceName: Schema.optional(Schema.Literal("jcode-opencode.service")) to use
the TrimmedNonEmptyString schema (or an equivalent Schema.String with
trim/length validation) so it no longer hardcodes the "jcode-opencode.service"
literal; update references to the symbol serviceName and keep optional
semantics, or if literal enforcement is intentional, add a comment referencing
JCODE_OPENCODE_SERVICE_NAME to document the invariant instead of changing
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d32458ac-cf39-4a05-824c-12cc617d45fa
📒 Files selected for processing (20)
apps/server/src/provider/openCodeRuntimeBootstrap.test.tsapps/server/src/provider/openCodeRuntimeBootstrap.tsapps/server/src/wsRpc.tsapps/web/src/components/OpenCodeRuntimeSettingsPanel.browser.tsxapps/web/src/components/OpenCodeRuntimeSettingsPanel.tsxapps/web/src/wsNativeApi.tsdocs/adr/0007-parallel-windows-wsl-backend-routing.mddocs/architecture/provider-runtime.mddocs/runbooks/README.mddocs/runbooks/local-deploy.mddocs/runbooks/local-opencode-runtime.mddocs/runbooks/update-local-stable-jcode.mddocs/superpowers/plans/2026-06-11-wsl-opencode-runtime-bootstrap.mddocs/superpowers/specs/2026-06-11-wsl-opencode-runtime-bootstrap-design.mdpackages/contracts/src/ipc.tspackages/contracts/src/providerDiscovery.tspackages/contracts/src/rpc.test.tspackages/contracts/src/rpc.tspackages/contracts/src/ws.test.tspackages/contracts/src/ws.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/superpowers/plans/2026-06-11-wsl-opencode-runtime-bootstrap.md (1)
106-106:⚠️ Potential issue | 🟠 MajorDocument or replace the
snipwrapper (and clarifyGIT_MASTER=1)
safe-runis documented indocs/testing/strategy.mdand enforced byscripts/run-vitest-browser.mjs(refuses to run browser tests without safe-run bounds unlessJCODE_BROWSER_TEST_SAFE_RUN=0).snipis referenced throughout this plan (e.g., thesnip bun run --cwd packages/contracts test src/ws.test.tscommand), but there’s no in-repo definition or documentation explaining whatsnipis or how to install/enable it—contributors can’t reliably execute these steps from repo docs alone.GIT_MASTER=1is mentioned in plan commands/checklists, but there’s no repo documentation describing what it does or where it’s implemented.Either (1) add a short “How to use
snip” section in the relevant dev-setup/runbooks doc, plus wheresnipcomes from, and documentGIT_MASTER, or (2) replacesnip ...with standardbun run ...equivalents in this plan.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/superpowers/plans/2026-06-11-wsl-opencode-runtime-bootstrap.md` at line 106, Replace or document the undocumented "snip" wrapper used in the plan and explicitly document the GIT_MASTER=1 env var: either (A) replace occurrences like the command string "snip bun run --cwd packages/contracts test src/ws.test.ts" with the equivalent standard invocation ("bun run ...") throughout the plan, or (B) add a short "How to use snip" subsection in the dev-runbooks (referencing docs/testing/strategy.md and scripts/run-vitest-browser.mjs) that explains where snip is provided, how to install/enable it, and any syntax, and also add a note that documents the purpose and expected behavior of the GIT_MASTER=1 environment variable and where it is implemented so contributors can run the steps reliably.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@docs/superpowers/plans/2026-06-11-wsl-opencode-runtime-bootstrap.md`:
- Line 106: Replace or document the undocumented "snip" wrapper used in the plan
and explicitly document the GIT_MASTER=1 env var: either (A) replace occurrences
like the command string "snip bun run --cwd packages/contracts test
src/ws.test.ts" with the equivalent standard invocation ("bun run ...")
throughout the plan, or (B) add a short "How to use snip" subsection in the
dev-runbooks (referencing docs/testing/strategy.md and
scripts/run-vitest-browser.mjs) that explains where snip is provided, how to
install/enable it, and any syntax, and also add a note that documents the
purpose and expected behavior of the GIT_MASTER=1 environment variable and where
it is implemented so contributors can run the steps reliably.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a1fc2f68-62a1-492a-b2bd-cd7280f237d2
📒 Files selected for processing (6)
apps/server/src/provider/openCodeRuntimeBootstrap.test.tsapps/server/src/provider/openCodeRuntimeBootstrap.tsdocs/superpowers/plans/2026-06-11-wsl-opencode-runtime-bootstrap.mddocs/superpowers/specs/2026-06-11-wsl-opencode-runtime-bootstrap-design.mdpackages/contracts/src/providerDiscovery.tspackages/contracts/src/rpc.test.ts
Summary
Test Plan
Summary by CodeRabbit
New Features
Documentation