Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/orchestrator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ OpenCode Router is optional. If it exits, `openwork` continues running unless yo
For development overrides only, set `OPENWORK_ALLOW_EXTERNAL=1` or pass `--allow-external` to use
locally installed `openwork-server` or `opencode-router` binaries.

System-package distributions (e.g. AUR) that rebuild sidecar binaries locally cannot match the
upstream-bundled SHA-256 manifest. Pass `--skip-binary-integrity` (or set
`OPENWORK_SKIP_BINARY_INTEGRITY=1`) to bypass the integrity check. This is intended for trusted
system-package installs only — leave it off for default downloads.

Add `--verbose` (or `OPENWORK_VERBOSE=1`) to print extra diagnostics about resolved binaries.

OpenCode hot reload is enabled by default when launched via `openwork`.
Expand Down
39 changes: 39 additions & 0 deletions apps/orchestrator/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2116,11 +2116,19 @@ async function sha256File(path: string): Promise<string> {
return createHash("sha256").update(data).digest("hex");
}

function shouldSkipBinaryIntegrity(): boolean {
const raw = (process.env.OPENWORK_SKIP_BINARY_INTEGRITY ?? "")
.trim()
.toLowerCase();
return raw === "1" || raw === "true" || raw === "yes";
}

async function verifyBinary(
path: string,
expected?: VersionInfo,
): Promise<void> {
if (!expected) return;
if (shouldSkipBinaryIntegrity()) return;
const hash = await sha256File(path);
if (hash !== expected.sha256) {
throw new Error(`Integrity check failed for ${path}`);
Expand Down Expand Up @@ -3640,6 +3648,7 @@ function printHelp(): void {
" --no-opencode-router Disable opencodeRouter sidecar",
" --opencode-router-required Exit if opencodeRouter stops",
" --allow-external Allow external sidecar binaries (dev only, required for custom bins)",
" --skip-binary-integrity Skip SHA-256 integrity checks on sidecar binaries (for system-package installs)",
" --sidecar-dir <path> Cache directory for downloaded sidecars",
" --sidecar-base-url <url> Base URL for sidecar downloads",
" --sidecar-manifest <url> Override sidecar manifest URL",
Expand Down Expand Up @@ -5554,6 +5563,15 @@ async function spawnRouterDaemon(
false,
"OPENWORK_ALLOW_EXTERNAL",
);
const skipBinaryIntegrity = readBool(
args.flags,
"skip-binary-integrity",
false,
"OPENWORK_SKIP_BINARY_INTEGRITY",
);
if (skipBinaryIntegrity) {
process.env.OPENWORK_SKIP_BINARY_INTEGRITY = "1";
}
const sidecarSource =
readFlag(args.flags, "sidecar-source") ??
process.env.OPENWORK_SIDECAR_SOURCE;
Expand Down Expand Up @@ -5583,6 +5601,7 @@ async function spawnRouterDaemon(
);
if (corsValue) commandArgs.push("--cors", corsValue);
if (allowExternal) commandArgs.push("--allow-external");
if (skipBinaryIntegrity) commandArgs.push("--skip-binary-integrity");
if (sidecarSource) commandArgs.push("--sidecar-source", sidecarSource);
if (opencodeSource) commandArgs.push("--opencode-source", opencodeSource);
if (verbose) commandArgs.push("--verbose");
Expand Down Expand Up @@ -5909,6 +5928,16 @@ async function runRouterDaemon(args: ParsedArgs) {
false,
"OPENWORK_ALLOW_EXTERNAL",
);
if (
readBool(
args.flags,
"skip-binary-integrity",
false,
"OPENWORK_SKIP_BINARY_INTEGRITY",
)
) {
process.env.OPENWORK_SKIP_BINARY_INTEGRITY = "1";
}
const manifest = await readVersionManifest();
logVerbose(`cli version: ${cliVersion}`);
logVerbose(`sidecar target: ${sidecar.target ?? "unknown"}`);
Expand Down Expand Up @@ -7002,6 +7031,16 @@ async function runStart(args: ParsedArgs) {
false,
"OPENWORK_ALLOW_EXTERNAL",
);
if (
readBool(
args.flags,
"skip-binary-integrity",
false,
"OPENWORK_SKIP_BINARY_INTEGRITY",
)
) {
process.env.OPENWORK_SKIP_BINARY_INTEGRITY = "1";
}
const sidecarTarget = resolveSandboxSidecarTarget(sandboxMode);
const sidecar = resolveSidecarConfigForTarget(
args.flags,
Expand Down