fix(opencode): address review feedback on the 2.2.5 pin

Document ocm 0.6.x as requiring OpenCode 2.2.5, matching its
@opencode/theme peer, and make the package compatibility test check
bounded peer ranges instead of treating them as one version.

Linked servers on another 2.x release keep the neutral version notice,
while a different major version is shown as unsupported again through
a shared version badge.

The Docker build now fails when the bundled OpenCode is below the
supported minimum, and the entrypoint falls back to the bundled version
as the floor when OPENCODE_MIN_VERSION is unset instead of discarding
every persisted binary.
This commit is contained in:
Chris Scott committed 2026-11-06 09:43:35 -05:00
1 parent 807c7cb896
commit bf7c6cdbac
10 files changed
+65 -24

No files matched your search

@@ -12,6 +12,7 @@ import {
type OpenCodeServerLink,
type OpenCodeServerTestResult,
} from '@opencode-manager/shared/schemas'
import { isSameOpenCodeMajor } from '@opencode-manager/shared/opencode'
import { haveSameUrlOrigin, isPublicPlainHttpUrl, parseHttpUrl } from '@opencode-manager/shared/utils'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
@@ -99,6 +100,15 @@ function buildDefaultValues(server?: OpenCodeServer | null): ServerFormValues {
}
}
/** Labels a reachable server's version: supported, same major but different, or an incompatible major. */
export function OpenCodeVersionBadge({ result }: { result: OpenCodeServerTestResult }) {
if (result.versionSupported) return <Badge variant="secondary">Supported</Badge>
if (result.version && isSameOpenCodeMajor(result.version)) {
return <Badge variant="outline">Different version: some features may not work</Badge>
}
return <Badge variant="destructive">Unsupported version</Badge>
}
function TestResultSummary({ result }: { result: OpenCodeServerTestResult }) {
if (!result.ok) {
return (
@@ -112,11 +122,7 @@ function TestResultSummary({ result }: { result: OpenCodeServerTestResult }) {
<div role="status" className="flex flex-wrap items-center gap-2 rounded-md border border-border p-2 text-sm">
<CheckCircle2 className="h-4 w-4 shrink-0 text-success" />
<span>Connected — OpenCode {result.version ?? 'unknown version'}</span>
{result.versionSupported ? (
<Badge variant="secondary">Supported</Badge>
) : (
<Badge variant="outline">Different version: some features may not work</Badge>
)}
<OpenCodeVersionBadge result={result} />
</div>
)
}
@@ -12,7 +12,7 @@ import { Switch } from '@/components/ui/switch'
import { DeleteDialog } from '@/components/ui/delete-dialog'
import { showToast } from '@/lib/toast'
import { useOpenCodeServers } from '@/hooks/useOpenCodeServers'
import { OpenCodeServerDialog, type OpenCodeServerFormValues } from './OpenCodeServerDialog'
import { OpenCodeServerDialog, OpenCodeVersionBadge, type OpenCodeServerFormValues } from './OpenCodeServerDialog'
function errorMessage(error: unknown, fallback: string): string {
return error instanceof Error && error.message ? error.message : fallback
@@ -31,11 +31,7 @@ function ServerTestResult({ result }: { result: OpenCodeServerTestResult }) {
<div className="flex flex-wrap items-center gap-2 text-sm">
<CheckCircle2 className="h-4 w-4 shrink-0 text-success" />
<span>OpenCode {result.version ?? 'unknown version'}</span>
{result.versionSupported ? (
<Badge variant="secondary">Supported</Badge>
) : (
<Badge variant="outline">Different version: some features may not work</Badge>
)}
<OpenCodeVersionBadge result={result} />
</div>
)
}