Repository navigation
Add native OpenCode 2 support - #169
Conversation
… session host and defineTool - @opencode/plugin 2.0.31 is a dev dependency, external in the bundle; root index.js shim for OpenCode 2 directory plugins - src/host/port.ts: SessionHost, HostEvent, Workspace contracts shared by both adapters - src/host/v1.ts: createV1Host over the v1 client (runAgent, compact with summary wait, event normalization) and toV1Tool - src/tools/define.ts: host-agnostic tool definitions on zod
…otifies through the host
…ompletion
- unwrap the v1 client's { error } responses for create/prompt/summarize/abort instead of returning empty replies
- runAgent uses the blocking prompt's own reply and fails on a reply that carries a provider error
- compaction settles on session.compacted (or a completed summary message); a failed summary rejects and still emits session.error
- summary messages no longer feed assistant.usage (their token count is the pre-compaction size)
- extractErrorMessage reads { message } and the SDK's { data: { message } } payloads
…never leak rejections - session recovery: injectable settle/dedup timing, Recovery Complete only when the prompt went through, max-attempts path tested, dedup timers cleared on session delete - auto-compact: failed auto-continue is a warning, not a failed compaction; the background flow has a terminal catch - port: notify and remove are documented as best-effort
…ep the system prefix cache-stable - onEvent wraps every listener so one failure cannot hide an event from the rest - v1 prompt() uses promptAsync; the blocking prompt stays reserved for runAgent - a throwing summarize settles its waiter instead of leaking a timeout rejection - the context-window status is appended last instead of prepended to the system prompt - dispose releases PTY sessions; thinking options are built per request - tests capture startup probe logs so the suite output stays pristine
…rden the v2 smoke spec
- bash -> shell and task -> subagent, verified against the 2.0.31 binary's permission rules
- smoke spec: password is the last token (may hold underscores), API responses unwrap { data }, agents are polled until the lazily loaded plugin has registered them, commands and the translated commander permissions are asserted
…precedence, setup disposes on failure - a failed compaction message rejects like v1 instead of resolving with an empty summary - micode's agent rules go before the host's so the user's own rules win (last match wins on v2) - a half-registered setup disposes PTY and octto state before rethrowing - multi-part replies join with newlines and an empty user text reads as undefined, matching v1 - smoke spec buffers partial log lines so the server password is never truncated - tests cover the tool-hook catch, the event-stream catch, session recovery via events and unreadable agent extras
…e log after plugin setup - v1 config hook no longer overwrites a user's explicit edit/bash/webfetch/external_directory setting - v2 smoke: password parsed as the last token, log scan runs after the directory-scoped requests that load the plugin - docs: absolute path for v2 local installs, jq fallback on JSONC, port hints documented as advisory, stale comments
…lugin load failures
… instead of racing a 120s timeout
…s and model overrides
…er only for resumed sessions
…rn after compaction
…review lowercase write/edit tools
…compact so truncation stops using it
… entries keep unrelated files
…p the unused ones
There was a problem hiding this comment.
35 issues found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/hooks/session-usage.test.ts">
<violation number="1" location="tests/hooks/session-usage.test.ts:52">
P3: This assertion does not verify the fallback limit described by the test. Assert the expected default value so a regression to any other positive limit fails.</violation>
</file>
<file name="tests/hooks/fetch-tracker.test.ts">
<violation number="1" location="tests/hooks/fetch-tracker.test.ts:280">
P3: This replacement test bypasses the hook and core cleanup contract, so a broken `cleanupSession` integration could pass unnoticed. Call `hook.cleanupSession(testSessionID)` here, and cover the core event router separately if event-driven cleanup is required.</violation>
</file>
<file name="tests/hooks/context-window-monitor.test.ts">
<violation number="1" location="tests/hooks/context-window-monitor.test.ts:87">
P2: This deletion/reuse test does not verify that the session usage is cleared: it sends `session.deleted` only to the monitor, while production dispatches it to both state owners. Route the deletion through `usage.onEvent` as well and assert `usage.get("s1")` (and the suffix) is empty before recording the reused session.</violation>
</file>
<file name="INSTALL_CLAUDE.md">
<violation number="1" location="INSTALL_CLAUDE.md:67">
P2: Writing jq output to the predictable `/tmp/oc.jsonc` path can follow a pre-created symlink and overwrite an unrelated file. Create the temporary output with `mktemp` and move that unique path instead.</violation>
<violation number="2" location="INSTALL_CLAUDE.md:68">
P2: The OpenCode 2 branch ignores the existing `opencode.json` that the preceding check accepts. On an OpenCode 2 upgrade from OpenCode 1, `jq` fails on the missing `.jsonc` file and the command only prints a manual instruction, so micode is not installed; make the discovery and migration path version-specific.</violation>
<violation number="3" location="INSTALL_CLAUDE.md:103">
P2: The verification command always displays `opencode.jsonc`, even when the user selected OpenCode 1. Select the file from the installed major version so a stale file from the other host does not report a successful setup as broken.</violation>
</file>
<file name="tests/micode.test.ts">
<violation number="1" location="tests/micode.test.ts:148">
P3: This test never verifies that the recorded agent targets fragments. Add an agent-specific fragment fixture and assert its injected text, so a regression in `onRequest` agent routing fails.</violation>
</file>
<file name="tests/hooks/auto-compact.test.ts">
<violation number="1" location="tests/hooks/auto-compact.test.ts:71">
P2: This second invocation never exercises the cooldown: successful compaction resets the usage tracker, so `hook.onEvent(event)` returns before checking `lastCompactTime`. Record the over-threshold usage event again before invoking the hook to verify a fresh event is suppressed by cooldown.</violation>
</file>
<file name="tests/host/v1.test.ts">
<violation number="1" location="tests/host/v1.test.ts:446">
P2: The assertion checks only three representative tools, so it cannot catch missing v1 registrations for the other Micode tools. Assert the complete expected key set, or add every required tool name to this registration test.</violation>
<violation number="2" location="tests/host/v1.test.ts:552">
P2: This test covers MCP precedence but not MCP registration. Also configure a host with only `custom`, then assert the default `context7` command is added while a separate host-owned `context7` entry remains unchanged.</violation>
<violation number="3" location="tests/host/v1.test.ts:612">
P2: This test does not verify that the v1 hook routes output through the core pipeline. Use an input with a deterministic pipeline effect, such as an oversized `ast_grep_search` result, and assert the output changes.</violation>
</file>
<file name="src/hooks/auto-compact.ts">
<violation number="1" location="src/hooks/auto-compact.ts:77">
P2: This marks the session resumed even when no ledger was written. The next continuation can therefore fall back to and inject another session's ledger; mark it resumed only after a successful session-specific ledger write.</violation>
<violation number="2" location="src/hooks/auto-compact.ts:132">
P2: Clearing `inProgress` does not cancel an already detached `compactSession`; it can finish after deletion, write a ledger, mark the session resumed, and prompt the deleted ID. Track cancellation or a generation and check it before post-compaction side effects.</violation>
</file>
<file name="src/config-schemas.ts">
<violation number="1" location="src/config-schemas.ts:8">
P2: This pattern accepts whitespace-only provider/model segments, so malformed model configuration can replace every agent's model with an unresolvable reference when no provider list is available for later validation. Reject whitespace in the provider and model segments before accepting the selection.</violation>
<violation number="2" location="src/config-schemas.ts:17">
P3: `provider/model#` is silently normalized to `provider/model` because the truthiness check drops an empty variant, so a malformed selector is accepted without the warning promised by the validator. Reject empty variants explicitly.</violation>
<violation number="3" location="src/config-schemas.ts:126">
P2: A normalized override with `model: "unknown/model#high"` keeps `variant: "high"`; when model validation rejects it, `applyUserOverride` strips only `model` and applies that variant to the fallback model. Remove `variant` alongside rejected model overrides.</violation>
</file>
<file name="package.json">
<violation number="1" location="package.json:64">
P2: The published `types` entrypoint now depends on `@opencode/plugin`, but production installs do not include this dev dependency. Declare the host SDK as an appropriate optional peer or publish declarations that do not require resolving the host-only package.</violation>
</file>
<file name="src/micode.ts">
<violation number="1" location="src/micode.ts:525">
P2: This two-phase mindmodel call shares one pending injection across sessions, so concurrent OpenCode 2 requests can receive another session's examples or no examples at all. Make the pending injection session-scoped, or pass the matched injection directly into the system transform.</violation>
<violation number="2" location="src/micode.ts:568">
P2: OpenCode 2 discards the final constraint-review violation text: this pipeline throws after mutating a local output, and the v2 adapter only copies that output after the promise resolves. Preserve the mutated output while still signaling the violation to OpenCode 1, or return a result that carries both the content and the failure.</violation>
</file>
<file name="src/utils/patch.ts">
<violation number="1" location="src/utils/patch.ts:44">
P2: `patchedFiles` parses headers after `*** End Patch` (and before `*** Begin Patch`), so post-processing can review or track files the host never changed. Restrict parsing to the lines between the two patch markers, matching OpenCode's parser.</violation>
</file>
<file name="src/config-loader.ts">
<violation number="1" location="src/config-loader.ts:100">
P2: `loadOpencodeSettings` promotes the root model selector's `variant` to every Micode agent. OpenCode 2 does not retain a variant on the root catalog default, so `model: "openai/gpt-5#high"` changes all agents to `#high`; return only the normalized ref here.</violation>
</file>
<file name="README.md">
<violation number="1" location="README.md:34">
P2: This says disabled tools are denied and that writes require both tool toggles to be disabled, but v2 collapses these tools into one action. A single `tools.patch: false` or `tools.edit: false` does not deny the shared action, while an explicit `permission.edit: deny` does deny writes independently.</violation>
<violation number="2" location="README.md:38">
P2: An override such as `gpt-5` does not always fall back to OpenCode's default: without an `opencode.json` model, the agent keeps micode's `openai/gpt-5.3-codex` fallback. Describe the fallback as the configured OpenCode model, or micode's fallback when none is configured.</violation>
</file>
<file name="src/hooks/token-aware-truncation.ts">
<violation number="1" location="src/hooks/token-aware-truncation.ts:6">
P2: This removes the existing `Grep` and `Glob` aliases, so results reported with those tool names now bypass context-aware truncation. Retain both spellings or normalize the tool name.</violation>
<violation number="2" location="src/hooks/token-aware-truncation.ts:95">
P1: `usage.get` can be stale or empty when tool output is truncated because OpenCode 2 reports usage at `session.step.ended`, after the tool step. The fallback can then allow 50,000 tokens near the context limit, defeating truncation and causing context-window failures; refresh or update usage before processing each tool result.</violation>
</file>
<file name="tests/hooks/session-recovery.test.ts">
<violation number="1" location="tests/hooks/session-recovery.test.ts:189">
P2: `SessionHost.notify` is best-effort and must not throw, but this test requires `onEvent` to reject when notification fails. Expect the event to resolve and assert that recovery continues, otherwise the test enshrines the broken behavior it claims to prevent.</violation>
</file>
<file name="tests/hooks/constraint-reviewer.test.ts">
<violation number="1" location="tests/hooks/constraint-reviewer.test.ts:216">
P3: This `apply_patch` test never creates the touched file, so it exercises the `readFile` fallback and cannot catch a regression that reviews patch status text instead of file content. Write `file` before invoking the hook and assert its content appears in the prompt.</violation>
</file>
<file name="e2e/v2/smoke.test.ts">
<violation number="1" location="e2e/v2/smoke.test.ts:90">
P2: A boot timeout leaks the spawned OpenCode process because `server` is assigned only after `startServer()` resolves, so `afterAll` skips its kill path when the password wait fails. Clean up the process in `startServer()` on any post-spawn failure, or expose the handle before awaiting startup.</violation>
</file>
<file name="tests/tools/mindmodel-lookup.test.ts">
<violation number="1" location="tests/tools/mindmodel-lookup.test.ts:29">
P3: This cleanup silently discards captured warnings and errors, so the tests can pass while the lookup takes a degraded path. Check `logs.unread()` before restoring the spies, as the log-capture helper requires.</violation>
</file>
<file name="tests/host/v2.test.ts">
<violation number="1" location="tests/host/v2.test.ts:261">
P3: This teardown whitelist is broad enough to hide unrelated regressions: any new warning or info message containing one of these substrings is silently accepted. Match the exact startup messages, or explicitly drain and assert only the known probe output.</violation>
</file>
<file name="tests/integration/bundle-runtime-compat.test.ts">
<violation number="1" location="tests/integration/bundle-runtime-compat.test.ts:74">
P2: This assertion does not prove that `@opencode/plugin` loads only on demand: a static SDK import can coexist with the counted dynamic import and still pass both checks. Assert that the bundle contains no non-dynamic import of `@opencode/plugin`, otherwise a regression can make the v1 host load the v2 SDK during module initialization.</violation>
</file>
<file name="src/tools/pty/pty-loader.ts">
<violation number="1" location="src/tools/pty/pty-loader.ts:87">
P2: `directory` is honored only for the first `loadBunPty` call because the module-wide cache returns before `probeBunPtyLib(directory)` on later calls. If two host instances use different project roots in one process, a later root can keep PTY disabled or use the first root’s native library; key the cache by directory or avoid caching this directory-specific probe.</violation>
</file>
<file name="src/hooks/artifact-auto-index.ts">
<violation number="1" location="src/hooks/artifact-auto-index.ts:11">
P2: The new allowlist still omits `edit`, so editing an existing ledger or plan never reaches `getArtifactIndex`. Include the native edit tool in artifact indexing.</violation>
</file>
<file name=".github/workflows/e2e.yml">
<violation number="1" location=".github/workflows/e2e.yml:38">
P3: This 155-character `run` line exceeds the repository's 120-character line-width convention. Split the Docker command across YAML lines so its arguments remain readable.</violation>
</file>
<file name="src/host/v1.ts">
<violation number="1" location="src/host/v1.ts:103">
P2: The v1 adapter reports usage before confirming the assistant message is complete. An intermediate `message.updated` with token data can trigger auto-compaction from a non-final context size; only emit usage for completed assistant messages.</violation>
</file>
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
| } | ||
| onToolResult: async ({ tool, sessionID, output }) => { | ||
| if (!TRUNCATABLE_TOOLS.includes(tool) || !output) return output; | ||
| const current = usage.get(sessionID); |
There was a problem hiding this comment.
P1: usage.get can be stale or empty when tool output is truncated because OpenCode 2 reports usage at session.step.ended, after the tool step. The fallback can then allow 50,000 tokens near the context limit, defeating truncation and causing context-window failures; refresh or update usage before processing each tool result.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/hooks/token-aware-truncation.ts, line 95:
<comment>`usage.get` can be stale or empty when tool output is truncated because OpenCode 2 reports usage at `session.step.ended`, after the tool step. The fallback can then allow 50,000 tokens near the context limit, defeating truncation and causing context-window failures; refresh or update usage before processing each tool result.</comment>
<file context>
@@ -99,62 +88,15 @@ function applyTruncation(text: string, maxTokens: number): string {
- }
+ onToolResult: async ({ tool, sessionID, output }) => {
+ if (!TRUNCATABLE_TOOLS.includes(tool) || !output) return output;
+ const current = usage.get(sessionID);
+ const maxTokens = current
+ ? calculateMaxOutputTokens(current.used, current.limit)
</file context>
| const event = usageEvent("s1", 900); | ||
| usage.onEvent(event); | ||
| await hook.onEvent(event); | ||
| await hook.onEvent({ type: "session.deleted", sessionID: "s1" }); |
There was a problem hiding this comment.
P2: This deletion/reuse test does not verify that the session usage is cleared: it sends session.deleted only to the monitor, while production dispatches it to both state owners. Route the deletion through usage.onEvent as well and assert usage.get("s1") (and the suffix) is empty before recording the reused session.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/hooks/context-window-monitor.test.ts, line 87:
<comment>This deletion/reuse test does not verify that the session usage is cleared: it sends `session.deleted` only to the monitor, while production dispatches it to both state owners. Route the deletion through `usage.onEvent` as well and assert `usage.get("s1")` (and the suffix) is empty before recording the reused session.</comment>
<file context>
@@ -1,315 +1,93 @@
+ const event = usageEvent("s1", 900);
+ usage.onEvent(event);
+ await hook.onEvent(event);
+ await hook.onEvent({ type: "session.deleted", sessionID: "s1" });
+ usage.onEvent(event);
+ await hook.onEvent(event);
</file context>
| await hook.onEvent({ type: "session.deleted", sessionID: "s1" }); | |
| const deletion = { type: "session.deleted" as const, sessionID: "s1" }; | |
| usage.onEvent(deletion); | |
| await hook.onEvent(deletion); | |
| expect(usage.get("s1")).toBeUndefined(); | |
| expect(hook.systemSuffix("s1")).toBe(""); |
| opencode --version # Should be 1.0.132 or higher | ||
| cat ~/.config/opencode/opencode.json # Should contain "micode" in plugin array | ||
| opencode --version # OpenCode 2.x, or OpenCode 1.18.29 or higher | ||
| cat ~/.config/opencode/opencode.jsonc 2>/dev/null || cat ~/.config/opencode/opencode.json # Should list "micode" |
There was a problem hiding this comment.
P2: The verification command always displays opencode.jsonc, even when the user selected OpenCode 1. Select the file from the installed major version so a stale file from the other host does not report a successful setup as broken.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At INSTALL_CLAUDE.md, line 103:
<comment>The verification command always displays `opencode.jsonc`, even when the user selected OpenCode 1. Select the file from the installed major version so a stale file from the other host does not report a successful setup as broken.</comment>
<file context>
@@ -78,8 +99,8 @@ echo '{"plugin":["micode"]}' > ~/.config/opencode/opencode.json
-opencode --version # Should be 1.0.132 or higher
-cat ~/.config/opencode/opencode.json # Should contain "micode" in plugin array
+opencode --version # OpenCode 2.x, or OpenCode 1.18.29 or higher
+cat ~/.config/opencode/opencode.jsonc 2>/dev/null || cat ~/.config/opencode/opencode.json # Should list "micode"
</file context>
</details>
```suggestion
if [[ "$(opencode --version)" == 2.* ]]; then cat ~/.config/opencode/opencode.jsonc; else cat ~/.config/opencode/opencode.json; fi # Should list "micode"
| jq '.plugins = ((.plugins // []) + ["micode"] | unique)' \ | ||
| ~/.config/opencode/opencode.jsonc > /tmp/oc.jsonc && \ | ||
| mv /tmp/oc.jsonc ~/.config/opencode/opencode.jsonc || \ |
There was a problem hiding this comment.
P2: Writing jq output to the predictable /tmp/oc.jsonc path can follow a pre-created symlink and overwrite an unrelated file. Create the temporary output with mktemp and move that unique path instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At INSTALL_CLAUDE.md, line 67:
<comment>Writing jq output to the predictable `/tmp/oc.jsonc` path can follow a pre-created symlink and overwrite an unrelated file. Create the temporary output with `mktemp` and move that unique path instead.</comment>
<file context>
@@ -58,7 +58,28 @@ fi
+```bash
+if command -v jq &> /dev/null; then
+ # jq rejects comments; a JSONC file with comments falls through to the manual message.
+ jq '.plugins = ((.plugins // []) + ["micode"] | unique)' \
+ ~/.config/opencode/opencode.jsonc > /tmp/oc.jsonc && \
+ mv /tmp/oc.jsonc ~/.config/opencode/opencode.jsonc || \
</file context>
| jq '.plugins = ((.plugins // []) + ["micode"] | unique)' \ | |
| ~/.config/opencode/opencode.jsonc > /tmp/oc.jsonc && \ | |
| mv /tmp/oc.jsonc ~/.config/opencode/opencode.jsonc || \ | |
| tmp_file=$(mktemp) && \ | |
| jq '.plugins = ((.plugins // []) + ["micode"] | unique)' \ | |
| ~/.config/opencode/opencode.jsonc > "$tmp_file" && \ | |
| mv "$tmp_file" ~/.config/opencode/opencode.jsonc || \ |
| if command -v jq &> /dev/null; then | ||
| # jq rejects comments; a JSONC file with comments falls through to the manual message. | ||
| jq '.plugins = ((.plugins // []) + ["micode"] | unique)' \ | ||
| ~/.config/opencode/opencode.jsonc > /tmp/oc.jsonc && \ |
There was a problem hiding this comment.
P2: The OpenCode 2 branch ignores the existing opencode.json that the preceding check accepts. On an OpenCode 2 upgrade from OpenCode 1, jq fails on the missing .jsonc file and the command only prints a manual instruction, so micode is not installed; make the discovery and migration path version-specific.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At INSTALL_CLAUDE.md, line 68:
<comment>The OpenCode 2 branch ignores the existing `opencode.json` that the preceding check accepts. On an OpenCode 2 upgrade from OpenCode 1, `jq` fails on the missing `.jsonc` file and the command only prints a manual instruction, so micode is not installed; make the discovery and migration path version-specific.</comment>
<file context>
@@ -58,7 +58,28 @@ fi
+if command -v jq &> /dev/null; then
+ # jq rejects comments; a JSONC file with comments falls through to the manual message.
+ jq '.plugins = ((.plugins // []) + ["micode"] | unique)' \
+ ~/.config/opencode/opencode.jsonc > /tmp/oc.jsonc && \
+ mv /tmp/oc.jsonc ~/.config/opencode/opencode.jsonc || \
+ echo "Please add \"micode\" to the plugins array in ~/.config/opencode/opencode.jsonc"
</file context>
|
|
||
| const file = join(testDir, "test.ts"); | ||
| await hook["tool.execute.after"]( | ||
| { tool: "apply_patch", sessionID: "test", args: { patchText: "...", filePath: file } }, |
There was a problem hiding this comment.
P3: This apply_patch test never creates the touched file, so it exercises the readFile fallback and cannot catch a regression that reviews patch status text instead of file content. Write file before invoking the hook and assert its content appears in the prompt.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/hooks/constraint-reviewer.test.ts, line 216:
<comment>This `apply_patch` test never creates the touched file, so it exercises the `readFile` fallback and cannot catch a regression that reviews patch status text instead of file content. Write `file` before invoking the hook and assert its content appears in the prompt.</comment>
<file context>
@@ -131,21 +164,63 @@ categories:
+
+ const file = join(testDir, "test.ts");
+ await hook["tool.execute.after"](
+ { tool: "apply_patch", sessionID: "test", args: { patchText: "...", filePath: file } },
+ { output: "x" },
+ );
</file context>
| }); | ||
|
|
||
| afterEach(async () => { | ||
| logs.restore(); |
There was a problem hiding this comment.
P3: This cleanup silently discards captured warnings and errors, so the tests can pass while the lookup takes a degraded path. Check logs.unread() before restoring the spies, as the log-capture helper requires.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/tools/mindmodel-lookup.test.ts, line 29:
<comment>This cleanup silently discards captured warnings and errors, so the tests can pass while the lookup takes a degraded path. Check `logs.unread()` before restoring the spies, as the log-capture helper requires.</comment>
<file context>
@@ -0,0 +1,66 @@
+ });
+
+ afterEach(async () => {
+ logs.restore();
+ await Promise.all(dirs.map((dir) => rm(dir, { recursive: true, force: true })));
+ });
</file context>
| await cleanup?.(); | ||
| cleanup = undefined; | ||
| // Startup probes for ast-grep/btca/bun-pty log their findings; nothing else may. | ||
| const unexpected = [...logs.warn, ...logs.info].filter((l) => !STARTUP_PROBES.test(l)); |
There was a problem hiding this comment.
P3: This teardown whitelist is broad enough to hide unrelated regressions: any new warning or info message containing one of these substrings is silently accepted. Match the exact startup messages, or explicitly drain and assert only the known probe output.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/host/v2.test.ts, line 261:
<comment>This teardown whitelist is broad enough to hide unrelated regressions: any new warning or info message containing one of these substrings is silently accepted. Match the exact startup messages, or explicitly drain and assert only the known probe output.</comment>
<file context>
@@ -0,0 +1,1088 @@
+ await cleanup?.();
+ cleanup = undefined;
+ // Startup probes for ast-grep/btca/bun-pty log their findings; nothing else may.
+ const unexpected = [...logs.warn, ...logs.info].filter((l) => !STARTUP_PROBES.test(l));
+ logs.restore();
+ expect(unexpected).toEqual([]);
</file context>
| } | ||
|
|
||
| function selectionOf(ref: string, variant: string | undefined): ModelSelection { | ||
| return variant ? { ref, variant } : { ref }; |
There was a problem hiding this comment.
P3: provider/model# is silently normalized to provider/model because the truthiness check drops an empty variant, so a malformed selector is accepted without the warning promised by the validator. Reject empty variants explicitly.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/config-schemas.ts, line 17:
<comment>`provider/model#` is silently normalized to `provider/model` because the truthiness check drops an empty variant, so a malformed selector is accepted without the warning promised by the validator. Reject empty variants explicitly.</comment>
<file context>
@@ -2,6 +2,55 @@
+}
+
+function selectionOf(ref: string, variant: string | undefined): ModelSelection {
+ return variant ? { ref, variant } : { ref };
+}
+
</file context>
| - uses: actions/checkout@v7 | ||
|
|
||
| - name: Build harness | ||
| run: docker build -f e2e/Dockerfile --build-arg OPENCODE_INSTALL_URL=https://opencode.ai/v2/install --build-arg E2E_SPECS=e2e/v2 -t micode-e2e-v2 . |
There was a problem hiding this comment.
P3: This 155-character run line exceeds the repository's 120-character line-width convention. Split the Docker command across YAML lines so its arguments remain readable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/workflows/e2e.yml, line 38:
<comment>This 155-character `run` line exceeds the repository's 120-character line-width convention. Split the Docker command across YAML lines so its arguments remain readable.</comment>
<file context>
@@ -25,6 +25,21 @@ jobs:
+ - uses: actions/checkout@v7
+
+ - name: Build harness
+ run: docker build -f e2e/Dockerfile --build-arg OPENCODE_INSTALL_URL=https://opencode.ai/v2/install --build-arg E2E_SPECS=e2e/v2 -t micode-e2e-v2 .
+
+ - name: Run OpenCode 2 smoke tier
</file context>
| run: docker build -f e2e/Dockerfile --build-arg OPENCODE_INSTALL_URL=https://opencode.ai/v2/install --build-arg E2E_SPECS=e2e/v2 -t micode-e2e-v2 . | |
| run: | | |
| docker build \ | |
| -f e2e/Dockerfile \ | |
| --build-arg OPENCODE_INSTALL_URL=https://opencode.ai/v2/install \ | |
| --build-arg E2E_SPECS=e2e/v2 \ | |
| -t micode-e2e-v2 . |
Adds native OpenCode 2 support to Micode while keeping OpenCode 1 compatibility. Both hosts use the same Micode core for agents, commands, and tools. Adds a Docker smoke tier against the real OpenCode 2 server and keeps the scripted OpenCode 1 regression tier. Updates installation guidance and sets the package version to 0.12.0.
Validation: frozen lockfile install, bun run check (675 passed, 1 skipped), and bun run build. GitHub CI runs both host test tiers before merge.