Repository navigation
[3844 by Claude Opus 5.5] Extensions: OpenCode 2.x runtime (MCP servers, skills, ProPR MCP) - #3861
Conversation
OpenCode 2.x runs now receive extension MCP servers, skill bundles and the `propr` MCP server, and OpenCode 1.x stays unsupported. I checked this against a real OpenCode 2.4.2 install with a mock model: - The run sees only its own servers and skill. - A stdio stub through the bridge receives its secret. - The gateway gets the bearer token. - `execute` steps display under the tool names they called. The base branch didn't have #3820. The epic branch was cut before OpenCode 2.4.2 landed on `main`, so I applied #3820's own diff unchanged (it applied cleanly). Those identical lines should merge cleanly when the epic picks up `main`, but the diff includes #3820's 26 files, not just this issue's. How it works - Config: the builder is in `packages/core/src/agents/mcpLaunch/openCodeMcpLaunch.ts`, registered as `opencode`. It writes `mcp.servers` and `skills.paths` into `OPENCODE_CONFIG_CONTENT`, merged with any existing inline config, in the shape from the issue. - Secrets: remote servers use `Bearer {env:VAR}`. Tokens and stdio secrets reach the container as `-e NAME` only; their values are never in arguments or config. - Launch: `OpenCodeAgent.executeTask` sets `extensionAgentLaunch` and passes the variables through the docker process environment. The container now joins the policy's Docker network, so `propr` at `api:4000` is reachable. - Exclusive mode: an inline empty `mcp.servers` does not remove host servers on 2.4.2, because OpenCode deep-merges its config sources. So I used the disposable config dir: - The launcher sets `OPENCODE_CONFIG_PROJECT_DISABLE=1`, `OPENCODE_DISABLE_CLAUDE_CODE=1` and an empty `OPENCODE_CONFIG`. - `scripts/opencode-entrypoint.sh` builds a copy of the host config dir with `mcp` and `skills` stripped and the `skills/` folders left out. Everything else links back to the host dir, so the user's providers still work. - The mounted host dir is never changed, and the run fails if a config file can't be rewritten. - Skills: OpenCode loads the staged bundles natively and uses the bundle folder name as the skill id. The prompt pointer is still added. - Display: an `execute` step that called tools now shows under their names (e.g. `docs.lookup`) with the call's input, in both the live view and persisted logs. A script that called no tool stays an `execute` step. - Capability map: OpenCode is turned on with the existing 2.x-only condition. Beyond the issue text - An agent pinned to 1.x now fails a run that has servers or skills with a clear error instead of silently ignoring them. - The automation save checks and the UI now take the agent's CLI version into account. To do that, the instance catalog gained an optional `cliVersion` field. - Updated the UI hints, docs, CHANGELOG and the OpenAPI description, and regenerated the OpenAPI spec and client types. - Tests that used OpenCode as the "unsupported runtime" example now use OpenCode pinned to 1.19.6. One gap: OpenCode always loads `~/.agents/skills` from the container home, and no setting turns that off. The agent image doesn't create that folder, so nothing loads from it today. Tests: all pass. - The new `test/openCodeExtensionRuntime.test.ts` covers: - a config snapshot for each server kind, with no secrets in arguments, config or serialized results - the exclusive switches overriding the user's own env vars, and the 1.x refusal - the entrypoint step, including the failing case - the bridge smoke test - both parsers, using a captured real 2.4.2 output fixture - Its live end-to-end case only runs when `PROPR_OPENCODE_BIN` is set. It passed against 2.4.2, with host, project and `~/.claude` servers and skills all excluded. - I added OpenCode cases to `extensionTaskAutoApply` and `extensionPackageServers`. - The related root, core, API and UI suites pass. - ESLint is clean with zero warnings, and the core, API, shared and UI typechecks are clean. - Some root suites need `--experimental-test-module-mocks` to run locally. I captured two previews of the automation editor with an OpenCode 1.x agent selected: the new Additional extensions hint, and the locked ProPR tools hint. ProPR-Agent: claude/claude-opus-5-5
|
/ultrafix goal=8 max=8 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 8) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
CI failed: Full Test Suite Shard 3/4 Please investigate and fix this CI failure.
Failure evidence
|
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR implements OpenCode 2.x extension support across launch configuration, capability gates, credentials, and tool displays. It needs localized corrections before merge. ✅ Secret transport — Generated MCP configuration references environment variables; Docker receives secret variable names rather than their values. ✅ Tool display consistency — Both output parsers use the same Code Mode helper, with captured-output coverage. ✅ Version-aware automation gates — Automation validation and the editor distinguish pinned OpenCode 1.x agents from supported versions. The supplied check status has no failures and four pending checks. This review is based on static analysis; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Preserve existing inline launch configuration
F2: 🔴 Accept comments after trailing commas
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe integration has substantial targeted coverage and consistent launch plumbing, but two configuration regressions can prevent otherwise valid runs. Both fixes are localized; pending checks still need to complete. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 4b51a79 Summary of ChangesI fixed the Shard 3/4 failure. It was one stale test, not a code bug. Cause: in Fix: that assertion now passes Verification: that file now passes 11/11, and all of There are no visual changes, so I made no preview. Review digestRisk-tiered paths
Diff size: 1 file changed, +1/−1 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed the Shard 3/4 failure. It was one stale test, not a code bug. **Cause:** in `packages/shared/test/extensionLibrary.test.ts`, the case "explicit entries that are missing, disabled or out of limits are skipped with a reason" uses OpenCode with no version as its example of a runtime that can't receive extensions. Its last assertion expected the `docs` server to be skipped with reason `runtime`. This PR turns extensions on for OpenCode 2.x, and a runtime with no version gets the mapped capabilities. So `docs` now applies, `skipped` is empty, and `skipped[0].reason` threw `Cannot read properties of undefined (reading 'reason')`. **Fix:** that assertion now passes `cliVersion: '1.19.6'`, the same OpenCode 1.x pin this PR already uses in the other "unsupported runtime" tests. It's a one-line change, and it still checks the skip with reason `runtime`. **Verification:** that file now passes 11/11, and all of `packages/shared/test/*.test.ts` passes (136 pass, 0 fail). This was the only failing test in the shard; the other 281 files passed. There are no visual changes, so I made no preview. PR: #3861 Comment by: @propr-dev[bot] (ID: 7229795304) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ Applied the requested follow-up changes in commit faa5442
Summary of ChangesI fixed F2 and added regression tests for both findings. I did not change the F1 production code, because the failure it describes can't happen in the current code. F2 (fixed) —
The new test fails against the old entrypoint and passes with the fix. F1 (stated failure doesn't occur; regression added) — The review's trace assumes an agent's own Making the agent's value merge into the launch would mean reversing that #3031 hardening decision, which is a policy change beyond this finding. I added a Docker-argument test instead. It sets an inline provider in the agent's Other notes:
Verification: Review digestRisk-tiered paths
Diff size: 2 files changed, +67/−21 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F2 and added regression tests for both findings. I did not change the F1 production code, because the failure it describes can't happen in the current code.
**F2 (fixed)** — `scripts/opencode-entrypoint.sh`: the JSONC cleanup now runs in two passes, both of which skip over string contents. Comments are removed first and trailing commas second. Before, comments and commas were handled in a single pass, so a comma followed by a comment and then `}` or `]` was kept. Block comments are replaced with a space so the tokens on either side don't join. The new entrypoint test covers:
- `{"model":"acme/m", /* explanation */ }`
- a trailing comma before a `//` line comment in an array
- several comments after a trailing comma
- a string value containing `, }`, `//` and `/* */`, which must come through unchanged
The new test fails against the old entrypoint and passes with the fix.
**F1 (stated failure doesn't occur; regression added)** — The review's trace assumes an agent's own `OPENCODE_CONFIG_CONTENT` reaches the Docker arguments through `...envVars`. It doesn't. `openCodeEnvForwarding.ts` lists `OPENCODE_CONFIG_CONTENT` as a ProPR-managed variable, so `buildEnvVars` drops it with the warning "Skipping OpenCode env var managed by ProPR". That rule is unchanged from `main` (it came in with #3031). So there is never an earlier assignment for the run's config to override, and passing `undefined` on the normal-task path is correct. The only existing inline config a run can have is the scout config, and the scout path already merges into it and emits it once.
Making the agent's value merge into the launch would mean reversing that #3031 hardening decision, which is a policy change beyond this finding. I added a Docker-argument test instead. It sets an inline provider in the agent's `envVars` and checks two runs, one with extension servers in exclusive mode and one with only the ProPR server. In both there is exactly one `OPENCODE_CONFIG_CONTENT` assignment and it is the run's config. With no tool policy there is none.
**Other notes:**
- A provider set through `OPENCODE_CONFIG_CONTENT` in the agent's variables has always been dropped, with or without this PR. Inline provider settings only work through the mounted config directory, which the exclusive-mode entrypoint keeps. If merging the agent's own inline config is wanted, it needs a separate decision about that hardening rule.
- I ran `git stash` by mistake while checking lint. It failed because the git directory is read-only, so nothing changed, and both edited files are intact.
**Verification:** `test/openCodeExtensionRuntime.test.ts` passes, 20 of 20. The live OpenCode case is skipped because it needs `PROPR_OPENCODE_BIN`. `bash -n` finds no syntax errors in the entrypoint. ESLint has no config that covers `test/`, so the test file isn't linted.
PR: #3861
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds OpenCode 2.x extension support across configuration, launch, capability checks, and tool-call display. The runtime upgrade and credential handling support that integration. No merge-blocking defect was verified from the supplied diff and context. Merge readiness is conditional on the five pending checks completing successfully. ✅ Secret forwarding — The OpenCode launcher passes MCP credentials through environment-variable names, while generated configuration references those names. ✅ Exclusive configuration — Extension runs disable project and Claude configuration sources and remove ambient MCP and skill settings from disposable host-config copies. Invalid configuration aborts preparation. ✅ Consistent tool display — Live and persisted parsers share the Code Mode display helper, with captured-output coverage for multiple calls and scripts that call no tools. This was a static review; no commands or tests were run. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Exercise live integration in CIThe real-runtime test in S2: 🟢 Coordinate legacy credential writesIn ScoreThe implementation addresses the objective with substantial targeted coverage and no verified introduced blocker. The supplied check status reports no failures, with five checks still pending; runtime verification was not independently repeated in this review. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3844
Branch:
3844/claude-opus-5-5-extensions-opencode-2-x-r-20261127-2200-4tjCommits: ✅ Changes committed (081ef6f)
AI Processing Completed
Execution Details:
Summary:
OpenCode 2.x runs now receive extension MCP servers, skill bundles and the
proprMCP server, and OpenCode 1.x stays unsupported. I checked this against a real OpenCode 2.4.2 install with a mock model:executesteps display under the tool names they called.The base branch didn't have #3820. The epic branch was cut before OpenCode 2.4.2 landed on
main, so I applied #3820's own diff unchanged (it applied cleanly). Those identical lines should merge cleanly when the epic picks upmain, but the diff includes #3820's 26 files, not just this issue's.How it works
packages/core/src/agents/mcpLaunch/openCodeMcpLaunch.ts, registered asopencode. It writesmcp.serversandskills.pathsintoOPENCODE_CONFIG_CONTENT, merged with any existing inline config, in the shape from the issue.Bearer {env:VAR}. Tokens and stdio secrets reach the container as-e NAMEonly; their values are never in arguments or config.OpenCodeAgent.executeTasksetsextensionAgentLaunchand passes the variables through the docker process environment. The container now joins the policy's Docker network, sopropratapi:4000is reachable.mcp.serversdoes not remove host servers on 2.4.2, because OpenCode deep-merges its config sources. So I used the disposable config dir:OPENCODE_CONFIG_PROJECT_DISABLE=1,OPENCODE_DISABLE_CLAUDE_CODE=1and an emptyOPENCODE_CONFIG.scripts/opencode-entrypoint.shbuilds a copy of the host config dir withmcpandskillsstripped and theskills/folders left out. Everything else links back to the host dir, so the user's providers still work.executestep that called tools now shows under their names (e.g.docs.lookup) with the call's input, in both the live view and persisted logs. A script that called no tool stays anexecutestep.Beyond the issue text
cliVersionfield.One gap: OpenCode always loads
~/.agents/skillsfrom the container home, and no setting turns that off. The agent image doesn't create that folder, so nothing loads from it today.Tests: all pass.
test/openCodeExtensionRuntime.test.tscovers:PROPR_OPENCODE_BINis set. It passed against 2.4.2, with host, project and~/.claudeservers and skills all excluded.extensionTaskAutoApplyandextensionPackageServers.--experimental-test-module-mocksto run locally.I captured two previews of the automation editor with an OpenCode 1.x agent selected: the new Additional extensions hint, and the locked ProPR tools hint.
Review digest
Risk-tiered paths
scripts/opencode-credentials.py(added, +141/−0): auth-looking path.gitignore(+4/−0)Dockerfile.agent(+9/−5)docker/Dockerfile.app.prod(+1/−0)packages/api/openapi/schemas.ts(+1/−1)packages/api/routes/instanceCatalogRoutes.ts(+2/−0)packages/api/routes/liveDetailsOpenCodeParser.ts(+6/−4)packages/api/services/redisOutputParser.ts(+5/−1)packages/client/src/generated/apiTypes.ts(+1/−1)packages/core/src/agents/agentToolPolicy.ts(+1/−1)packages/core/src/agents/impl/OpenCodeAgent.ts(+8/−5)packages/core/src/agents/impl/openCodeCodeMode.ts(added, +65/−0)packages/core/src/agents/impl/openCodeUtils.ts(+61/−10)packages/core/src/agents/impl/utils/repositoryScoutMcpServer.ts(+21/−17)packages/core/src/agents/mcpLaunch/index.ts(+3/−0)packages/core/src/agents/mcpLaunch/openCodeMcpLaunch.ts(added, +106/−0)packages/core/src/agents/types.ts(+1/−1)packages/core/src/agents/version/types.ts(+3/−2)packages/core/src/agents/version/versionService.ts(+4/−1)packages/core/src/index.ts(+1/−0)packages/core/src/services/agents/agentRunTrigger.ts(+14/−9)packages/shared/src/agentRuntimeCapabilities.ts(+5/−4)packages/shared/src/instanceCatalog.ts(+2/−0)packages/shared/src/modelDefinitions.ts(+2/−2)propr-ui/src/components/Agents/AgentCapabilitiesSection.tsx(+1/−1)propr-ui/src/components/Agents/useAgentEditor.ts(+1/−1)propr-ui/src/components/Extensions/AdditionalExtensionsSelector.tsx(+1/−1)propr-ui/src/pages/SettingsPage/settingsCategoryGuides.ts(+1/−1)scripts/build-images.sh(+2/−1)scripts/generate-notices.sh(+3/−3)scripts/opencode-entrypoint.sh(+124/−0)scripts/opencode-run.sh(+8/−2)scripts/smoke-test-images.sh(+28/−0)CHANGELOG.md(+16/−0)THIRD_PARTY_LICENSES.md(+2/−2)docs/docs/architecture/agent-runtime.md(+4/−13)docs/docs/features/agent-extensions.md(+55/−7)docs/docs/features/agents-and-models.md(+1/−1)docs/docs/tutorials/setup-vps.md(+1/−1)docs/static/openapi/propr-api.yaml(+1/−1)packages/api/test/taskSubmissionExtensions.test.ts(+4/−4)packages/api/test/taskSubmissionRoutes.test.ts(+7/−6)packages/cli/README.md(+2/−3)packages/core/test/extensionPackageServers.test.ts(+21/−1)packages/core/test/extensionProfiles.test.ts(+2/−1)packages/core/test/extensionTaskAutoApply.test.ts(+11/−0)packages/core/test/nativeLogPolicyLive.test.ts(+4/−4)propr-ui/e2e/automations.pw.ts(+1/−1)propr-ui/src/components/Agents/AgentEditor.test.tsx(+18/−4)test/agentDefinitionsContract.test.ts(+7/−3)Diff size: 60 files changed, +1,649/−190 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3844.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!
Visual preview
ProPR tools locked for OpenCode 1.x
Capabilities for an OpenCode agent pinned to CLI 1.19.6: ProPR tools and merging stay locked, with the hint naming the supported runtimes including OpenCode 2.x.
Full-size original
Additional extensions hint
Automation editor with an OpenCode agent: the Additional extensions hint now reads 'OpenCode agents need CLI 2.x' instead of listing only Claude, Codex and Vibe.
Full-size original