Skip to content

The one and only agent harness for complex codebases. Project memory, planning, execution, and verified completion inside Codex.

chore: sync Codex marketplace v4.18.2

github-actions[bot]f2e96afcb5b6
diff --git a/plugins/omo/.codex-plugin/plugin.json b/plugins/omo/.codex-plugin/plugin.json
index 93a6d1b0..2d63dc1b 100644
--- a/plugins/omo/.codex-plugin/plugin.json
+++ b/plugins/omo/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "omo",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "One Codex plugin namespace for Yeongyu's local Codex components.",
"author": {
"name": "Yeongyu Kim",
diff --git a/plugins/omo/.mcp.json b/plugins/omo/.mcp.json
index 70aff918..e9566b52 100644
--- a/plugins/omo/.mcp.json
+++ b/plugins/omo/.mcp.json
@@ -28,7 +28,8 @@
"./components/lsp-daemon/dist/cli.js",
"mcp"
],
- "cwd": "."
+ "cwd": ".",
+ "startup_timeout_sec": 10
}
}
}
diff --git a/plugins/omo/components/bootstrap/hooks/hooks.json b/plugins/omo/components/bootstrap/hooks/hooks.json
index 9e975dd5..df104f0b 100644
--- a/plugins/omo/components/bootstrap/hooks/hooks.json
+++ b/plugins/omo/components/bootstrap/hooks/hooks.json
@@ -8,7 +8,7 @@
"command": "node \"${PLUGIN_ROOT}/components/bootstrap/dist/cli.js\" hook session-start",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\bootstrap.ps1\"",
"timeout": 30,
- "statusMessage": "(OmO 4.18.1) Checking Bootstrap Provisioning"
+ "statusMessage": "(OmO 4.18.2) Checking Bootstrap Provisioning"
}
]
}
diff --git a/plugins/omo/components/bootstrap/package.json b/plugins/omo/components/bootstrap/package.json
index 143fb0ac..8817627f 100644
--- a/plugins/omo/components/bootstrap/package.json
+++ b/plugins/omo/components/bootstrap/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-bootstrap",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex SessionStart bootstrap component that provisions LazyCodex runtime dependencies from a detached worker.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/codegraph/dist/cli.js b/plugins/omo/components/codegraph/dist/cli.js
index 5e60adf5..08bd839b 100755
--- a/plugins/omo/components/codegraph/dist/cli.js
+++ b/plugins/omo/components/codegraph/dist/cli.js
@@ -2989,6 +2989,9 @@ function errorResponse(id, code, message, data) {
function jsonRpcId(value) {
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
}
+function messageFromError(error) {
+ return error instanceof Error ? error.message : String(error);
+}
// ../../mcp-stdio-core/src/transport.ts
var HEADER_SEPARATOR = Buffer.from(`\r
\r
@@ -3011,16 +3014,45 @@ async function* readStdioJsonRpcMessages(input) {
yield parseJsonPayload(trailing, "line");
}
}
-function writeStdioJsonRpcResponse(output, response, responseMode) {
+async function writeStdioJsonRpcResponse(output, response, responseMode) {
const body = JSON.stringify(response);
- if (responseMode === "framed") {
- output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
+ const payload = responseMode === "framed" ? `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
\r
-${body}`);
- return;
- }
- output.write(`${body}
-`);
+${body}` : `${body}
+`;
+ await writeChunk(output, payload);
+}
+function writeChunk(output, chunk) {
+ return new Promise((resolve5, reject) => {
+ let settled = false;
+ const onError = (error) => {
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ };
+ output.once("error", onError);
+ try {
+ output.write(chunk, (error) => {
+ if (settled)
+ return;
+ settled = true;
+ if (error) {
+ queueMicrotask(() => output.removeListener("error", onError));
+ reject(error);
+ return;
+ }
+ output.removeListener("error", onError);
+ resolve5();
+ });
+ } catch (error) {
+ output.removeListener("error", onError);
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ }
+ });
}
function readNextMessage(buffer) {
if (buffer.length === 0)
@@ -3116,40 +3148,70 @@ async function runJsonRpcStdioServer(config) {
break;
idleTimer.arm();
if (message.kind === "parse_error") {
- handleParseError(message, config, log);
+ if (!await handleParseError(message, config, log))
+ break;
continue;
}
- await handleRequest(message, config, log);
+ if (!await handleRequest(message, config, log))
+ break;
}
} finally {
idleTimer.clear();
log("stdio_stopped");
}
}
-function handleParseError(message, config, log) {
+async function handleParseError(message, config, log) {
log("parse_error", { message: message.message });
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
- if (response !== undefined) {
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- }
+ if (response === undefined)
+ return true;
+ return writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ });
}
async function handleRequest(message, config, log) {
const parsed = message.payload;
const id = isPlainRecord(parsed) ? jsonRpcId(parsed["id"]) : null;
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
log("request", { id: id === null ? null : String(id), method });
+ let response;
try {
- const response = await config.handler(parsed, config.handlerOptions);
- if (response === undefined)
- return;
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ response = await config.handler(parsed, config.handlerOptions);
} catch (error) {
if (config.onHandlerError === undefined)
throw error;
config.onHandlerError(error);
+ return true;
+ }
+ if (response === undefined)
+ return true;
+ if (!await writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ }))
+ return false;
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ return true;
+}
+async function writeResponse(response, context) {
+ try {
+ await writeStdioJsonRpcResponse(context.output, response, context.responseMode);
+ return true;
+ } catch (error) {
+ if (!isTerminalOutputError(error))
+ throw error;
+ context.log("output_error", { message: messageFromError(error) });
+ return false;
}
}
+function isTerminalOutputError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED" || error.code === "ERR_STREAM_WRITE_AFTER_END";
+}
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
let timer = null;
let isClosed = false;
@@ -3230,18 +3292,28 @@ async function runBridgedCodegraphProcess(command, args, options) {
resolveExit(signal === null ? 0 : 1);
});
});
- const bridgeDone = Promise.all([
- forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
- defaultResponseMode = mode;
- }),
- forwardCodegraphToClient(childOutput, options.output, pendingResponses, () => defaultResponseMode)
- ]);
+ const clientForwardingDone = forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
+ defaultResponseMode = mode;
+ });
+ const responseForwardingDone = forwardCodegraphToClient(childOutput, options.output, pendingResponses, () => defaultResponseMode);
+ const bridgeDone = Promise.all([clientForwardingDone, responseForwardingDone]);
+ const childAndResponsesDone = Promise.all([childExit, responseForwardingDone]).then(([exitCode]) => exitCode);
const destroyChildPipes = () => {
childInput.destroy();
childOutput.destroy();
};
childExit.then(destroyChildPipes, destroyChildPipes);
- return Promise.race([childExit, bridgeDone.then(() => childExit)]);
+ try {
+ return await Promise.race([childAndResponsesDone, bridgeDone.then(() => childExit)]);
+ } catch (error) {
+ destroyChildPipes();
+ if (child.exitCode === null && child.signalCode === null)
+ child.kill("SIGKILL");
+ await childExit.catch(() => {
+ return;
+ });
+ throw error;
+ }
}
async function forwardClientToCodegraph(input, childInput, pendingResponses, setDefaultResponseMode) {
for await (const message of readStdioJsonRpcMessages(input)) {
@@ -3265,7 +3337,7 @@ async function forwardClientToCodegraph(input, childInput, pendingResponses, set
async function forwardCodegraphToClient(childOutput, output, pendingResponses, defaultResponseMode) {
for await (const message of readStdioJsonRpcMessages(childOutput)) {
if (message.kind === "parse_error") {
- writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
+ await writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
continue;
}
const key = responseModeKey(message.payload);
@@ -3273,7 +3345,7 @@ async function forwardCodegraphToClient(childOutput, output, pendingResponses, d
const responseMode = pendingResponse?.responseMode ?? defaultResponseMode();
if (key !== null)
pendingResponses.delete(key);
- writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
+ await writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
}
}
function responseModeKey(payload) {
diff --git a/plugins/omo/components/codegraph/dist/serve.js b/plugins/omo/components/codegraph/dist/serve.js
index 04acf746..7ad151a4 100755
--- a/plugins/omo/components/codegraph/dist/serve.js
+++ b/plugins/omo/components/codegraph/dist/serve.js
@@ -1897,6 +1897,9 @@ function errorResponse(id, code, message, data) {
function jsonRpcId(value) {
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
}
+function messageFromError(error) {
+ return error instanceof Error ? error.message : String(error);
+}
// ../../../../mcp-stdio-core/src/transport.ts
var HEADER_SEPARATOR = Buffer.from(`\r
\r
@@ -1919,16 +1922,45 @@ async function* readStdioJsonRpcMessages(input) {
yield parseJsonPayload(trailing, "line");
}
}
-function writeStdioJsonRpcResponse(output, response, responseMode) {
+async function writeStdioJsonRpcResponse(output, response, responseMode) {
const body = JSON.stringify(response);
- if (responseMode === "framed") {
- output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
+ const payload = responseMode === "framed" ? `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
\r
-${body}`);
- return;
- }
- output.write(`${body}
-`);
+${body}` : `${body}
+`;
+ await writeChunk(output, payload);
+}
+function writeChunk(output, chunk) {
+ return new Promise((resolve3, reject) => {
+ let settled = false;
+ const onError = (error) => {
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ };
+ output.once("error", onError);
+ try {
+ output.write(chunk, (error) => {
+ if (settled)
+ return;
+ settled = true;
+ if (error) {
+ queueMicrotask(() => output.removeListener("error", onError));
+ reject(error);
+ return;
+ }
+ output.removeListener("error", onError);
+ resolve3();
+ });
+ } catch (error) {
+ output.removeListener("error", onError);
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ }
+ });
}
function readNextMessage(buffer) {
if (buffer.length === 0)
@@ -2024,40 +2056,70 @@ async function runJsonRpcStdioServer(config) {
break;
idleTimer.arm();
if (message.kind === "parse_error") {
- handleParseError(message, config, log);
+ if (!await handleParseError(message, config, log))
+ break;
continue;
}
- await handleRequest(message, config, log);
+ if (!await handleRequest(message, config, log))
+ break;
}
} finally {
idleTimer.clear();
log("stdio_stopped");
}
}
-function handleParseError(message, config, log) {
+async function handleParseError(message, config, log) {
log("parse_error", { message: message.message });
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
- if (response !== undefined) {
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- }
+ if (response === undefined)
+ return true;
+ return writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ });
}
async function handleRequest(message, config, log) {
const parsed = message.payload;
const id = isPlainRecord(parsed) ? jsonRpcId(parsed["id"]) : null;
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
log("request", { id: id === null ? null : String(id), method });
+ let response;
try {
- const response = await config.handler(parsed, config.handlerOptions);
- if (response === undefined)
- return;
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ response = await config.handler(parsed, config.handlerOptions);
} catch (error) {
if (config.onHandlerError === undefined)
throw error;
config.onHandlerError(error);
+ return true;
+ }
+ if (response === undefined)
+ return true;
+ if (!await writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ }))
+ return false;
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ return true;
+}
+async function writeResponse(response, context) {
+ try {
+ await writeStdioJsonRpcResponse(context.output, response, context.responseMode);
+ return true;
+ } catch (error) {
+ if (!isTerminalOutputError(error))
+ throw error;
+ context.log("output_error", { message: messageFromError(error) });
+ return false;
}
}
+function isTerminalOutputError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED" || error.code === "ERR_STREAM_WRITE_AFTER_END";
+}
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
let timer = null;
let isClosed = false;
@@ -2138,18 +2200,28 @@ async function runBridgedCodegraphProcess(command, args, options) {
resolveExit(signal === null ? 0 : 1);
});
});
- const bridgeDone = Promise.all([
- forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
- defaultResponseMode = mode;
- }),
- forwardCodegraphToClient(childOutput, options.output, pendingResponses, () => defaultResponseMode)
- ]);
+ const clientForwardingDone = forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
+ defaultResponseMode = mode;
+ });
+ const responseForwardingDone = forwardCodegraphToClient(childOutput, options.output, pendingResponses, () => defaultResponseMode);
+ const bridgeDone = Promise.all([clientForwardingDone, responseForwardingDone]);
+ const childAndResponsesDone = Promise.all([childExit, responseForwardingDone]).then(([exitCode]) => exitCode);
const destroyChildPipes = () => {
childInput.destroy();
childOutput.destroy();
};
childExit.then(destroyChildPipes, destroyChildPipes);
- return Promise.race([childExit, bridgeDone.then(() => childExit)]);
+ try {
+ return await Promise.race([childAndResponsesDone, bridgeDone.then(() => childExit)]);
+ } catch (error) {
+ destroyChildPipes();
+ if (child.exitCode === null && child.signalCode === null)
+ child.kill("SIGKILL");
+ await childExit.catch(() => {
+ return;
+ });
+ throw error;
+ }
}
async function forwardClientToCodegraph(input, childInput, pendingResponses, setDefaultResponseMode) {
for await (const message of readStdioJsonRpcMessages(input)) {
@@ -2173,7 +2245,7 @@ async function forwardClientToCodegraph(input, childInput, pendingResponses, set
async function forwardCodegraphToClient(childOutput, output, pendingResponses, defaultResponseMode) {
for await (const message of readStdioJsonRpcMessages(childOutput)) {
if (message.kind === "parse_error") {
- writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
+ await writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
continue;
}
const key = responseModeKey(message.payload);
@@ -2181,7 +2253,7 @@ async function forwardCodegraphToClient(childOutput, output, pendingResponses, d
const responseMode = pendingResponse?.responseMode ?? defaultResponseMode();
if (key !== null)
pendingResponses.delete(key);
- writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
+ await writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
}
}
function responseModeKey(payload) {
diff --git a/plugins/omo/components/codegraph/package.json b/plugins/omo/components/codegraph/package.json
index 41a9c302..e1110b75 100644
--- a/plugins/omo/components/codegraph/package.json
+++ b/plugins/omo/components/codegraph/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-codegraph",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex plugin MCP wrapper for CodeGraph.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/codegraph/src/mcp-bridge.ts b/plugins/omo/components/codegraph/src/mcp-bridge.ts
index 34410d34..3459a565 100644
--- a/plugins/omo/components/codegraph/src/mcp-bridge.ts
+++ b/plugins/omo/components/codegraph/src/mcp-bridge.ts
@@ -63,18 +63,30 @@ export async function runBridgedCodegraphProcess(
resolveExit(signal === null ? 0 : 1);
});
});
- const bridgeDone = Promise.all([
- forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
- defaultResponseMode = mode;
- }),
- forwardCodegraphToClient(childOutput, options.output, pendingResponses, () => defaultResponseMode),
- ]);
+ const clientForwardingDone = forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
+ defaultResponseMode = mode;
+ });
+ const responseForwardingDone = forwardCodegraphToClient(
+ childOutput,
+ options.output,
+ pendingResponses,
+ () => defaultResponseMode,
+ );
+ const bridgeDone = Promise.all([clientForwardingDone, responseForwardingDone]);
+ const childAndResponsesDone = Promise.all([childExit, responseForwardingDone]).then(([exitCode]) => exitCode);
const destroyChildPipes = (): void => {
childInput.destroy();
childOutput.destroy();
};
void childExit.then(destroyChildPipes, destroyChildPipes);
- return Promise.race([childExit, bridgeDone.then(() => childExit)]);
+ try {
+ return await Promise.race([childAndResponsesDone, bridgeDone.then(() => childExit)]);
+ } catch (error) {
+ destroyChildPipes();
+ if (child.exitCode === null && child.signalCode === null) child.kill("SIGKILL");
+ await childExit.catch(() => undefined);
+ throw error;
+ }
}
async function forwardClientToCodegraph(
@@ -110,14 +122,14 @@ async function forwardCodegraphToClient(
): Promise<void> {
for await (const message of readStdioJsonRpcMessages(childOutput)) {
if (message.kind === "parse_error") {
- writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
+ await writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
continue;
}
const key = responseModeKey(message.payload);
const pendingResponse = key === null ? undefined : pendingResponses.get(key);
const responseMode = pendingResponse?.responseMode ?? defaultResponseMode();
if (key !== null) pendingResponses.delete(key);
- writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
+ await writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
}
}
diff --git a/plugins/omo/components/codegraph/test/mcp-bridge-fixtures.ts b/plugins/omo/components/codegraph/test/mcp-bridge-fixtures.ts
index 45b0b97b..35177701 100644
--- a/plugins/omo/components/codegraph/test/mcp-bridge-fixtures.ts
+++ b/plugins/omo/components/codegraph/test/mcp-bridge-fixtures.ts
@@ -49,6 +49,41 @@ export function writeFakeContractCodegraph(filePath: string): void {
chmodSync(filePath, 0o755);
}
+export function writeFakeHeldOpenCodegraph(filePath: string): void {
+ writeFileSync(
+ filePath,
+ [
+ "#!/usr/bin/env node",
+ "const fs = require('node:fs');",
+ "const readline = require('node:readline');",
+ "fs.writeFileSync(process.env.CODEGRAPH_FAKE_LOG, String(process.pid));",
+ "const rl = readline.createInterface({ input: process.stdin });",
+ "rl.once('line', (line) => {",
+ " const request = JSON.parse(line);",
+ " process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id: request.id, result: { ok: true } }) + '\\n');",
+ "});",
+ "setInterval(() => {}, 1000);",
+ ].join("\n"),
+ );
+ chmodSync(filePath, 0o755);
+}
+
+export function writeFakeExitingCodegraph(filePath: string): void {
+ writeFileSync(
+ filePath,
+ [
+ "#!/usr/bin/env node",
+ "const readline = require('node:readline');",
+ "const rl = readline.createInterface({ input: process.stdin });",
+ "rl.once('line', (line) => {",
+ " const request = JSON.parse(line);",
+ " process.stdout.write(JSON.stringify({ jsonrpc: '2.0', id: request.id, result: { ok: true } }) + '\\n', () => process.exit(0));",
+ "});",
+ ].join("\n"),
+ );
+ chmodSync(filePath, 0o755);
+}
+
export function frameMcpRequest(request: {
readonly id: number;
readonly method: string;
diff --git a/plugins/omo/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts b/plugins/omo/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts
new file mode 100644
index 00000000..61b157df
--- /dev/null
+++ b/plugins/omo/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts
@@ -0,0 +1,69 @@
+import { describe, expect, it } from "bun:test";
+import { mkdirSync, mkdtempSync, realpathSync, rmSync } from "node:fs";
+import { join } from "node:path";
+import { PassThrough, Writable } from "node:stream";
+import { fileURLToPath } from "node:url";
+
+import { runCodegraphServe } from "../src/serve.ts";
+import {
+ frameMcpRequest,
+ writeFakeExitingCodegraph,
+} from "./mcp-bridge-fixtures.ts";
+
+const componentRoot = realpathSync(
+ fileURLToPath(new URL("..", import.meta.url)),
+);
+
+describe("runCodegraphServe MCP bridge lifecycle", () => {
+ it("#given an exiting Codegraph child and delayed closed parent output #when the final response write fails #then the output error is preserved", async () => {
+ const tempRoot = mkdtempSync(
+ join(componentRoot, ".tmp-codegraph-exit-output-failure-"),
+ );
+ const projectRoot = join(tempRoot, "project");
+ const fakeCodegraph = join(tempRoot, "codegraph-exiting.cjs");
+ const input = new PassThrough();
+ const outputError = Object.assign(
+ new Error("parent output closed after child exit"),
+ { code: "EPIPE" },
+ );
+ const writeStarted = Promise.withResolvers<void>();
+ const output = new Writable({
+ write(_chunk, _encoding, callback) {
+ writeStarted.resolve();
+ setTimeout(() => callback(outputError), 150);
+ },
+ });
+
+ try {
+ mkdirSync(projectRoot, { recursive: true });
+ writeFakeExitingCodegraph(fakeCodegraph);
+ const run = runCodegraphServe({
+ cwd: tempRoot,
+ env: {
+ CODEGRAPH_ALLOW_UNSAFE_NODE: "1",
+ OMO_CODEGRAPH_BIN: fakeCodegraph,
+ OMO_CODEGRAPH_PROJECT_CWD: projectRoot,
+ PATH: process.env["PATH"],
+ },
+ nodeVersion: "22.14.0",
+ buildEnv: () => ({}),
+ resolve: () => ({
+ argsPrefix: [],
+ command: fakeCodegraph,
+ exists: true,
+ source: "env",
+ }),
+ stderr: { write: () => undefined },
+ stdin: input,
+ stdout: output,
+ });
+
+ input.end(frameMcpRequest({ id: 1, method: "tools/list", params: {} }));
+
+ await writeStarted.promise;
+ await expect(run).rejects.toBe(outputError);
+ } finally {
+ rmSync(tempRoot, { recursive: true, force: true });
+ }
+ });
+});
diff --git a/plugins/omo/components/codegraph/test/serve-mcp-bridge.test.ts b/plugins/omo/components/codegraph/test/serve-mcp-bridge.test.ts
index 446d2c5d..14f804c0 100644
--- a/plugins/omo/components/codegraph/test/serve-mcp-bridge.test.ts
+++ b/plugins/omo/components/codegraph/test/serve-mcp-bridge.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from "bun:test";
import { mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync } from "node:fs";
import { join } from "node:path";
-import { PassThrough } from "node:stream";
+import { PassThrough, Writable } from "node:stream";
import { fileURLToPath } from "node:url";
import { runCodegraphServe } from "../src/serve.ts";
@@ -14,6 +14,7 @@ import {
recordValue,
stringProperty,
writeFakeContractCodegraph,
+ writeFakeHeldOpenCodegraph,
writeFakeNewlineCodegraph,
} from "./mcp-bridge-fixtures.ts";
@@ -190,4 +191,59 @@ describe("runCodegraphServe MCP protocol bridge", () => {
rmSync(tempRoot, { recursive: true, force: true });
}
});
+
+ it("#given a held-open Codegraph child and closed parent output #when response forwarding fails #then the child is terminated before rejection", async () => {
+ const tempRoot = mkdtempSync(join(componentRoot, ".tmp-codegraph-output-failure-"));
+ const projectRoot = join(tempRoot, "project");
+ const fakeCodegraph = join(tempRoot, "codegraph-held-open.cjs");
+ const childPidFile = join(tempRoot, "child.pid");
+ const input = new PassThrough();
+ const outputError = Object.assign(new Error("parent output closed"), { code: "EPIPE" });
+ const output = new Writable({
+ write(_chunk, _encoding, callback) {
+ callback(outputError);
+ },
+ });
+ let childPid: number | undefined;
+
+ try {
+ mkdirSync(projectRoot, { recursive: true });
+ writeFakeHeldOpenCodegraph(fakeCodegraph);
+ const run = runCodegraphServe({
+ cwd: tempRoot,
+ env: {
+ CODEGRAPH_ALLOW_UNSAFE_NODE: "1",
+ CODEGRAPH_FAKE_LOG: childPidFile,
+ OMO_CODEGRAPH_BIN: fakeCodegraph,
+ OMO_CODEGRAPH_PROJECT_CWD: projectRoot,
+ PATH: process.env["PATH"],
+ },
+ nodeVersion: "22.14.0",
+ buildEnv: () => ({}),
+ resolve: () => ({ argsPrefix: [], command: fakeCodegraph, exists: true, source: "env" }),
+ stderr: { write: () => undefined },
+ stdin: input,
+ stdout: output,
+ });
+
+ input.end(frameMcpRequest({ id: 1, method: "tools/list", params: {} }));
+
+ await expect(run).rejects.toBe(outputError);
+ childPid = Number(readFileSync(childPidFile, "utf8"));
+ expect(isProcessAlive(childPid)).toBe(false);
+ } finally {
+ if (childPid !== undefined && isProcessAlive(childPid)) process.kill(childPid, "SIGKILL");
+ rmSync(tempRoot, { recursive: true, force: true });
+ }
+ });
});
+
+function isProcessAlive(pid: number): boolean {
+ try {
+ process.kill(pid, 0);
+ return true;
+ } catch (error) {
+ if (error instanceof Error && "code" in error && error.code === "ESRCH") return false;
+ throw error;
+ }
+}
diff --git a/plugins/omo/components/comment-checker/hooks/hooks.json b/plugins/omo/components/comment-checker/hooks/hooks.json
index 518d6c07..860fa6c7 100644
--- a/plugins/omo/components/comment-checker/hooks/hooks.json
+++ b/plugins/omo/components/comment-checker/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 30,
- "statusMessage": "(OmO 4.18.1) Checking Comments"
+ "statusMessage": "(OmO 4.18.2) Checking Comments"
}
]
}
diff --git a/plugins/omo/components/comment-checker/package.json b/plugins/omo/components/comment-checker/package.json
index b1426649..be394c6e 100644
--- a/plugins/omo/components/comment-checker/package.json
+++ b/plugins/omo/components/comment-checker/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-comment-checker",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex plugin that runs comment-checker after edit-like PostToolUse hooks.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/git-bash-mcp/dist/cli.js b/plugins/omo/components/git-bash-mcp/dist/cli.js
index c38d9793..8ad7848f 100755
--- a/plugins/omo/components/git-bash-mcp/dist/cli.js
+++ b/plugins/omo/components/git-bash-mcp/dist/cli.js
@@ -17,6 +17,9 @@ function errorResponse(id, code, message, data) {
function jsonRpcId(value) {
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
}
+function messageFromError(error) {
+ return error instanceof Error ? error.message : String(error);
+}
// ../mcp-stdio-core/src/transport.ts
var HEADER_SEPARATOR = Buffer.from(`\r
\r
@@ -39,16 +42,45 @@ async function* readStdioJsonRpcMessages(input) {
yield parseJsonPayload(trailing, "line");
}
}
-function writeStdioJsonRpcResponse(output, response, responseMode) {
+async function writeStdioJsonRpcResponse(output, response, responseMode) {
const body = JSON.stringify(response);
- if (responseMode === "framed") {
- output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
+ const payload = responseMode === "framed" ? `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
\r
-${body}`);
- return;
- }
- output.write(`${body}
-`);
+${body}` : `${body}
+`;
+ await writeChunk(output, payload);
+}
+function writeChunk(output, chunk) {
+ return new Promise((resolve, reject) => {
+ let settled = false;
+ const onError = (error) => {
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ };
+ output.once("error", onError);
+ try {
+ output.write(chunk, (error) => {
+ if (settled)
+ return;
+ settled = true;
+ if (error) {
+ queueMicrotask(() => output.removeListener("error", onError));
+ reject(error);
+ return;
+ }
+ output.removeListener("error", onError);
+ resolve();
+ });
+ } catch (error) {
+ output.removeListener("error", onError);
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ }
+ });
}
function readNextMessage(buffer) {
if (buffer.length === 0)
@@ -144,40 +176,70 @@ async function runJsonRpcStdioServer(config) {
break;
idleTimer.arm();
if (message.kind === "parse_error") {
- handleParseError(message, config, log);
+ if (!await handleParseError(message, config, log))
+ break;
continue;
}
- await handleRequest(message, config, log);
+ if (!await handleRequest(message, config, log))
+ break;
}
} finally {
idleTimer.clear();
log("stdio_stopped");
}
}
-function handleParseError(message, config, log) {
+async function handleParseError(message, config, log) {
log("parse_error", { message: message.message });
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
- if (response !== undefined) {
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- }
+ if (response === undefined)
+ return true;
+ return writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ });
}
async function handleRequest(message, config, log) {
const parsed = message.payload;
const id = isPlainRecord(parsed) ? jsonRpcId(parsed["id"]) : null;
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
log("request", { id: id === null ? null : String(id), method });
+ let response;
try {
- const response = await config.handler(parsed, config.handlerOptions);
- if (response === undefined)
- return;
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ response = await config.handler(parsed, config.handlerOptions);
} catch (error) {
if (config.onHandlerError === undefined)
throw error;
config.onHandlerError(error);
+ return true;
+ }
+ if (response === undefined)
+ return true;
+ if (!await writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ }))
+ return false;
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ return true;
+}
+async function writeResponse(response, context) {
+ try {
+ await writeStdioJsonRpcResponse(context.output, response, context.responseMode);
+ return true;
+ } catch (error) {
+ if (!isTerminalOutputError(error))
+ throw error;
+ context.log("output_error", { message: messageFromError(error) });
+ return false;
}
}
+function isTerminalOutputError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED" || error.code === "ERR_STREAM_WRITE_AFTER_END";
+}
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
let timer = null;
let isClosed = false;
diff --git a/plugins/omo/components/git-bash/hooks/hooks.json b/plugins/omo/components/git-bash/hooks/hooks.json
index a4e874d6..b99f5dca 100644
--- a/plugins/omo/components/git-bash/hooks/hooks.json
+++ b/plugins/omo/components/git-bash/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Recommending Git Bash MCP"
+ "statusMessage": "(OmO 4.18.2) Recommending Git Bash MCP"
}
]
}
@@ -20,7 +20,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Resetting Git Bash MCP Reminder"
+ "statusMessage": "(OmO 4.18.2) Resetting Git Bash MCP Reminder"
}
]
}
diff --git a/plugins/omo/components/git-bash/package.json b/plugins/omo/components/git-bash/package.json
index 0c4c0428..cf8a04fc 100644
--- a/plugins/omo/components/git-bash/package.json
+++ b/plugins/omo/components/git-bash/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-git-bash-hook",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex hook component that reminds Windows sessions to prefer the OMO git_bash MCP.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json b/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
index fcf815d8..2d610b67 100644
--- a/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
+++ b/plugins/omo/components/lazycodex-executor-verify/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lazycodex-executor-verify/dist/cli.js\" hook subagent-stop",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Verifying LazyCodex Executor Evidence"
+ "statusMessage": "(OmO 4.18.2) Verifying LazyCodex Executor Evidence"
}
]
}
diff --git a/plugins/omo/components/lazycodex-executor-verify/package.json b/plugins/omo/components/lazycodex-executor-verify/package.json
index 6e117d89..da15a5ab 100644
--- a/plugins/omo/components/lazycodex-executor-verify/package.json
+++ b/plugins/omo/components/lazycodex-executor-verify/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-lazycodex-executor-verify",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex SubagentStop evidence verifier for LazyCodex executor completions.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/lsp-daemon/dist/cli.js b/plugins/omo/components/lsp-daemon/dist/cli.js
index 8c4b148b..bfb91de4 100644
--- a/plugins/omo/components/lsp-daemon/dist/cli.js
+++ b/plugins/omo/components/lsp-daemon/dist/cli.js
@@ -21,6 +21,9 @@ function errorResponse(id, code, message, data) {
function jsonRpcId(value) {
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
}
+function messageFromError(error) {
+ return error instanceof Error ? error.message : String(error);
+}
// ../mcp-stdio-core/src/transport.ts
var HEADER_SEPARATOR = Buffer.from(`\r
\r
@@ -43,16 +46,45 @@ async function* readStdioJsonRpcMessages(input) {
yield parseJsonPayload(trailing, "line");
}
}
-function writeStdioJsonRpcResponse(output, response, responseMode) {
+async function writeStdioJsonRpcResponse(output, response, responseMode) {
const body = JSON.stringify(response);
- if (responseMode === "framed") {
- output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
+ const payload = responseMode === "framed" ? `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
\r
-${body}`);
- return;
- }
- output.write(`${body}
-`);
+${body}` : `${body}
+`;
+ await writeChunk(output, payload);
+}
+function writeChunk(output, chunk) {
+ return new Promise((resolve, reject) => {
+ let settled = false;
+ const onError = (error) => {
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ };
+ output.once("error", onError);
+ try {
+ output.write(chunk, (error) => {
+ if (settled)
+ return;
+ settled = true;
+ if (error) {
+ queueMicrotask(() => output.removeListener("error", onError));
+ reject(error);
+ return;
+ }
+ output.removeListener("error", onError);
+ resolve();
+ });
+ } catch (error) {
+ output.removeListener("error", onError);
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ }
+ });
}
function readNextMessage(buffer) {
if (buffer.length === 0)
@@ -148,39 +180,69 @@ async function runJsonRpcStdioServer(config) {
break;
idleTimer.arm();
if (message.kind === "parse_error") {
- handleParseError(message, config, log);
+ if (!await handleParseError(message, config, log))
+ break;
continue;
}
- await handleRequest(message, config, log);
+ if (!await handleRequest(message, config, log))
+ break;
}
} finally {
idleTimer.clear();
log("stdio_stopped");
}
}
-function handleParseError(message, config, log) {
+async function handleParseError(message, config, log) {
log("parse_error", { message: message.message });
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
- if (response !== undefined) {
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- }
+ if (response === undefined)
+ return true;
+ return writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ });
}
async function handleRequest(message, config, log) {
const parsed = message.payload;
const id = isPlainRecord(parsed) ? jsonRpcId(parsed["id"]) : null;
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
log("request", { id: id === null ? null : String(id), method });
+ let response;
try {
- const response = await config.handler(parsed, config.handlerOptions);
- if (response === undefined)
- return;
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ response = await config.handler(parsed, config.handlerOptions);
} catch (error) {
if (config.onHandlerError === undefined)
throw error;
config.onHandlerError(error);
+ return true;
}
+ if (response === undefined)
+ return true;
+ if (!await writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ }))
+ return false;
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ return true;
+}
+async function writeResponse(response, context) {
+ try {
+ await writeStdioJsonRpcResponse(context.output, response, context.responseMode);
+ return true;
+ } catch (error) {
+ if (!isTerminalOutputError(error))
+ throw error;
+ context.log("output_error", { message: messageFromError(error) });
+ return false;
+ }
+}
+function isTerminalOutputError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED" || error.code === "ERR_STREAM_WRITE_AFTER_END";
}
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
let timer = null;
@@ -4241,7 +4303,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
const fileErrors = [];
const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
options.signal?.throwIfAborted();
- const client = await manager.getClient(root, server2);
+ const client = await manager.getClient(root, server2, options.signal);
try {
let nextIndex = 0;
const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
@@ -4999,14 +5061,14 @@ function requestedProtocolVersion(params) {
}
// src/daemon-client.ts
-import { connect as connect2 } from "node:net";
+import { connect } from "node:net";
import { homedir as homedir3 } from "node:os";
import { join as join7 } from "node:path";
// src/ensure-daemon.ts
import { spawn as spawn2 } from "node:child_process";
import { closeSync as closeSync2, mkdirSync as mkdirSync3, openSync as openSync2 } from "node:fs";
-import { connect } from "node:net";
+import { Socket } from "node:net";
import { dirname as dirname8 } from "node:path";
import { execPath } from "node:process";
@@ -5413,42 +5475,48 @@ class DaemonUnreachableError extends Error {
async function ensureDaemonRunning(paths, deps = defaultEnsureDaemonDeps(), options = {}) {
const readyTimeoutMs = options.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
- if (await deps.probe(paths))
+ const signal = options.signal;
+ throwIfAborted(signal);
+ if (await awaitWithSignal2(deps.probe(paths, signal), signal))
return;
+ throwIfAborted(signal);
deps.spawnDaemon(paths);
- await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs);
+ await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal);
}
-async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs) {
+async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal) {
const deadline = deps.now() + readyTimeoutMs;
for (;; ) {
- if (await deps.probe(paths))
+ throwIfAborted(signal);
+ if (await awaitWithSignal2(deps.probe(paths, signal), signal))
return;
if (deps.now() >= deadline)
throw new DaemonUnreachableError(paths.socket);
- await deps.sleep(pollIntervalMs);
+ await awaitWithSignal2(deps.sleep(pollIntervalMs, signal), signal);
}
}
-async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS) {
+async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS, signal) {
const token = readAuthToken(paths);
if (!token)
return false;
- return await pingDaemon(paths, token, timeoutMs) !== null;
+ return await pingDaemon(paths, token, timeoutMs, signal) !== null;
}
-function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
+function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
return new Promise((resolve9) => {
- const socket = connect(paths.socket);
+ const socket = new Socket;
let settled = false;
+ let timer;
const finish = (value) => {
if (settled)
return;
settled = true;
+ if (timer !== undefined)
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", onAbort);
socket.destroy();
resolve9(value);
};
- const timer = setTimeout(() => finish(null), timeoutMs);
- timer.unref?.();
+ const onAbort = () => finish(null);
const decoder = createLineDecoder((message) => {
- clearTimeout(timer);
finish(parsePingResponse(message));
});
socket.once("connect", () => {
@@ -5456,9 +5524,16 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
});
socket.on("data", (chunk) => decoder.push(chunk));
socket.once("error", () => {
- clearTimeout(timer);
finish(null);
});
+ timer = setTimeout(() => finish(null), timeoutMs);
+ timer.unref?.();
+ if (signal?.aborted) {
+ onAbort();
+ return;
+ }
+ signal?.addEventListener("abort", onAbort, { once: true });
+ socket.connect(paths.socket);
});
}
function spawnDaemonProcess(paths) {
@@ -5476,14 +5551,62 @@ function spawnDaemonProcess(paths) {
}
function defaultEnsureDaemonDeps() {
return {
- probe: (paths) => probeDaemon(paths),
+ probe: (paths, signal) => probeDaemon(paths, PROBE_TIMEOUT_MS, signal),
spawnDaemon: (paths) => spawnDaemonProcess(paths),
- sleep: (ms) => new Promise((resolve9) => {
- setTimeout(resolve9, ms);
- }),
+ sleep: (ms, signal) => sleepWithSignal(ms, signal),
now: () => Date.now()
};
}
+function sleepWithSignal(ms, signal) {
+ return new Promise((resolve9) => {
+ let settled = false;
+ const finish = () => {
+ if (settled)
+ return;
+ settled = true;
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", finish);
+ resolve9();
+ };
+ const timer = setTimeout(finish, ms);
+ if (signal?.aborted) {
+ finish();
+ return;
+ }
+ signal?.addEventListener("abort", finish, { once: true });
+ });
+}
+function awaitWithSignal2(promise, signal) {
+ if (!signal)
+ return promise;
+ if (signal.aborted)
+ return Promise.reject(abortError3(signal));
+ return new Promise((resolve9, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(abortError3(signal)));
+ signal.addEventListener("abort", onAbort, { once: true });
+ promise.then((value) => finish(() => resolve9(value)), (error) => finish(() => reject(error)));
+ });
+}
+function throwIfAborted(signal) {
+ if (signal?.aborted)
+ throw abortError3(signal);
+}
+function abortError3(signal) {
+ const reason = signal.reason;
+ if (reason instanceof Error)
+ return reason;
+ const error = new Error(typeof reason === "string" ? reason : "daemon startup cancelled");
+ error.name = "AbortError";
+ return error;
+}
function parsePingResponse(message) {
if (!message || typeof message !== "object" || Array.isArray(message))
return null;
@@ -5627,14 +5750,14 @@ class DaemonRequestCancelledError extends DaemonRequestError {
async function callToolViaDaemon(name, args, options) {
const context = requireContext(options.context);
const paths = options.paths ?? daemonPaths();
- const ensure = options.ensure ?? ensureDaemonRunning;
+ const ensure = options.ensure ?? ((ensurePaths, signal) => ensureDaemonRunning(ensurePaths, undefined, signal === undefined ? {} : { signal }));
const timeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
const requestArgs = withContext(args, context);
let lastError;
let authRefreshUsed = false;
for (let attempt = 0;attempt < 3; attempt += 1) {
try {
- await ensure(paths);
+ await ensureDaemonAvailable(paths, ensure, options.signal);
const token = readAuthToken(paths);
if (!token)
throw new DaemonRequestError("daemon auth token missing", false);
@@ -5676,6 +5799,27 @@ function requireContext(context) {
function withContext(args, context) {
return { ...args, [CONTEXT_KEY]: context };
}
+function ensureDaemonAvailable(paths, ensure, signal) {
+ if (!signal)
+ return ensure(paths);
+ return new Promise((resolve9, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(new DaemonRequestCancelledError(false)));
+ if (signal.aborted) {
+ onAbort();
+ return;
+ }
+ signal.addEventListener("abort", onAbort, { once: true });
+ Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve9()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
+ });
+}
function daemonUnreachableResult(paths, error) {
const text2 = [
`LSP daemon unreachable: ${errorText(error)}.`,
@@ -5689,7 +5833,7 @@ function daemonUnreachableResult(paths, error) {
}
function sendToolCall(paths, token, name, args, options) {
return new Promise((resolve9, reject) => {
- const socket = connect2(paths.socket);
+ const socket = connect(paths.socket);
const requestId = allocateProxyRequestId();
let settled = false;
let requestWritten = false;
@@ -5790,38 +5934,93 @@ function errorText(error) {
}
// src/proxy.ts
+var DEFAULT_STARTUP_TIMEOUT_MS = 1e4;
async function runMcpStdioProxy(options = {}) {
const input = options.input ?? process.stdin;
const output = options.output ?? process.stdout;
- const paths = options.paths ?? daemonPaths();
- const env = options.env ?? process.env;
- const cwd = options.cwd ?? inferOpenCodeProjectCwd(env["LSP_TOOLS_MCP_PROJECT_CONFIG"]);
- const contextEnv = cwd === undefined ? env : canonicalizeContextEnv(env);
- const contextInput = {
- env: contextEnv,
- ...cwd === undefined ? {} : { cwd },
- ...options.homeDir === undefined ? {} : { homeDir: options.homeDir }
+ const stderr = options.stderr ?? process.stderr;
+ const startupTimeoutMs = options.startupTimeoutMs ?? DEFAULT_STARTUP_TIMEOUT_MS;
+ const lifecycleController = new AbortController;
+ const abortFromInput = () => lifecycleController.abort();
+ let startupExpired = false;
+ let startupTimer;
+ const clearStartupWatchdog = () => {
+ if (startupTimer === undefined)
+ return;
+ clearTimeout(startupTimer);
+ startupTimer = undefined;
};
- const context = options.context ?? createStandaloneMcpRequestContext(contextInput);
- const callOptions = { paths, context, ...options.ensure ? { ensure: options.ensure } : {} };
- await runJsonRpcStdioServer({
- input,
- output,
- idleTimeoutMs: 0,
- handler: (request, requestOptions) => runWithRequestContext(context, () => handleProxyRequest(request, requestOptions)),
- handlerOptions: callOptions,
- onHandlerError: (error) => {
- process.stderr.write(`[lsp-daemon] proxy error: ${error instanceof Error ? error.message : String(error)}
+ input.once("end", abortFromInput);
+ input.once("close", abortFromInput);
+ if (startupTimeoutMs > 0) {
+ startupTimer = setTimeout(() => {
+ startupExpired = true;
+ input.destroy();
+ try {
+ stderr.write(`[lsp-daemon] no MCP request received within ${startupTimeoutMs}ms; exiting
`);
- }
- });
+ } catch (error) {
+ if (stderr !== process.stderr) {
+ process.stderr.write(`[lsp-daemon] startup diagnostic failed: ${error instanceof Error ? error.message : String(error)}
+`);
+ }
+ }
+ }, startupTimeoutMs);
+ }
+ try {
+ const paths = options.paths ?? daemonPaths();
+ const env = options.env ?? process.env;
+ const cwd = options.cwd ?? inferOpenCodeProjectCwd(env["LSP_TOOLS_MCP_PROJECT_CONFIG"]);
+ const contextEnv = cwd === undefined ? env : canonicalizeContextEnv(env);
+ const contextInput = {
+ env: contextEnv,
+ ...cwd === undefined ? {} : { cwd },
+ ...options.homeDir === undefined ? {} : { homeDir: options.homeDir }
+ };
+ const context = options.context ?? createStandaloneMcpRequestContext(contextInput);
+ const callOptions = {
+ paths,
+ context,
+ ...options.ensure ? { ensure: options.ensure } : {},
+ signal: lifecycleController.signal
+ };
+ await runJsonRpcStdioServer({
+ input,
+ output,
+ idleTimeoutMs: 0,
+ handler: (request, requestOptions) => {
+ clearStartupWatchdog();
+ return runWithRequestContext(context, () => handleProxyRequest(request, requestOptions));
+ },
+ handlerOptions: callOptions,
+ onHandlerError: (error) => {
+ stderr.write(`[lsp-daemon] proxy error: ${error instanceof Error ? error.message : String(error)}
+`);
+ }
+ });
+ } catch (error) {
+ if (!startupExpired || !isPrematureCloseError(error))
+ throw error;
+ } finally {
+ if (startupTimer !== undefined)
+ clearTimeout(startupTimer);
+ input.removeListener("end", abortFromInput);
+ input.removeListener("close", abortFromInput);
+ }
+}
+function isPrematureCloseError(error) {
+ return error instanceof Error && Reflect.get(error, "code") === "ERR_STREAM_PREMATURE_CLOSE";
}
async function handleProxyRequest(parsed, callOptions) {
const toolCall = asToolCall(parsed);
if (!toolCall)
return handleLspMcpRequest(parsed);
const result = await callToolViaDaemon(toolCall.name, toolCall.args, callOptions);
- return successResponse(toolCall.id, { content: result.content, isError: result.isError ?? false, details: result.details });
+ return successResponse(toolCall.id, {
+ content: result.content,
+ isError: result.isError ?? false,
+ details: result.details
+ });
}
function asToolCall(parsed) {
if (!isPlainRecord(parsed) || parsed["method"] !== "tools/call")
diff --git a/plugins/omo/components/lsp-daemon/dist/client.js b/plugins/omo/components/lsp-daemon/dist/client.js
index 62e8261f..afad9c90 100644
--- a/plugins/omo/components/lsp-daemon/dist/client.js
+++ b/plugins/omo/components/lsp-daemon/dist/client.js
@@ -1,5 +1,5 @@
// src/daemon-client.ts
-import { connect as connect2 } from "node:net";
+import { connect } from "node:net";
import { homedir as homedir3 } from "node:os";
import { join as join7 } from "node:path";
@@ -180,7 +180,7 @@ function isPlainRecord(value) {
// src/ensure-daemon.ts
import { spawn } from "node:child_process";
import { closeSync as closeSync2, mkdirSync as mkdirSync2, openSync as openSync2 } from "node:fs";
-import { connect } from "node:net";
+import { Socket } from "node:net";
import { dirname as dirname3 } from "node:path";
import { execPath } from "node:process";
@@ -587,42 +587,48 @@ class DaemonUnreachableError extends Error {
async function ensureDaemonRunning(paths, deps = defaultEnsureDaemonDeps(), options = {}) {
const readyTimeoutMs = options.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
- if (await deps.probe(paths))
+ const signal = options.signal;
+ throwIfAborted(signal);
+ if (await awaitWithSignal(deps.probe(paths, signal), signal))
return;
+ throwIfAborted(signal);
deps.spawnDaemon(paths);
- await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs);
+ await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal);
}
-async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs) {
+async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal) {
const deadline = deps.now() + readyTimeoutMs;
for (;; ) {
- if (await deps.probe(paths))
+ throwIfAborted(signal);
+ if (await awaitWithSignal(deps.probe(paths, signal), signal))
return;
if (deps.now() >= deadline)
throw new DaemonUnreachableError(paths.socket);
- await deps.sleep(pollIntervalMs);
+ await awaitWithSignal(deps.sleep(pollIntervalMs, signal), signal);
}
}
-async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS) {
+async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS, signal) {
const token = readAuthToken(paths);
if (!token)
return false;
- return await pingDaemon(paths, token, timeoutMs) !== null;
+ return await pingDaemon(paths, token, timeoutMs, signal) !== null;
}
-function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
+function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
return new Promise((resolve2) => {
- const socket = connect(paths.socket);
+ const socket = new Socket;
let settled = false;
+ let timer;
const finish = (value) => {
if (settled)
return;
settled = true;
+ if (timer !== undefined)
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", onAbort);
socket.destroy();
resolve2(value);
};
- const timer = setTimeout(() => finish(null), timeoutMs);
- timer.unref?.();
+ const onAbort = () => finish(null);
const decoder = createLineDecoder((message) => {
- clearTimeout(timer);
finish(parsePingResponse(message));
});
socket.once("connect", () => {
@@ -630,9 +636,16 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
});
socket.on("data", (chunk) => decoder.push(chunk));
socket.once("error", () => {
- clearTimeout(timer);
finish(null);
});
+ timer = setTimeout(() => finish(null), timeoutMs);
+ timer.unref?.();
+ if (signal?.aborted) {
+ onAbort();
+ return;
+ }
+ signal?.addEventListener("abort", onAbort, { once: true });
+ socket.connect(paths.socket);
});
}
function spawnDaemonProcess(paths) {
@@ -650,14 +663,62 @@ function spawnDaemonProcess(paths) {
}
function defaultEnsureDaemonDeps() {
return {
- probe: (paths) => probeDaemon(paths),
+ probe: (paths, signal) => probeDaemon(paths, PROBE_TIMEOUT_MS, signal),
spawnDaemon: (paths) => spawnDaemonProcess(paths),
- sleep: (ms) => new Promise((resolve2) => {
- setTimeout(resolve2, ms);
- }),
+ sleep: (ms, signal) => sleepWithSignal(ms, signal),
now: () => Date.now()
};
}
+function sleepWithSignal(ms, signal) {
+ return new Promise((resolve2) => {
+ let settled = false;
+ const finish = () => {
+ if (settled)
+ return;
+ settled = true;
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", finish);
+ resolve2();
+ };
+ const timer = setTimeout(finish, ms);
+ if (signal?.aborted) {
+ finish();
+ return;
+ }
+ signal?.addEventListener("abort", finish, { once: true });
+ });
+}
+function awaitWithSignal(promise, signal) {
+ if (!signal)
+ return promise;
+ if (signal.aborted)
+ return Promise.reject(abortError(signal));
+ return new Promise((resolve2, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(abortError(signal)));
+ signal.addEventListener("abort", onAbort, { once: true });
+ promise.then((value) => finish(() => resolve2(value)), (error) => finish(() => reject(error)));
+ });
+}
+function throwIfAborted(signal) {
+ if (signal?.aborted)
+ throw abortError(signal);
+}
+function abortError(signal) {
+ const reason = signal.reason;
+ if (reason instanceof Error)
+ return reason;
+ const error = new Error(typeof reason === "string" ? reason : "daemon startup cancelled");
+ error.name = "AbortError";
+ return error;
+}
function parsePingResponse(message) {
if (!message || typeof message !== "object" || Array.isArray(message))
return null;
@@ -697,6 +758,9 @@ function errorResponse(id, code, message, data) {
function jsonRpcId2(value) {
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
}
+function messageFromError(error) {
+ return error instanceof Error ? error.message : String(error);
+}
// ../mcp-stdio-core/src/transport.ts
var HEADER_SEPARATOR = Buffer.from(`\r
\r
@@ -719,16 +783,45 @@ async function* readStdioJsonRpcMessages(input) {
yield parseJsonPayload(trailing, "line");
}
}
-function writeStdioJsonRpcResponse(output, response, responseMode) {
+async function writeStdioJsonRpcResponse(output, response, responseMode) {
const body = JSON.stringify(response);
- if (responseMode === "framed") {
- output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
+ const payload = responseMode === "framed" ? `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
\r
-${body}`);
- return;
- }
- output.write(`${body}
-`);
+${body}` : `${body}
+`;
+ await writeChunk(output, payload);
+}
+function writeChunk(output, chunk) {
+ return new Promise((resolve2, reject) => {
+ let settled = false;
+ const onError = (error) => {
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ };
+ output.once("error", onError);
+ try {
+ output.write(chunk, (error) => {
+ if (settled)
+ return;
+ settled = true;
+ if (error) {
+ queueMicrotask(() => output.removeListener("error", onError));
+ reject(error);
+ return;
+ }
+ output.removeListener("error", onError);
+ resolve2();
+ });
+ } catch (error) {
+ output.removeListener("error", onError);
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ }
+ });
}
function readNextMessage(buffer) {
if (buffer.length === 0)
@@ -824,39 +917,69 @@ async function runJsonRpcStdioServer(config) {
break;
idleTimer.arm();
if (message.kind === "parse_error") {
- handleParseError(message, config, log);
+ if (!await handleParseError(message, config, log))
+ break;
continue;
}
- await handleRequest(message, config, log);
+ if (!await handleRequest(message, config, log))
+ break;
}
} finally {
idleTimer.clear();
log("stdio_stopped");
}
}
-function handleParseError(message, config, log) {
+async function handleParseError(message, config, log) {
log("parse_error", { message: message.message });
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
- if (response !== undefined) {
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- }
+ if (response === undefined)
+ return true;
+ return writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ });
}
async function handleRequest(message, config, log) {
const parsed = message.payload;
const id = isPlainRecord(parsed) ? jsonRpcId2(parsed["id"]) : null;
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
log("request", { id: id === null ? null : String(id), method });
+ let response;
try {
- const response = await config.handler(parsed, config.handlerOptions);
- if (response === undefined)
- return;
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ response = await config.handler(parsed, config.handlerOptions);
} catch (error) {
if (config.onHandlerError === undefined)
throw error;
config.onHandlerError(error);
+ return true;
}
+ if (response === undefined)
+ return true;
+ if (!await writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ }))
+ return false;
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ return true;
+}
+async function writeResponse(response, context) {
+ try {
+ await writeStdioJsonRpcResponse(context.output, response, context.responseMode);
+ return true;
+ } catch (error) {
+ if (!isTerminalOutputError(error))
+ throw error;
+ context.log("output_error", { message: messageFromError(error) });
+ return false;
+ }
+}
+function isTerminalOutputError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED" || error.code === "ERR_STREAM_WRITE_AFTER_END";
}
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
let timer = null;
@@ -1065,7 +1188,7 @@ class JsonRpcConnection {
settled = true;
this.pendingRequests.delete(key);
cleanup();
- const rejectCancelled = () => reject(abortError(options.signal));
+ const rejectCancelled = () => reject(abortError2(options.signal));
if (!requestWritten) {
cancelAfterWrite = true;
rejectCancelled();
@@ -1269,7 +1392,7 @@ ${body}`;
}
}
}
-function abortError(signal) {
+function abortError2(signal) {
const reason = signal?.reason;
if (reason instanceof Error)
return reason;
@@ -3547,11 +3670,11 @@ function waitForDiagnosticsActivity(wait, signal) {
if (!signal)
return wait;
if (signal.aborted)
- return Promise.reject(abortError2(signal));
+ return Promise.reject(abortError3(signal));
return new Promise((resolve7, reject) => {
const onAbort = () => {
signal.removeEventListener("abort", onAbort);
- reject(abortError2(signal));
+ reject(abortError3(signal));
};
signal.addEventListener("abort", onAbort, { once: true });
wait.then(() => {
@@ -3586,7 +3709,7 @@ function preCommitAbortReason(source) {
return reason;
return new Error("LSP request cancelled before workspace edit commit");
}
-function abortError2(signal) {
+function abortError3(signal) {
const reason = signal.reason;
if (reason instanceof Error)
return reason;
@@ -3621,7 +3744,7 @@ async function stopClientBestEffort(client) {
reportBestEffortCleanupError("client stop", error);
}
}
-function awaitWithSignal(promise, signal) {
+function awaitWithSignal2(promise, signal) {
if (!signal)
return promise;
return new Promise((resolve7, reject) => {
@@ -3724,7 +3847,7 @@ class LspManager {
if (managed.initPromise) {
managed.pendingWaiters++;
try {
- await awaitWithSignal(managed.initPromise, signal);
+ await awaitWithSignal2(managed.initPromise, signal);
} catch (err) {
managed.pendingWaiters--;
await this.tryDeleteIfOrphaned(key, managed);
@@ -3762,7 +3885,7 @@ class LspManager {
};
this.clients.set(key, newManaged);
try {
- await awaitWithSignal(initPromise, signal);
+ await awaitWithSignal2(initPromise, signal);
} catch (err) {
newManaged.pendingWaiters--;
if (this.clients.get(key) === newManaged) {
@@ -4748,7 +4871,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
const fileErrors = [];
const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
options.signal?.throwIfAborted();
- const client = await manager.getClient(root, server2);
+ const client = await manager.getClient(root, server2, options.signal);
try {
let nextIndex = 0;
const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
@@ -5618,14 +5741,14 @@ class DaemonRequestCancelledError extends DaemonRequestError {
async function callToolViaDaemon(name, args, options) {
const context = requireContext(options.context);
const paths = options.paths ?? daemonPaths();
- const ensure = options.ensure ?? ensureDaemonRunning;
+ const ensure = options.ensure ?? ((ensurePaths, signal) => ensureDaemonRunning(ensurePaths, undefined, signal === undefined ? {} : { signal }));
const timeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
const requestArgs = withContext(args, context);
let lastError;
let authRefreshUsed = false;
for (let attempt = 0;attempt < 3; attempt += 1) {
try {
- await ensure(paths);
+ await ensureDaemonAvailable(paths, ensure, options.signal);
const token = readAuthToken(paths);
if (!token)
throw new DaemonRequestError("daemon auth token missing", false);
@@ -5667,6 +5790,27 @@ function requireContext(context) {
function withContext(args, context) {
return { ...args, [CONTEXT_KEY]: context };
}
+function ensureDaemonAvailable(paths, ensure, signal) {
+ if (!signal)
+ return ensure(paths);
+ return new Promise((resolve9, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(new DaemonRequestCancelledError(false)));
+ if (signal.aborted) {
+ onAbort();
+ return;
+ }
+ signal.addEventListener("abort", onAbort, { once: true });
+ Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve9()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
+ });
+}
function daemonUnreachableResult(paths, error) {
const text2 = [
`LSP daemon unreachable: ${errorText(error)}.`,
@@ -5680,7 +5824,7 @@ function daemonUnreachableResult(paths, error) {
}
function sendToolCall(paths, token, name, args, options) {
return new Promise((resolve9, reject) => {
- const socket = connect2(paths.socket);
+ const socket = connect(paths.socket);
const requestId = allocateProxyRequestId();
let settled = false;
let requestWritten = false;
diff --git a/plugins/omo/components/lsp-daemon/dist/daemon-client.d.ts b/plugins/omo/components/lsp-daemon/dist/daemon-client.d.ts
index af1e0582..ec15f240 100644
--- a/plugins/omo/components/lsp-daemon/dist/daemon-client.d.ts
+++ b/plugins/omo/components/lsp-daemon/dist/daemon-client.d.ts
@@ -1,5 +1,5 @@
-import type { ToolExecutionResult } from "@oh-my-opencode/lsp-core/tools";
import { type LspRequestContext } from "@oh-my-opencode/lsp-core/request-context";
+import type { ToolExecutionResult } from "@oh-my-opencode/lsp-core/tools";
import { type DaemonPaths } from "./paths.js";
export declare class DaemonRequestError extends Error {
readonly requestWritten: boolean;
@@ -17,7 +17,7 @@ export interface CallToolOptions {
paths?: DaemonPaths;
requestTimeoutMs?: number;
signal?: AbortSignal;
- ensure?: (paths: DaemonPaths) => Promise<void>;
+ ensure?: (paths: DaemonPaths, signal?: AbortSignal) => Promise<void>;
}
export declare function callToolViaDaemon(name: string, args: Record<string, unknown>, options: CallToolOptions): Promise<ToolExecutionResult>;
export declare function callDiagnosticsViaDaemon(filePath: string, options: CallToolOptions): Promise<ToolExecutionResult>;
diff --git a/plugins/omo/components/lsp-daemon/dist/daemon-client.js b/plugins/omo/components/lsp-daemon/dist/daemon-client.js
index f9ce012e..36be8891 100644
--- a/plugins/omo/components/lsp-daemon/dist/daemon-client.js
+++ b/plugins/omo/components/lsp-daemon/dist/daemon-client.js
@@ -32,14 +32,15 @@ export class DaemonRequestCancelledError extends DaemonRequestError {
export async function callToolViaDaemon(name, args, options) {
const context = requireContext(options.context);
const paths = options.paths ?? daemonPaths();
- const ensure = options.ensure ?? ensureDaemonRunning;
+ const ensure = options.ensure ??
+ ((ensurePaths, signal) => ensureDaemonRunning(ensurePaths, undefined, signal === undefined ? {} : { signal }));
const timeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
const requestArgs = withContext(args, context);
let lastError;
let authRefreshUsed = false;
for (let attempt = 0; attempt < 3; attempt += 1) {
try {
- await ensure(paths);
+ await ensureDaemonAvailable(paths, ensure, options.signal);
const token = readAuthToken(paths);
if (!token)
throw new DaemonRequestError("daemon auth token missing", false);
@@ -82,6 +83,29 @@ function requireContext(context) {
function withContext(args, context) {
return { ...args, [CONTEXT_KEY]: context };
}
+function ensureDaemonAvailable(paths, ensure, signal) {
+ if (!signal)
+ return ensure(paths);
+ return new Promise((resolve, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(new DaemonRequestCancelledError(false)));
+ if (signal.aborted) {
+ onAbort();
+ return;
+ }
+ signal.addEventListener("abort", onAbort, { once: true });
+ Promise.resolve()
+ .then(() => ensure(paths, signal))
+ .then(() => finish(() => resolve()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
+ });
+}
function daemonUnreachableResult(paths, error) {
const text = [
`LSP daemon unreachable: ${errorText(error)}.`,
diff --git a/plugins/omo/components/lsp-daemon/dist/ensure-daemon.d.ts b/plugins/omo/components/lsp-daemon/dist/ensure-daemon.d.ts
index 4c5c73f5..1bceccdf 100644
--- a/plugins/omo/components/lsp-daemon/dist/ensure-daemon.d.ts
+++ b/plugins/omo/components/lsp-daemon/dist/ensure-daemon.d.ts
@@ -6,18 +6,19 @@ export declare class DaemonUnreachableError extends Error {
constructor(socketPath: string);
}
export interface EnsureDaemonDeps {
- probe(paths: DaemonPaths): Promise<boolean>;
+ probe(paths: DaemonPaths, signal?: AbortSignal): Promise<boolean>;
spawnDaemon(paths: DaemonPaths): void;
- sleep(ms: number): Promise<void>;
+ sleep(ms: number, signal?: AbortSignal): Promise<void>;
now(): number;
}
export interface EnsureDaemonOptions {
readyTimeoutMs?: number;
pollIntervalMs?: number;
+ readonly signal?: AbortSignal;
}
export declare function ensureDaemonRunning(paths: DaemonPaths, deps?: EnsureDaemonDeps, options?: EnsureDaemonOptions): Promise<void>;
-export declare function probeDaemon(paths: DaemonPaths, timeoutMs?: number): Promise<boolean>;
-export declare function pingDaemon(paths: DaemonPaths, token: string, timeoutMs?: number): Promise<OwnerPing | null>;
+export declare function probeDaemon(paths: DaemonPaths, timeoutMs?: number, signal?: AbortSignal): Promise<boolean>;
+export declare function pingDaemon(paths: DaemonPaths, token: string, timeoutMs?: number, signal?: AbortSignal): Promise<OwnerPing | null>;
export declare function spawnDaemonProcess(paths: DaemonPaths): void;
export declare function resolveDaemonCliPath(env?: NodeJS.ProcessEnv, defaults?: DaemonRuntimeDefaults): string;
export declare function defaultEnsureDaemonDeps(): EnsureDaemonDeps;
diff --git a/plugins/omo/components/lsp-daemon/dist/ensure-daemon.js b/plugins/omo/components/lsp-daemon/dist/ensure-daemon.js
index d90c9b51..1e4bdeaf 100644
--- a/plugins/omo/components/lsp-daemon/dist/ensure-daemon.js
+++ b/plugins/omo/components/lsp-daemon/dist/ensure-daemon.js
@@ -1,6 +1,6 @@
import { spawn } from "node:child_process";
import { closeSync, mkdirSync, openSync } from "node:fs";
-import { connect } from "node:net";
+import { Socket } from "node:net";
import { dirname } from "node:path";
import { execPath } from "node:process";
import { authEnvelope, readAuthToken } from "./ipc-protocol.js";
@@ -20,42 +20,48 @@ export class DaemonUnreachableError extends Error {
export async function ensureDaemonRunning(paths, deps = defaultEnsureDaemonDeps(), options = {}) {
const readyTimeoutMs = options.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
- if (await deps.probe(paths))
+ const signal = options.signal;
+ throwIfAborted(signal);
+ if (await awaitWithSignal(deps.probe(paths, signal), signal))
return;
+ throwIfAborted(signal);
deps.spawnDaemon(paths);
- await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs);
+ await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal);
}
-async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs) {
+async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal) {
const deadline = deps.now() + readyTimeoutMs;
for (;;) {
- if (await deps.probe(paths))
+ throwIfAborted(signal);
+ if (await awaitWithSignal(deps.probe(paths, signal), signal))
return;
if (deps.now() >= deadline)
throw new DaemonUnreachableError(paths.socket);
- await deps.sleep(pollIntervalMs);
+ await awaitWithSignal(deps.sleep(pollIntervalMs, signal), signal);
}
}
-export async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS) {
+export async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS, signal) {
const token = readAuthToken(paths);
if (!token)
return false;
- return (await pingDaemon(paths, token, timeoutMs)) !== null;
+ return (await pingDaemon(paths, token, timeoutMs, signal)) !== null;
}
-export function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
+export function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
return new Promise((resolve) => {
- const socket = connect(paths.socket);
+ const socket = new Socket();
let settled = false;
+ let timer;
const finish = (value) => {
if (settled)
return;
settled = true;
+ if (timer !== undefined)
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", onAbort);
socket.destroy();
resolve(value);
};
- const timer = setTimeout(() => finish(null), timeoutMs);
- timer.unref?.();
+ const onAbort = () => finish(null);
const decoder = createLineDecoder((message) => {
- clearTimeout(timer);
finish(parsePingResponse(message));
});
socket.once("connect", () => {
@@ -63,9 +69,16 @@ export function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
});
socket.on("data", (chunk) => decoder.push(chunk));
socket.once("error", () => {
- clearTimeout(timer);
finish(null);
});
+ timer = setTimeout(() => finish(null), timeoutMs);
+ timer.unref?.();
+ if (signal?.aborted) {
+ onAbort();
+ return;
+ }
+ signal?.addEventListener("abort", onAbort, { once: true });
+ socket.connect(paths.socket);
});
}
export function spawnDaemonProcess(paths) {
@@ -87,14 +100,62 @@ export function resolveDaemonCliPath(env = process.env, defaults = packagedRunti
}
export function defaultEnsureDaemonDeps() {
return {
- probe: (paths) => probeDaemon(paths),
+ probe: (paths, signal) => probeDaemon(paths, PROBE_TIMEOUT_MS, signal),
spawnDaemon: (paths) => spawnDaemonProcess(paths),
- sleep: (ms) => new Promise((resolve) => {
- setTimeout(resolve, ms);
- }),
+ sleep: (ms, signal) => sleepWithSignal(ms, signal),
now: () => Date.now(),
};
}
+function sleepWithSignal(ms, signal) {
+ return new Promise((resolve) => {
+ let settled = false;
+ const finish = () => {
+ if (settled)
+ return;
+ settled = true;
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", finish);
+ resolve();
+ };
+ const timer = setTimeout(finish, ms);
+ if (signal?.aborted) {
+ finish();
+ return;
+ }
+ signal?.addEventListener("abort", finish, { once: true });
+ });
+}
+function awaitWithSignal(promise, signal) {
+ if (!signal)
+ return promise;
+ if (signal.aborted)
+ return Promise.reject(abortError(signal));
+ return new Promise((resolve, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(abortError(signal)));
+ signal.addEventListener("abort", onAbort, { once: true });
+ promise.then((value) => finish(() => resolve(value)), (error) => finish(() => reject(error)));
+ });
+}
+function throwIfAborted(signal) {
+ if (signal?.aborted)
+ throw abortError(signal);
+}
+function abortError(signal) {
+ const reason = signal.reason;
+ if (reason instanceof Error)
+ return reason;
+ const error = new Error(typeof reason === "string" ? reason : "daemon startup cancelled");
+ error.name = "AbortError";
+ return error;
+}
function parsePingResponse(message) {
if (!message || typeof message !== "object" || Array.isArray(message))
return null;
diff --git a/plugins/omo/components/lsp-daemon/dist/index.js b/plugins/omo/components/lsp-daemon/dist/index.js
index 46dcc098..6aa963e6 100644
--- a/plugins/omo/components/lsp-daemon/dist/index.js
+++ b/plugins/omo/components/lsp-daemon/dist/index.js
@@ -3006,7 +3006,7 @@ async function disposeDefaultLspManager() {
}
}
// src/daemon-client.ts
-import { connect as connect2 } from "node:net";
+import { connect } from "node:net";
import { homedir as homedir3 } from "node:os";
import { join as join7 } from "node:path";
@@ -3187,7 +3187,7 @@ function isPlainRecord(value) {
// src/ensure-daemon.ts
import { spawn as spawn2 } from "node:child_process";
import { closeSync as closeSync2, mkdirSync as mkdirSync2, openSync as openSync2 } from "node:fs";
-import { connect } from "node:net";
+import { Socket } from "node:net";
import { dirname as dirname6 } from "node:path";
import { execPath } from "node:process";
@@ -3594,42 +3594,48 @@ class DaemonUnreachableError extends Error {
async function ensureDaemonRunning(paths, deps = defaultEnsureDaemonDeps(), options = {}) {
const readyTimeoutMs = options.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
- if (await deps.probe(paths))
+ const signal = options.signal;
+ throwIfAborted(signal);
+ if (await awaitWithSignal2(deps.probe(paths, signal), signal))
return;
+ throwIfAborted(signal);
deps.spawnDaemon(paths);
- await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs);
+ await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal);
}
-async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs) {
+async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal) {
const deadline = deps.now() + readyTimeoutMs;
for (;; ) {
- if (await deps.probe(paths))
+ throwIfAborted(signal);
+ if (await awaitWithSignal2(deps.probe(paths, signal), signal))
return;
if (deps.now() >= deadline)
throw new DaemonUnreachableError(paths.socket);
- await deps.sleep(pollIntervalMs);
+ await awaitWithSignal2(deps.sleep(pollIntervalMs, signal), signal);
}
}
-async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS) {
+async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS, signal) {
const token = readAuthToken(paths);
if (!token)
return false;
- return await pingDaemon(paths, token, timeoutMs) !== null;
+ return await pingDaemon(paths, token, timeoutMs, signal) !== null;
}
-function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
+function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
return new Promise((resolve7) => {
- const socket = connect(paths.socket);
+ const socket = new Socket;
let settled = false;
+ let timer;
const finish = (value) => {
if (settled)
return;
settled = true;
+ if (timer !== undefined)
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", onAbort);
socket.destroy();
resolve7(value);
};
- const timer = setTimeout(() => finish(null), timeoutMs);
- timer.unref?.();
+ const onAbort = () => finish(null);
const decoder = createLineDecoder((message) => {
- clearTimeout(timer);
finish(parsePingResponse(message));
});
socket.once("connect", () => {
@@ -3637,9 +3643,16 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
});
socket.on("data", (chunk) => decoder.push(chunk));
socket.once("error", () => {
- clearTimeout(timer);
finish(null);
});
+ timer = setTimeout(() => finish(null), timeoutMs);
+ timer.unref?.();
+ if (signal?.aborted) {
+ onAbort();
+ return;
+ }
+ signal?.addEventListener("abort", onAbort, { once: true });
+ socket.connect(paths.socket);
});
}
function spawnDaemonProcess(paths) {
@@ -3657,14 +3670,62 @@ function spawnDaemonProcess(paths) {
}
function defaultEnsureDaemonDeps() {
return {
- probe: (paths) => probeDaemon(paths),
+ probe: (paths, signal) => probeDaemon(paths, PROBE_TIMEOUT_MS, signal),
spawnDaemon: (paths) => spawnDaemonProcess(paths),
- sleep: (ms) => new Promise((resolve7) => {
- setTimeout(resolve7, ms);
- }),
+ sleep: (ms, signal) => sleepWithSignal(ms, signal),
now: () => Date.now()
};
}
+function sleepWithSignal(ms, signal) {
+ return new Promise((resolve7) => {
+ let settled = false;
+ const finish = () => {
+ if (settled)
+ return;
+ settled = true;
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", finish);
+ resolve7();
+ };
+ const timer = setTimeout(finish, ms);
+ if (signal?.aborted) {
+ finish();
+ return;
+ }
+ signal?.addEventListener("abort", finish, { once: true });
+ });
+}
+function awaitWithSignal2(promise, signal) {
+ if (!signal)
+ return promise;
+ if (signal.aborted)
+ return Promise.reject(abortError3(signal));
+ return new Promise((resolve7, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(abortError3(signal)));
+ signal.addEventListener("abort", onAbort, { once: true });
+ promise.then((value) => finish(() => resolve7(value)), (error) => finish(() => reject(error)));
+ });
+}
+function throwIfAborted(signal) {
+ if (signal?.aborted)
+ throw abortError3(signal);
+}
+function abortError3(signal) {
+ const reason = signal.reason;
+ if (reason instanceof Error)
+ return reason;
+ const error = new Error(typeof reason === "string" ? reason : "daemon startup cancelled");
+ error.name = "AbortError";
+ return error;
+}
function parsePingResponse(message) {
if (!message || typeof message !== "object" || Array.isArray(message))
return null;
@@ -3704,6 +3765,9 @@ function errorResponse(id, code, message, data) {
function jsonRpcId2(value) {
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
}
+function messageFromError(error) {
+ return error instanceof Error ? error.message : String(error);
+}
// ../mcp-stdio-core/src/transport.ts
var HEADER_SEPARATOR2 = Buffer.from(`\r
\r
@@ -3726,16 +3790,45 @@ async function* readStdioJsonRpcMessages(input) {
yield parseJsonPayload(trailing, "line");
}
}
-function writeStdioJsonRpcResponse(output, response, responseMode) {
+async function writeStdioJsonRpcResponse(output, response, responseMode) {
const body = JSON.stringify(response);
- if (responseMode === "framed") {
- output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
+ const payload = responseMode === "framed" ? `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
\r
-${body}`);
- return;
- }
- output.write(`${body}
-`);
+${body}` : `${body}
+`;
+ await writeChunk(output, payload);
+}
+function writeChunk(output, chunk) {
+ return new Promise((resolve7, reject) => {
+ let settled = false;
+ const onError = (error) => {
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ };
+ output.once("error", onError);
+ try {
+ output.write(chunk, (error) => {
+ if (settled)
+ return;
+ settled = true;
+ if (error) {
+ queueMicrotask(() => output.removeListener("error", onError));
+ reject(error);
+ return;
+ }
+ output.removeListener("error", onError);
+ resolve7();
+ });
+ } catch (error) {
+ output.removeListener("error", onError);
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ }
+ });
}
function readNextMessage(buffer) {
if (buffer.length === 0)
@@ -3831,40 +3924,70 @@ async function runJsonRpcStdioServer(config) {
break;
idleTimer.arm();
if (message.kind === "parse_error") {
- handleParseError(message, config, log);
+ if (!await handleParseError(message, config, log))
+ break;
continue;
}
- await handleRequest(message, config, log);
+ if (!await handleRequest(message, config, log))
+ break;
}
} finally {
idleTimer.clear();
log("stdio_stopped");
}
}
-function handleParseError(message, config, log) {
+async function handleParseError(message, config, log) {
log("parse_error", { message: message.message });
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
- if (response !== undefined) {
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- }
+ if (response === undefined)
+ return true;
+ return writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ });
}
async function handleRequest(message, config, log) {
const parsed = message.payload;
const id = isPlainRecord(parsed) ? jsonRpcId2(parsed["id"]) : null;
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
log("request", { id: id === null ? null : String(id), method });
+ let response;
try {
- const response = await config.handler(parsed, config.handlerOptions);
- if (response === undefined)
- return;
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ response = await config.handler(parsed, config.handlerOptions);
} catch (error) {
if (config.onHandlerError === undefined)
throw error;
config.onHandlerError(error);
+ return true;
+ }
+ if (response === undefined)
+ return true;
+ if (!await writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ }))
+ return false;
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ return true;
+}
+async function writeResponse(response, context) {
+ try {
+ await writeStdioJsonRpcResponse(context.output, response, context.responseMode);
+ return true;
+ } catch (error) {
+ if (!isTerminalOutputError(error))
+ throw error;
+ context.log("output_error", { message: messageFromError(error) });
+ return false;
}
}
+function isTerminalOutputError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED" || error.code === "ERR_STREAM_WRITE_AFTER_END";
+}
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
let timer = null;
let isClosed = false;
@@ -4747,7 +4870,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
const fileErrors = [];
const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
options.signal?.throwIfAborted();
- const client = await manager.getClient(root, server2);
+ const client = await manager.getClient(root, server2, options.signal);
try {
let nextIndex = 0;
const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
@@ -5617,14 +5740,14 @@ class DaemonRequestCancelledError extends DaemonRequestError {
async function callToolViaDaemon(name, args, options) {
const context = requireContext(options.context);
const paths = options.paths ?? daemonPaths();
- const ensure = options.ensure ?? ensureDaemonRunning;
+ const ensure = options.ensure ?? ((ensurePaths, signal) => ensureDaemonRunning(ensurePaths, undefined, signal === undefined ? {} : { signal }));
const timeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
const requestArgs = withContext(args, context);
let lastError;
let authRefreshUsed = false;
for (let attempt = 0;attempt < 3; attempt += 1) {
try {
- await ensure(paths);
+ await ensureDaemonAvailable(paths, ensure, options.signal);
const token = readAuthToken(paths);
if (!token)
throw new DaemonRequestError("daemon auth token missing", false);
@@ -5666,6 +5789,27 @@ function requireContext(context) {
function withContext(args, context) {
return { ...args, [CONTEXT_KEY]: context };
}
+function ensureDaemonAvailable(paths, ensure, signal) {
+ if (!signal)
+ return ensure(paths);
+ return new Promise((resolve9, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(new DaemonRequestCancelledError(false)));
+ if (signal.aborted) {
+ onAbort();
+ return;
+ }
+ signal.addEventListener("abort", onAbort, { once: true });
+ Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve9()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
+ });
+}
function daemonUnreachableResult(paths, error) {
const text2 = [
`LSP daemon unreachable: ${errorText(error)}.`,
@@ -5679,7 +5823,7 @@ function daemonUnreachableResult(paths, error) {
}
function sendToolCall(paths, token, name, args, options) {
return new Promise((resolve9, reject) => {
- const socket = connect2(paths.socket);
+ const socket = connect(paths.socket);
const requestId = allocateProxyRequestId();
let settled = false;
let requestWritten = false;
@@ -5781,38 +5925,93 @@ function errorText(error) {
// src/proxy.ts
import { existsSync as existsSync11, realpathSync as realpathSync4 } from "node:fs";
import { basename as basename3, delimiter as delimiter4, dirname as dirname9, isAbsolute as isAbsolute4 } from "node:path";
+var DEFAULT_STARTUP_TIMEOUT_MS = 1e4;
async function runMcpStdioProxy(options = {}) {
const input = options.input ?? process.stdin;
const output = options.output ?? process.stdout;
- const paths = options.paths ?? daemonPaths();
- const env = options.env ?? process.env;
- const cwd = options.cwd ?? inferOpenCodeProjectCwd(env["LSP_TOOLS_MCP_PROJECT_CONFIG"]);
- const contextEnv = cwd === undefined ? env : canonicalizeContextEnv(env);
- const contextInput = {
- env: contextEnv,
- ...cwd === undefined ? {} : { cwd },
- ...options.homeDir === undefined ? {} : { homeDir: options.homeDir }
+ const stderr = options.stderr ?? process.stderr;
+ const startupTimeoutMs = options.startupTimeoutMs ?? DEFAULT_STARTUP_TIMEOUT_MS;
+ const lifecycleController = new AbortController;
+ const abortFromInput = () => lifecycleController.abort();
+ let startupExpired = false;
+ let startupTimer;
+ const clearStartupWatchdog = () => {
+ if (startupTimer === undefined)
+ return;
+ clearTimeout(startupTimer);
+ startupTimer = undefined;
};
- const context = options.context ?? createStandaloneMcpRequestContext(contextInput);
- const callOptions = { paths, context, ...options.ensure ? { ensure: options.ensure } : {} };
- await runJsonRpcStdioServer({
- input,
- output,
- idleTimeoutMs: 0,
- handler: (request, requestOptions) => runWithRequestContext(context, () => handleProxyRequest(request, requestOptions)),
- handlerOptions: callOptions,
- onHandlerError: (error) => {
- process.stderr.write(`[lsp-daemon] proxy error: ${error instanceof Error ? error.message : String(error)}
+ input.once("end", abortFromInput);
+ input.once("close", abortFromInput);
+ if (startupTimeoutMs > 0) {
+ startupTimer = setTimeout(() => {
+ startupExpired = true;
+ input.destroy();
+ try {
+ stderr.write(`[lsp-daemon] no MCP request received within ${startupTimeoutMs}ms; exiting
`);
- }
- });
+ } catch (error) {
+ if (stderr !== process.stderr) {
+ process.stderr.write(`[lsp-daemon] startup diagnostic failed: ${error instanceof Error ? error.message : String(error)}
+`);
+ }
+ }
+ }, startupTimeoutMs);
+ }
+ try {
+ const paths = options.paths ?? daemonPaths();
+ const env = options.env ?? process.env;
+ const cwd = options.cwd ?? inferOpenCodeProjectCwd(env["LSP_TOOLS_MCP_PROJECT_CONFIG"]);
+ const contextEnv = cwd === undefined ? env : canonicalizeContextEnv(env);
+ const contextInput = {
+ env: contextEnv,
+ ...cwd === undefined ? {} : { cwd },
+ ...options.homeDir === undefined ? {} : { homeDir: options.homeDir }
+ };
+ const context = options.context ?? createStandaloneMcpRequestContext(contextInput);
+ const callOptions = {
+ paths,
+ context,
+ ...options.ensure ? { ensure: options.ensure } : {},
+ signal: lifecycleController.signal
+ };
+ await runJsonRpcStdioServer({
+ input,
+ output,
+ idleTimeoutMs: 0,
+ handler: (request, requestOptions) => {
+ clearStartupWatchdog();
+ return runWithRequestContext(context, () => handleProxyRequest(request, requestOptions));
+ },
+ handlerOptions: callOptions,
+ onHandlerError: (error) => {
+ stderr.write(`[lsp-daemon] proxy error: ${error instanceof Error ? error.message : String(error)}
+`);
+ }
+ });
+ } catch (error) {
+ if (!startupExpired || !isPrematureCloseError(error))
+ throw error;
+ } finally {
+ if (startupTimer !== undefined)
+ clearTimeout(startupTimer);
+ input.removeListener("end", abortFromInput);
+ input.removeListener("close", abortFromInput);
+ }
+}
+function isPrematureCloseError(error) {
+ return error instanceof Error && Reflect.get(error, "code") === "ERR_STREAM_PREMATURE_CLOSE";
}
async function handleProxyRequest(parsed, callOptions) {
const toolCall = asToolCall(parsed);
if (!toolCall)
return handleLspMcpRequest(parsed);
const result = await callToolViaDaemon(toolCall.name, toolCall.args, callOptions);
- return successResponse(toolCall.id, { content: result.content, isError: result.isError ?? false, details: result.details });
+ return successResponse(toolCall.id, {
+ content: result.content,
+ isError: result.isError ?? false,
+ details: result.details
+ });
}
function asToolCall(parsed) {
if (!isPlainRecord(parsed) || parsed["method"] !== "tools/call")
diff --git a/plugins/omo/components/lsp-daemon/dist/proxy.d.ts b/plugins/omo/components/lsp-daemon/dist/proxy.d.ts
index 3a6fe01e..8cf2be26 100644
--- a/plugins/omo/components/lsp-daemon/dist/proxy.d.ts
+++ b/plugins/omo/components/lsp-daemon/dist/proxy.d.ts
@@ -4,11 +4,13 @@ import { type DaemonPaths } from "./paths.js";
export interface ProxyOptions {
input?: Readable;
output?: Writable;
+ stderr?: Writable;
paths?: DaemonPaths;
context?: DaemonToolContext;
cwd?: string;
env?: Record<string, string | undefined>;
homeDir?: string;
ensure?: CallToolOptions["ensure"];
+ startupTimeoutMs?: number;
}
export declare function runMcpStdioProxy(options?: ProxyOptions): Promise<void>;
diff --git a/plugins/omo/components/lsp-daemon/dist/proxy.js b/plugins/omo/components/lsp-daemon/dist/proxy.js
index 32d31866..e4708d23 100644
--- a/plugins/omo/components/lsp-daemon/dist/proxy.js
+++ b/plugins/omo/components/lsp-daemon/dist/proxy.js
@@ -1,42 +1,98 @@
import { existsSync, realpathSync } from "node:fs";
import { basename, delimiter, dirname, isAbsolute } from "node:path";
-import { jsonRpcId, runJsonRpcStdioServer, successResponse } from "@oh-my-opencode/mcp-stdio-core";
-import { isPlainRecord } from "@oh-my-opencode/mcp-stdio-core/record";
import { handleLspMcpRequest } from "@oh-my-opencode/lsp-core/mcp";
import { createStandaloneMcpRequestContext, runWithRequestContext } from "@oh-my-opencode/lsp-core/request-context";
+import { jsonRpcId, runJsonRpcStdioServer, successResponse } from "@oh-my-opencode/mcp-stdio-core";
+import { isPlainRecord } from "@oh-my-opencode/mcp-stdio-core/record";
import { callToolViaDaemon } from "./daemon-client.js";
import { daemonPaths } from "./paths.js";
+const DEFAULT_STARTUP_TIMEOUT_MS = 10_000;
export async function runMcpStdioProxy(options = {}) {
const input = options.input ?? process.stdin;
const output = options.output ?? process.stdout;
- const paths = options.paths ?? daemonPaths();
- const env = options.env ?? process.env;
- const cwd = options.cwd ?? inferOpenCodeProjectCwd(env["LSP_TOOLS_MCP_PROJECT_CONFIG"]);
- const contextEnv = cwd === undefined ? env : canonicalizeContextEnv(env);
- const contextInput = {
- env: contextEnv,
- ...(cwd === undefined ? {} : { cwd }),
- ...(options.homeDir === undefined ? {} : { homeDir: options.homeDir }),
+ const stderr = options.stderr ?? process.stderr;
+ const startupTimeoutMs = options.startupTimeoutMs ?? DEFAULT_STARTUP_TIMEOUT_MS;
+ const lifecycleController = new AbortController();
+ const abortFromInput = () => lifecycleController.abort();
+ let startupExpired = false;
+ let startupTimer;
+ const clearStartupWatchdog = () => {
+ if (startupTimer === undefined)
+ return;
+ clearTimeout(startupTimer);
+ startupTimer = undefined;
};
- const context = options.context ?? createStandaloneMcpRequestContext(contextInput);
- const callOptions = { paths, context, ...(options.ensure ? { ensure: options.ensure } : {}) };
- await runJsonRpcStdioServer({
- input,
- output,
- idleTimeoutMs: 0,
- handler: (request, requestOptions) => runWithRequestContext(context, () => handleProxyRequest(request, requestOptions)),
- handlerOptions: callOptions,
- onHandlerError: (error) => {
- process.stderr.write(`[lsp-daemon] proxy error: ${error instanceof Error ? error.message : String(error)}\n`);
- },
- });
+ input.once("end", abortFromInput);
+ input.once("close", abortFromInput);
+ if (startupTimeoutMs > 0) {
+ startupTimer = setTimeout(() => {
+ startupExpired = true;
+ input.destroy();
+ try {
+ stderr.write(`[lsp-daemon] no MCP request received within ${startupTimeoutMs}ms; exiting\n`);
+ }
+ catch (error) {
+ if (stderr !== process.stderr) {
+ process.stderr.write(`[lsp-daemon] startup diagnostic failed: ${error instanceof Error ? error.message : String(error)}\n`);
+ }
+ }
+ }, startupTimeoutMs);
+ }
+ try {
+ const paths = options.paths ?? daemonPaths();
+ const env = options.env ?? process.env;
+ const cwd = options.cwd ?? inferOpenCodeProjectCwd(env["LSP_TOOLS_MCP_PROJECT_CONFIG"]);
+ const contextEnv = cwd === undefined ? env : canonicalizeContextEnv(env);
+ const contextInput = {
+ env: contextEnv,
+ ...(cwd === undefined ? {} : { cwd }),
+ ...(options.homeDir === undefined ? {} : { homeDir: options.homeDir }),
+ };
+ const context = options.context ?? createStandaloneMcpRequestContext(contextInput);
+ const callOptions = {
+ paths,
+ context,
+ ...(options.ensure ? { ensure: options.ensure } : {}),
+ signal: lifecycleController.signal,
+ };
+ await runJsonRpcStdioServer({
+ input,
+ output,
+ idleTimeoutMs: 0,
+ handler: (request, requestOptions) => {
+ clearStartupWatchdog();
+ return runWithRequestContext(context, () => handleProxyRequest(request, requestOptions));
+ },
+ handlerOptions: callOptions,
+ onHandlerError: (error) => {
+ stderr.write(`[lsp-daemon] proxy error: ${error instanceof Error ? error.message : String(error)}\n`);
+ },
+ });
+ }
+ catch (error) {
+ if (!startupExpired || !isPrematureCloseError(error))
+ throw error;
+ }
+ finally {
+ if (startupTimer !== undefined)
+ clearTimeout(startupTimer);
+ input.removeListener("end", abortFromInput);
+ input.removeListener("close", abortFromInput);
+ }
+}
+function isPrematureCloseError(error) {
+ return error instanceof Error && Reflect.get(error, "code") === "ERR_STREAM_PREMATURE_CLOSE";
}
async function handleProxyRequest(parsed, callOptions) {
const toolCall = asToolCall(parsed);
if (!toolCall)
return handleLspMcpRequest(parsed);
const result = await callToolViaDaemon(toolCall.name, toolCall.args, callOptions);
- return successResponse(toolCall.id, { content: result.content, isError: result.isError ?? false, details: result.details });
+ return successResponse(toolCall.id, {
+ content: result.content,
+ isError: result.isError ?? false,
+ details: result.details,
+ });
}
function asToolCall(parsed) {
if (!isPlainRecord(parsed) || parsed["method"] !== "tools/call")
diff --git a/plugins/omo/components/lsp-tools-mcp/dist/cli.js b/plugins/omo/components/lsp-tools-mcp/dist/cli.js
index 2c59d346..0bb8057d 100755
--- a/plugins/omo/components/lsp-tools-mcp/dist/cli.js
+++ b/plugins/omo/components/lsp-tools-mcp/dist/cli.js
@@ -3021,6 +3021,9 @@ function errorResponse(id, code, message, data) {
function jsonRpcId(value) {
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
}
+function messageFromError(error) {
+ return error instanceof Error ? error.message : String(error);
+}
// ../mcp-stdio-core/src/transport.ts
var HEADER_SEPARATOR2 = Buffer.from(`\r
\r
@@ -3043,16 +3046,45 @@ async function* readStdioJsonRpcMessages(input) {
yield parseJsonPayload(trailing, "line");
}
}
-function writeStdioJsonRpcResponse(output, response, responseMode) {
+async function writeStdioJsonRpcResponse(output, response, responseMode) {
const body = JSON.stringify(response);
- if (responseMode === "framed") {
- output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
+ const payload = responseMode === "framed" ? `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
\r
-${body}`);
- return;
- }
- output.write(`${body}
-`);
+${body}` : `${body}
+`;
+ await writeChunk(output, payload);
+}
+function writeChunk(output, chunk) {
+ return new Promise((resolve6, reject) => {
+ let settled = false;
+ const onError = (error) => {
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ };
+ output.once("error", onError);
+ try {
+ output.write(chunk, (error) => {
+ if (settled)
+ return;
+ settled = true;
+ if (error) {
+ queueMicrotask(() => output.removeListener("error", onError));
+ reject(error);
+ return;
+ }
+ output.removeListener("error", onError);
+ resolve6();
+ });
+ } catch (error) {
+ output.removeListener("error", onError);
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ }
+ });
}
function readNextMessage(buffer) {
if (buffer.length === 0)
@@ -3148,39 +3180,69 @@ async function runJsonRpcStdioServer(config) {
break;
idleTimer.arm();
if (message.kind === "parse_error") {
- handleParseError(message, config, log);
+ if (!await handleParseError(message, config, log))
+ break;
continue;
}
- await handleRequest(message, config, log);
+ if (!await handleRequest(message, config, log))
+ break;
}
} finally {
idleTimer.clear();
log("stdio_stopped");
}
}
-function handleParseError(message, config, log) {
+async function handleParseError(message, config, log) {
log("parse_error", { message: message.message });
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
- if (response !== undefined) {
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- }
+ if (response === undefined)
+ return true;
+ return writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ });
}
async function handleRequest(message, config, log) {
const parsed = message.payload;
const id = isPlainRecord(parsed) ? jsonRpcId(parsed["id"]) : null;
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
log("request", { id: id === null ? null : String(id), method });
+ let response;
try {
- const response = await config.handler(parsed, config.handlerOptions);
- if (response === undefined)
- return;
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ response = await config.handler(parsed, config.handlerOptions);
} catch (error) {
if (config.onHandlerError === undefined)
throw error;
config.onHandlerError(error);
+ return true;
}
+ if (response === undefined)
+ return true;
+ if (!await writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ }))
+ return false;
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ return true;
+}
+async function writeResponse(response, context) {
+ try {
+ await writeStdioJsonRpcResponse(context.output, response, context.responseMode);
+ return true;
+ } catch (error) {
+ if (!isTerminalOutputError(error))
+ throw error;
+ context.log("output_error", { message: messageFromError(error) });
+ return false;
+ }
+}
+function isTerminalOutputError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED" || error.code === "ERR_STREAM_WRITE_AFTER_END";
}
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
let timer = null;
@@ -4243,7 +4305,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
const fileErrors = [];
const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
options.signal?.throwIfAborted();
- const client = await manager2.getClient(root, server2);
+ const client = await manager2.getClient(root, server2, options.signal);
try {
let nextIndex = 0;
const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
diff --git a/plugins/omo/components/lsp-tools-mcp/dist/mcp.js b/plugins/omo/components/lsp-tools-mcp/dist/mcp.js
index 0b9dc2cc..d6791ba7 100644
--- a/plugins/omo/components/lsp-tools-mcp/dist/mcp.js
+++ b/plugins/omo/components/lsp-tools-mcp/dist/mcp.js
@@ -12,6 +12,9 @@ function errorResponse(id, code, message, data) {
function jsonRpcId(value) {
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
}
+function messageFromError(error) {
+ return error instanceof Error ? error.message : String(error);
+}
// ../mcp-stdio-core/src/transport.ts
var HEADER_SEPARATOR = Buffer.from(`\r
\r
@@ -34,16 +37,45 @@ async function* readStdioJsonRpcMessages(input) {
yield parseJsonPayload(trailing, "line");
}
}
-function writeStdioJsonRpcResponse(output, response, responseMode) {
+async function writeStdioJsonRpcResponse(output, response, responseMode) {
const body = JSON.stringify(response);
- if (responseMode === "framed") {
- output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
+ const payload = responseMode === "framed" ? `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
\r
-${body}`);
- return;
- }
- output.write(`${body}
-`);
+${body}` : `${body}
+`;
+ await writeChunk(output, payload);
+}
+function writeChunk(output, chunk) {
+ return new Promise((resolve, reject) => {
+ let settled = false;
+ const onError = (error) => {
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ };
+ output.once("error", onError);
+ try {
+ output.write(chunk, (error) => {
+ if (settled)
+ return;
+ settled = true;
+ if (error) {
+ queueMicrotask(() => output.removeListener("error", onError));
+ reject(error);
+ return;
+ }
+ output.removeListener("error", onError);
+ resolve();
+ });
+ } catch (error) {
+ output.removeListener("error", onError);
+ if (settled)
+ return;
+ settled = true;
+ reject(error);
+ }
+ });
}
function readNextMessage(buffer) {
if (buffer.length === 0)
@@ -139,40 +171,70 @@ async function runJsonRpcStdioServer(config) {
break;
idleTimer.arm();
if (message.kind === "parse_error") {
- handleParseError(message, config, log);
+ if (!await handleParseError(message, config, log))
+ break;
continue;
}
- await handleRequest(message, config, log);
+ if (!await handleRequest(message, config, log))
+ break;
}
} finally {
idleTimer.clear();
log("stdio_stopped");
}
}
-function handleParseError(message, config, log) {
+async function handleParseError(message, config, log) {
log("parse_error", { message: message.message });
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
- if (response !== undefined) {
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- }
+ if (response === undefined)
+ return true;
+ return writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ });
}
async function handleRequest(message, config, log) {
const parsed = message.payload;
const id = isPlainRecord(parsed) ? jsonRpcId(parsed["id"]) : null;
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
log("request", { id: id === null ? null : String(id), method });
+ let response;
try {
- const response = await config.handler(parsed, config.handlerOptions);
- if (response === undefined)
- return;
- writeStdioJsonRpcResponse(config.output, response, message.responseMode);
- log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ response = await config.handler(parsed, config.handlerOptions);
} catch (error) {
if (config.onHandlerError === undefined)
throw error;
config.onHandlerError(error);
+ return true;
+ }
+ if (response === undefined)
+ return true;
+ if (!await writeResponse(response, {
+ output: config.output,
+ responseMode: message.responseMode,
+ log
+ }))
+ return false;
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
+ return true;
+}
+async function writeResponse(response, context) {
+ try {
+ await writeStdioJsonRpcResponse(context.output, response, context.responseMode);
+ return true;
+ } catch (error) {
+ if (!isTerminalOutputError(error))
+ throw error;
+ context.log("output_error", { message: messageFromError(error) });
+ return false;
}
}
+function isTerminalOutputError(error) {
+ if (!(error instanceof Error) || !("code" in error))
+ return false;
+ return error.code === "EPIPE" || error.code === "ERR_STREAM_DESTROYED" || error.code === "ERR_STREAM_WRITE_AFTER_END";
+}
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
let timer = null;
let isClosed = false;
@@ -4242,7 +4304,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
const fileErrors = [];
const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
options.signal?.throwIfAborted();
- const client = await manager.getClient(root, server2);
+ const client = await manager.getClient(root, server2, options.signal);
try {
let nextIndex = 0;
const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
diff --git a/plugins/omo/components/lsp-tools-mcp/dist/tools.js b/plugins/omo/components/lsp-tools-mcp/dist/tools.js
index 7e7d37bf..d29e1e46 100644
--- a/plugins/omo/components/lsp-tools-mcp/dist/tools.js
+++ b/plugins/omo/components/lsp-tools-mcp/dist/tools.js
@@ -4042,7 +4042,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
const fileErrors = [];
const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
options.signal?.throwIfAborted();
- const client = await manager.getClient(root, server);
+ const client = await manager.getClient(root, server, options.signal);
try {
let nextIndex = 0;
const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
diff --git a/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json b/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
index c6511023..8c7d4930 100644
--- a/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
+++ b/plugins/omo/components/lsp/dist/.omo-runtime-manifest.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
- "version": "4.18.1",
- "inputDigest": "sha256:ce104d23ca60e4a61242e99e54232a9fc82078b6471381511abc3187f8489842",
+ "version": "4.18.2",
+ "inputDigest": "sha256:5f242410eb12245b588135e29137ee9e7a0fdb2346469bdfdb75727b2abaf248",
"outputs": [
{
"path": "cli.d.ts",
@@ -9,7 +9,7 @@
},
{
"path": "cli.js",
- "sha256": "84e00d94acd6c757613daaf8dde1e9425861ab6aa16923daaebd207934bc8ca1"
+ "sha256": "e92c3fee5795bf44de9504b0e85c2be208c78a31e966ec9a7a807d621431c74a"
},
{
"path": "codex-hook-cli.d.ts",
diff --git a/plugins/omo/components/lsp/dist/cli.js b/plugins/omo/components/lsp/dist/cli.js
index 02e08abe..5f3426c0 100644
--- a/plugins/omo/components/lsp/dist/cli.js
+++ b/plugins/omo/components/lsp/dist/cli.js
@@ -13,13 +13,13 @@ import { homedir as homedir3 } from "node:os";
import { join as join11, resolve as resolve11 } from "node:path";
// ../../../../lsp-daemon/dist/client.js
-import { connect as connect2 } from "node:net";
+import { connect } from "node:net";
import { AsyncLocalStorage } from "node:async_hooks";
import { existsSync, realpathSync, statSync } from "node:fs";
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve } from "node:path";
import { spawn } from "node:child_process";
import { closeSync as closeSync2, mkdirSync as mkdirSync2, openSync as openSync2 } from "node:fs";
-import { connect } from "node:net";
+import { Socket } from "node:net";
import { dirname as dirname3 } from "node:path";
import { execPath } from "node:process";
import {
@@ -426,42 +426,48 @@ class DaemonUnreachableError extends Error {
async function ensureDaemonRunning(paths, deps = defaultEnsureDaemonDeps(), options = {}) {
const readyTimeoutMs = options.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
- if (await deps.probe(paths))
+ const signal = options.signal;
+ throwIfAborted(signal);
+ if (await awaitWithSignal(deps.probe(paths, signal), signal))
return;
+ throwIfAborted(signal);
deps.spawnDaemon(paths);
- await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs);
+ await waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal);
}
-async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs) {
+async function waitUntilReachable(paths, deps, readyTimeoutMs, pollIntervalMs, signal) {
const deadline = deps.now() + readyTimeoutMs;
for (;; ) {
- if (await deps.probe(paths))
+ throwIfAborted(signal);
+ if (await awaitWithSignal(deps.probe(paths, signal), signal))
return;
if (deps.now() >= deadline)
throw new DaemonUnreachableError(paths.socket);
- await deps.sleep(pollIntervalMs);
+ await awaitWithSignal(deps.sleep(pollIntervalMs, signal), signal);
}
}
-async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS) {
+async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS, signal) {
const token = readAuthToken(paths);
if (!token)
return false;
- return await pingDaemon(paths, token, timeoutMs) !== null;
+ return await pingDaemon(paths, token, timeoutMs, signal) !== null;
}
-function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
+function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
return new Promise((resolve22) => {
- const socket = connect(paths.socket);
+ const socket = new Socket;
let settled = false;
+ let timer;
const finish = (value) => {
if (settled)
return;
settled = true;
+ if (timer !== undefined)
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", onAbort);
socket.destroy();
resolve22(value);
};
- const timer = setTimeout(() => finish(null), timeoutMs);
- timer.unref?.();
+ const onAbort = () => finish(null);
const decoder = createLineDecoder((message) => {
- clearTimeout(timer);
finish(parsePingResponse(message));
});
socket.once("connect", () => {
@@ -469,9 +475,16 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS) {
});
socket.on("data", (chunk) => decoder.push(chunk));
socket.once("error", () => {
- clearTimeout(timer);
finish(null);
});
+ timer = setTimeout(() => finish(null), timeoutMs);
+ timer.unref?.();
+ if (signal?.aborted) {
+ onAbort();
+ return;
+ }
+ signal?.addEventListener("abort", onAbort, { once: true });
+ socket.connect(paths.socket);
});
}
function spawnDaemonProcess(paths) {
@@ -489,14 +502,62 @@ function spawnDaemonProcess(paths) {
}
function defaultEnsureDaemonDeps() {
return {
- probe: (paths) => probeDaemon(paths),
+ probe: (paths, signal) => probeDaemon(paths, PROBE_TIMEOUT_MS, signal),
spawnDaemon: (paths) => spawnDaemonProcess(paths),
- sleep: (ms) => new Promise((resolve22) => {
- setTimeout(resolve22, ms);
- }),
+ sleep: (ms, signal) => sleepWithSignal(ms, signal),
now: () => Date.now()
};
}
+function sleepWithSignal(ms, signal) {
+ return new Promise((resolve22) => {
+ let settled = false;
+ const finish = () => {
+ if (settled)
+ return;
+ settled = true;
+ clearTimeout(timer);
+ signal?.removeEventListener("abort", finish);
+ resolve22();
+ };
+ const timer = setTimeout(finish, ms);
+ if (signal?.aborted) {
+ finish();
+ return;
+ }
+ signal?.addEventListener("abort", finish, { once: true });
+ });
+}
+function awaitWithSignal(promise, signal) {
+ if (!signal)
+ return promise;
+ if (signal.aborted)
+ return Promise.reject(abortError(signal));
+ return new Promise((resolve22, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(abortError(signal)));
+ signal.addEventListener("abort", onAbort, { once: true });
+ promise.then((value) => finish(() => resolve22(value)), (error) => finish(() => reject(error)));
+ });
+}
+function throwIfAborted(signal) {
+ if (signal?.aborted)
+ throw abortError(signal);
+}
+function abortError(signal) {
+ const reason = signal.reason;
+ if (reason instanceof Error)
+ return reason;
+ const error = new Error(typeof reason === "string" ? reason : "daemon startup cancelled");
+ error.name = "AbortError";
+ return error;
+}
function parsePingResponse(message) {
if (!message || typeof message !== "object" || Array.isArray(message))
return null;
@@ -692,7 +753,7 @@ class JsonRpcConnection {
settled = true;
this.pendingRequests.delete(key);
cleanup();
- const rejectCancelled = () => reject(abortError(options.signal));
+ const rejectCancelled = () => reject(abortError2(options.signal));
if (!requestWritten) {
cancelAfterWrite = true;
rejectCancelled();
@@ -896,7 +957,7 @@ ${body}`;
}
}
}
-function abortError(signal) {
+function abortError2(signal) {
const reason = signal?.reason;
if (reason instanceof Error)
return reason;
@@ -3118,11 +3179,11 @@ function waitForDiagnosticsActivity(wait, signal) {
if (!signal)
return wait;
if (signal.aborted)
- return Promise.reject(abortError2(signal));
+ return Promise.reject(abortError3(signal));
return new Promise((resolve72, reject) => {
const onAbort = () => {
signal.removeEventListener("abort", onAbort);
- reject(abortError2(signal));
+ reject(abortError3(signal));
};
signal.addEventListener("abort", onAbort, { once: true });
wait.then(() => {
@@ -3157,7 +3218,7 @@ function preCommitAbortReason(source) {
return reason;
return new Error("LSP request cancelled before workspace edit commit");
}
-function abortError2(signal) {
+function abortError3(signal) {
const reason = signal.reason;
if (reason instanceof Error)
return reason;
@@ -3188,7 +3249,7 @@ async function stopClientBestEffort(client) {
reportBestEffortCleanupError("client stop", error);
}
}
-function awaitWithSignal(promise, signal) {
+function awaitWithSignal2(promise, signal) {
if (!signal)
return promise;
return new Promise((resolve72, reject) => {
@@ -3291,7 +3352,7 @@ class LspManager {
if (managed.initPromise) {
managed.pendingWaiters++;
try {
- await awaitWithSignal(managed.initPromise, signal);
+ await awaitWithSignal2(managed.initPromise, signal);
} catch (err) {
managed.pendingWaiters--;
await this.tryDeleteIfOrphaned(key, managed);
@@ -3329,7 +3390,7 @@ class LspManager {
};
this.clients.set(key, newManaged);
try {
- await awaitWithSignal(initPromise, signal);
+ await awaitWithSignal2(initPromise, signal);
} catch (err) {
newManaged.pendingWaiters--;
if (this.clients.get(key) === newManaged) {
@@ -4280,7 +4341,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
const fileErrors = [];
const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
options.signal?.throwIfAborted();
- const client = await manager.getClient(root, server2);
+ const client = await manager.getClient(root, server2, options.signal);
try {
let nextIndex = 0;
const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
@@ -4960,14 +5021,14 @@ class DaemonRequestCancelledError extends DaemonRequestError {
async function callToolViaDaemon(name, args, options) {
const context = requireContext(options.context);
const paths = options.paths ?? daemonPaths();
- const ensure = options.ensure ?? ensureDaemonRunning;
+ const ensure = options.ensure ?? ((ensurePaths, signal) => ensureDaemonRunning(ensurePaths, undefined, signal === undefined ? {} : { signal }));
const timeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
const requestArgs = withContext(args, context);
let lastError;
let authRefreshUsed = false;
for (let attempt = 0;attempt < 3; attempt += 1) {
try {
- await ensure(paths);
+ await ensureDaemonAvailable(paths, ensure, options.signal);
const token = readAuthToken(paths);
if (!token)
throw new DaemonRequestError("daemon auth token missing", false);
@@ -4998,6 +5059,27 @@ function requireContext(context) {
function withContext(args, context) {
return { ...args, [CONTEXT_KEY]: context };
}
+function ensureDaemonAvailable(paths, ensure, signal) {
+ if (!signal)
+ return ensure(paths);
+ return new Promise((resolve9, reject) => {
+ let settled = false;
+ const finish = (run) => {
+ if (settled)
+ return;
+ settled = true;
+ signal.removeEventListener("abort", onAbort);
+ run();
+ };
+ const onAbort = () => finish(() => reject(new DaemonRequestCancelledError(false)));
+ if (signal.aborted) {
+ onAbort();
+ return;
+ }
+ signal.addEventListener("abort", onAbort, { once: true });
+ Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve9()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
+ });
+}
function daemonUnreachableResult(paths, error) {
const text2 = [
`LSP daemon unreachable: ${errorText(error)}.`,
@@ -5011,7 +5093,7 @@ function daemonUnreachableResult(paths, error) {
}
function sendToolCall(paths, token, name, args, options) {
return new Promise((resolve9, reject) => {
- const socket = connect2(paths.socket);
+ const socket = connect(paths.socket);
const requestId = allocateProxyRequestId();
let settled = false;
let requestWritten = false;
diff --git a/plugins/omo/components/lsp/hooks/hooks.json b/plugins/omo/components/lsp/hooks/hooks.json
index 0abe0dfc..6c559e2e 100644
--- a/plugins/omo/components/lsp/hooks/hooks.json
+++ b/plugins/omo/components/lsp/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 60,
- "statusMessage": "(OmO 4.18.1) Checking LSP Diagnostics"
+ "statusMessage": "(OmO 4.18.2) Checking LSP Diagnostics"
}
]
}
@@ -21,7 +21,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Resetting LSP Diagnostics Cache"
+ "statusMessage": "(OmO 4.18.2) Resetting LSP Diagnostics Cache"
}
]
}
diff --git a/plugins/omo/components/lsp/package.json b/plugins/omo/components/lsp/package.json
index 080cf9c5..799db312 100644
--- a/plugins/omo/components/lsp/package.json
+++ b/plugins/omo/components/lsp/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-lsp",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex plugin that exposes Language Server Protocol tools and post-edit diagnostics.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/lsp/test/package-smoke.test.ts b/plugins/omo/components/lsp/test/package-smoke.test.ts
index c56657e1..22a6f8b0 100644
--- a/plugins/omo/components/lsp/test/package-smoke.test.ts
+++ b/plugins/omo/components/lsp/test/package-smoke.test.ts
@@ -44,6 +44,7 @@ describe("plugin package metadata", () => {
expect(postCompactCommand).toBe(`node "${pluginRoot}/dist/cli.js" hook post-compact`);
expect(lspServer?.command).toBe("node");
expect(lspServer?.args).toEqual(["../../../../lsp-daemon/dist/cli.js", "mcp"]);
+ expect(lspServer?.startup_timeout_sec).toBe(10);
expect(cliSource).not.toContain("./lazy-lsp-mcp.js");
expect(cliSource).toContain("resolveLspDaemonCliPath");
expect(daemonCliPathSource).toContain("@code-yeongyu/lsp-daemon/cli");
diff --git a/plugins/omo/components/rules/bundled-rules/hephaestus/gpt-5.5.md b/plugins/omo/components/rules/bundled-rules/hephaestus/gpt-5.5.md
index 11b7ac0f..204ac6d7 100644
--- a/plugins/omo/components/rules/bundled-rules/hephaestus/gpt-5.5.md
+++ b/plugins/omo/components/rules/bundled-rules/hephaestus/gpt-5.5.md
@@ -74,7 +74,7 @@ Diagnostics catch type errors, not logic bugs; tests cover only what their autho
# Global Review and Debugging Gate
-Run `review-work` plus a `debugging` runtime audit only before a PR handoff or when the user asks for a review; lane pass/fail semantics live in those skills. A passing review lane binds to the exact commit SHA it reviewed: NEVER re-run a lane at a SHA where that same lane already passed this task; every lane that has not passed at the current SHA still runs. For everything else, the gate above is the whole gate: once you have personally observed the artifact working, report your evidence. Redact secrets, tokens, and PII from ledgers, PR bodies, and handoffs.
+Run `review-work` plus a `debugging` runtime audit only before a PR handoff or when the user asks for a review; lane pass/fail semantics live in those skills. Each passing review lane and debugging audit binds to the exact full commit SHA it reviewed. Immediately append a durable task-evidence/ledger record with its name, full SHA, verdict, and report artifact/source. Before reuse after continuation or compaction, re-read the record and require the exact lane/SHA pair; memory or an unstamped report is not coverage. Every missing pair at the current SHA still runs, and new commits require fresh applicable coverage. For everything else, the gate above is the whole gate: once you have personally observed the artifact working, report your evidence. Redact secrets, tokens, and PII from ledgers, PR bodies, and handoffs.
# Failure Recovery
diff --git a/plugins/omo/components/rules/bundled-rules/hephaestus/gpt-5.6.md b/plugins/omo/components/rules/bundled-rules/hephaestus/gpt-5.6.md
index ebda5ce8..6e1ef699 100644
--- a/plugins/omo/components/rules/bundled-rules/hephaestus/gpt-5.6.md
+++ b/plugins/omo/components/rules/bundled-rules/hephaestus/gpt-5.6.md
@@ -19,13 +19,15 @@ Status requests are not stop signals: give the update, keep working. Honor every
# Discovery
-Never speculate about code you have not read: verify with tools and re-read on every hand-off. Start broad once - and WIDE: tool calls run as JavaScript through `exec`, so write programs, not single calls. Batch EVERY independent read, search, and doc lookup into ONE `exec` script via `Promise.all` over the `tools` object before the first edit; filter and reduce results in-script so only what you need returns to context. NEVER await independent calls one at a time - sequence only when one result feeds the next. Retrieve again only when the core question is open, a needed fact is missing, or a second-order question (callers, error paths, ownership) changes the design. Stop when you can act. Prefer the root fix over the symptom fix.
+Never speculate about code you have not read: verify with tools and re-read on every hand-off. **USE CODE MODE AGGRESSIVELY FOR BOUNDED DISCOVERY.** When multiple independent tool calls produce results that can be materially filtered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript program that calls eligible tools concurrently with `Promise.all` and returns only decision-relevant evidence. For shell-native repo work without programmatic tool access, use ONE Python script with `concurrent.futures`, `subprocess`, and utility functions to batch commands and reduce output. **USE LSP FOR SYMBOLS** - definitions, references, rename impact, workspace symbols, and diagnostics - instead of reconstructing semantics with text search. Use direct calls when one result chooses the next action, outputs are already small, semantic judgment is required between calls, approval or side effects are involved, or native artifacts must be preserved. Retrieve again only for a missing required fact or a second-order question that changes the design. Stop when you can act; prefer the root fix over the symptom.
# Operating Loop
Explore -> Plan (`update_plan`, per Task Tracking) -> Implement -> Verify -> Manually QA.
-Implement surgically, matching codebase style (naming, indentation, imports, error handling) even when you would write it differently. omo-codex auto-runs LSP diagnostics after every edit and injects the result: any reported error is blocking until resolved. Verify with targeted tests and builds for changed behavior; if validation cannot run, say why and name the next best check.
+Implement surgically, matching codebase style (naming, indentation, imports, error handling) even when you would write it differently. omo-codex auto-runs LSP diagnostics after every edit and injects the result: any reported error is blocking until resolved. Verify with targeted tests and builds for changed behavior; if validation cannot run, say why and name the next best check. Re-run a validation command only when its inputs changed since its last green run; one full pass right before the final message replaces repeated identical reruns.
+
+Waiting is not free: a status poll replays the whole accumulated context through the model. Run a long command (install, build, suite, container, CI watch) to completion in ONE `exec` call with a timeout sized to the expected wait - or send output to a log file read once on a completion signal - never re-poll the same surface with empty reads or sub-minute waits. If two consecutive checks show no state change, double the wait or switch to a completion signal.
# Subagents
@@ -52,7 +54,7 @@ Diagnostics catch type errors, not logic bugs; tests cover only what their autho
"This should work" from reading source does not pass. A defect found in usage is yours to fix this turn.
-Run `review-work` plus a `debugging` runtime audit only before a PR handoff or when the user asks for a review; lane pass/fail semantics live in those skills. A passing review lane binds to the exact commit SHA it reviewed: NEVER re-run a lane at a SHA where that same lane already passed this task; every lane that has not passed at the current SHA still runs. For everything else, the gate above is the whole gate: once you have personally observed the artifact working, report your evidence. Redact secrets, tokens, and PII from ledgers, PR bodies, and handoffs.
+Run `review-work` plus a `debugging` runtime audit only before a PR handoff or when the user asks for a review; lane pass/fail semantics live in those skills. Each passing review lane and debugging audit binds to the exact full commit SHA it reviewed. Immediately append a durable task-evidence/ledger record with its name, full SHA, verdict, and report artifact/source. Before reuse after continuation or compaction, re-read the record and require the exact lane/SHA pair; memory or an unstamped report is not coverage. Every missing pair at the current SHA still runs, and new commits require fresh applicable coverage. For everything else, the gate above is the whole gate: once you have personally observed the artifact working, report your evidence. Redact secrets, tokens, and PII from ledgers, PR bodies, and handoffs.
# Failure Recovery
diff --git a/plugins/omo/components/rules/hooks/hooks.json b/plugins/omo/components/rules/hooks/hooks.json
index 67d737d2..d7f0b1ea 100644
--- a/plugins/omo/components/rules/hooks/hooks.json
+++ b/plugins/omo/components/rules/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook session-start",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Loading Project Rules"
+ "statusMessage": "(OmO 4.18.2) Loading Project Rules"
}
]
}
@@ -19,7 +19,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Loading Project Rules"
+ "statusMessage": "(OmO 4.18.2) Loading Project Rules"
}
]
}
@@ -32,7 +32,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Matching Project Rules"
+ "statusMessage": "(OmO 4.18.2) Matching Project Rules"
}
]
}
@@ -45,7 +45,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-compact",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Resetting Project Rule Cache"
+ "statusMessage": "(OmO 4.18.2) Resetting Project Rule Cache"
}
]
}
diff --git a/plugins/omo/components/rules/package.json b/plugins/omo/components/rules/package.json
index 8255deba..0c323ee0 100644
--- a/plugins/omo/components/rules/package.json
+++ b/plugins/omo/components/rules/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-rules",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex plugin that injects project rule files into model context through lifecycle hooks.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/start-work-continuation/README.md b/plugins/omo/components/start-work-continuation/README.md
index 12500f3a..c03f7275 100644
--- a/plugins/omo/components/start-work-continuation/README.md
+++ b/plugins/omo/components/start-work-continuation/README.md
@@ -2,13 +2,13 @@
Codex Stop-hook continuation injector for the omo-codex `start-work` skill.
-It reads `.omo/boulder.json` in the hook payload `cwd`, resolves the active work, inspects the active plan for incomplete top-level checkboxes, and emits Codex Stop-hook JSON when the plan still has work:
+It reads `.omo/boulder.json` in the hook payload `cwd`, resolves the active work, inspects the active plan's top-level checklist, and emits Codex Stop-hook JSON while the plan still has unchecked tasks or its final review/debugging gate remains pending:
```json
{"decision":"block","reason":"<directive>"}
```
-The `reason` is loaded from `directive.md` on every invocation and filled with current plan state. The hook returns no output when `stop_hook_active` is `true`, when no active Boulder work exists, when the work is completed, when the active work is not tied to `codex:<session_id>`, or when all top-level plan checkboxes are complete.
+The `reason` is loaded from `directive.md` on every invocation and filled with current plan state. The hook returns no output when `stop_hook_active` is `true`, when no active Boulder work exists, when the work is completed, when the active work is not tied to `codex:<session_id>`, or when the plan has no readable top-level checklist. An active plan whose checklist is fully checked still blocks Stop until the final gate runs and Boulder is marked completed.
This pairs with the `start-work` skill at `plugin/skills/start-work/SKILL.md`. That skill writes `.omo/boulder.json` with Codex session ids prefixed as `codex:` so the hook can continue only its own active Codex session.
diff --git a/plugins/omo/components/start-work-continuation/directive.md b/plugins/omo/components/start-work-continuation/directive.md
index d24b9325..97c9777e 100644
--- a/plugins/omo/components/start-work-continuation/directive.md
+++ b/plugins/omo/components/start-work-continuation/directive.md
@@ -16,7 +16,7 @@ You are mid-flight on a Prometheus work plan; this turn is an automatic continua
# What to do this turn
1. Read `{{PLAN_PATH}}` AND `{{LEDGER_PATH}}` first — they are the only sources of truth for what remains and what evidence exists; do not trust your memory of prior turns.
-2. Pick the FIRST unchecked top-level checkbox in `## TODOs` or `## Final Verification Wave`. Ignore nested checkboxes under Acceptance Criteria / Evidence / Definition of Done.
+2. When the remaining count is `0`, skip checkbox execution and perform the Final gate now. Otherwise, pick the FIRST unchecked top-level checkbox in `## TODOs` or `## Final Verification Wave`. Ignore nested checkboxes under Acceptance Criteria / Evidence / Definition of Done.
3. Follow the `start-work` skill in full. The skill is already loaded from your earlier turn — re-read its file at `packages/omo-codex/plugin/skills/start-work/SKILL.md` if you have lost context.
4. Apply the checkbox's tier from its ledger entry, or classify it now per the start-work skill: LIGHT (default — a narrow change inside existing layers) needs one real-surface proof of the deliverable, with auxiliary surfaces first-class for CLI- or data-shaped work, and only trigger-mapped adversarial classes; HEAVY (new module/abstraction, auth/security, external integration, schema/migration, concurrency, cross-domain refactor, care signals) takes the full per-criterion regime. When unsure, take HEAVY; never downgrade.
5. Decompose the checkbox into atomic sub-tasks. Dispatch them in PARALLEL via `multi_agent_v1.spawn_agent` calls in this same response unless a sub-task has a NAMED blocking dependency (input from another sub-task or shared file). Use `fork_context: false` unless full history is truly required. Put role and specialty instructions inside `message`. Flat `spawn_agent` requiring `task_name` instead (`multi_agent_v2`)? Add `"task_name"`, use `fork_turns: "none"`, `wait_agent` takes only `timeout_ms`, finished agents end on their own.
@@ -40,7 +40,7 @@ You are mid-flight on a Prometheus work plan; this turn is an automatic continua
# Final gate
-Before completion, run `review-work` and a `debugging` runtime audit; inconclusive lanes fail. The gate's pass binds to the commit SHA it reviewed — never re-run it on an already-passed SHA; re-run only when new commits land. Do not create a PR, PR handoff, branch handoff, merge, or final completion answer until this gate passes. For PR/branch work, stay in the task-owned worktree: create/update the PR, wait for CI/review/Cubic gates, merge by default unless explicitly opted out, then clean up. Redact secrets, tokens, credentials, auth headers, cookies, env dumps, logs, and PII.
+Before completion, satisfy all five `review-work` lanes and a `debugging` runtime audit; inconclusive lanes or an inconclusive audit fail. Each pass binds to the exact full commit SHA it reviewed. Immediately append a durable task-evidence record to `{{LEDGER_PATH}}` for every passing lane and the debugging audit with its name, full SHA, verdict, and report artifact/source. Before same-SHA reuse after any continuation or compaction, re-read the ledger record and verify the exact lane/SHA pair; memory, chat history, or an unstamped report is not coverage. New commits require fresh applicable coverage. Do not create a PR, PR handoff, branch handoff, merge, or final completion answer until this gate passes. For PR/branch work, stay in the task-owned worktree: create/update the PR, wait for CI/review/Cubic gates, merge by default unless explicitly opted out, then clean up. After the gate and lifecycle pass, mark the Boulder work completed before the final answer. Redact secrets, tokens, credentials, auth headers, cookies, env dumps, logs, and PII.
# Stop conditions for THIS turn
@@ -54,6 +54,6 @@ Before completion, run `review-work` and a `debugging` runtime audit; inconclusi
- Surface only state changes: sub-agent dispatched, scenario PASS/FAIL with artifact path, checkbox marked, evidence appended.
- Do NOT print "Should I continue?", restate the plan, or recap prior turns — the Stop hook continues you; the ledger and plan are the durable record.
-Begin now. Pick the next checkbox, dispatch the parallel sub-agents, verify, mark, continue.
+Begin now. If no checkbox remains, run the Final gate; otherwise pick the next checkbox, dispatch the parallel sub-agents, verify, mark, continue.
</start-work-continuation>
diff --git a/plugins/omo/components/start-work-continuation/hooks/hooks.json b/plugins/omo/components/start-work-continuation/hooks/hooks.json
index 3fa77314..b8604e83 100644
--- a/plugins/omo/components/start-work-continuation/hooks/hooks.json
+++ b/plugins/omo/components/start-work-continuation/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/start-work-continuation/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Start-Work Continuation"
+ "statusMessage": "(OmO 4.18.2) Checking Start-Work Continuation"
}
]
}
@@ -19,7 +19,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/start-work-continuation/dist/cli.js\" hook subagent-stop",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Start-Work Continuation"
+ "statusMessage": "(OmO 4.18.2) Checking Start-Work Continuation"
}
]
}
diff --git a/plugins/omo/components/start-work-continuation/package.json b/plugins/omo/components/start-work-continuation/package.json
index ffa9ab6a..ce6369b5 100644
--- a/plugins/omo/components/start-work-continuation/package.json
+++ b/plugins/omo/components/start-work-continuation/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-start-work-continuation",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex Stop hook continuation injector for omo-codex start-work plans.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/start-work-continuation/src/boulder-reader.ts b/plugins/omo/components/start-work-continuation/src/boulder-reader.ts
index e6edfa71..9e2e5ec8 100644
--- a/plugins/omo/components/start-work-continuation/src/boulder-reader.ts
+++ b/plugins/omo/components/start-work-continuation/src/boulder-reader.ts
@@ -50,7 +50,7 @@ export function readContinuationState(cwd: string, sessionId: string): Continuat
const planPath = resolveBoulderPlanPathForWork(cwd, work);
const checklist = getPlanChecklist(planPath);
- if (checklist.remaining === 0) return null;
+ if (checklist.total === 0) return null;
return {
planName: work.planName,
diff --git a/plugins/omo/components/start-work-continuation/src/codex-hook.ts b/plugins/omo/components/start-work-continuation/src/codex-hook.ts
index 00c06f76..f7940477 100644
--- a/plugins/omo/components/start-work-continuation/src/codex-hook.ts
+++ b/plugins/omo/components/start-work-continuation/src/codex-hook.ts
@@ -27,7 +27,7 @@ function renderDirective(state: ContinuationState, sessionId: string): string {
BOULDER_PATH: state.boulderPath,
REMAINING_COUNT: String(state.checklist.remaining),
TOTAL_COUNT: String(state.checklist.total),
- NEXT_TASK_LABEL: state.checklist.nextTaskLabel ?? "",
+ NEXT_TASK_LABEL: state.checklist.nextTaskLabel ?? "none (final gate pending)",
WORKTREE_BLOCK: worktreeBlock,
LEDGER_PATH: state.ledgerPath,
SESSION_ID: sessionId,
diff --git a/plugins/omo/components/start-work-continuation/test/boulder-reader.test.ts b/plugins/omo/components/start-work-continuation/test/boulder-reader.test.ts
index e62031ed..5d34f4c1 100644
--- a/plugins/omo/components/start-work-continuation/test/boulder-reader.test.ts
+++ b/plugins/omo/components/start-work-continuation/test/boulder-reader.test.ts
@@ -123,7 +123,7 @@ describe("start-work boulder state reader", () => {
expect(state?.checklist).toEqual({ completed: 0, remaining: 1, total: 1, nextTaskLabel: "First" });
});
- it("#given no remaining top-level checklist items #when state is read #then continuation is absent", () => {
+ it("#given active codex work with no remaining checklist items #when state is read #then final gate continuation remains present", () => {
// given
const workspace = createWorkspace({
boulderJson: createBoulderJson({ status: "active", sessionIds: ["codex:sess_abc"] }),
@@ -133,6 +133,20 @@ describe("start-work boulder state reader", () => {
// when
const state = readContinuationState(workspace, "sess_abc");
+ // then
+ expect(state?.checklist).toEqual({ completed: 1, remaining: 0, total: 1, nextTaskLabel: null });
+ });
+
+ it("#given active codex work with no readable checklist #when state is read #then continuation remains absent", () => {
+ // given
+ const workspace = createWorkspace({
+ boulderJson: createBoulderJson({ status: "active", sessionIds: ["codex:sess_abc"] }),
+ planMarkdown: "# Plan\n\nNo checklist yet.\n",
+ });
+
+ // when
+ const state = readContinuationState(workspace, "sess_abc");
+
// then
expect(state).toBeNull();
});
diff --git a/plugins/omo/components/start-work-continuation/test/codex-hook.test.ts b/plugins/omo/components/start-work-continuation/test/codex-hook.test.ts
index c9456307..36633140 100644
--- a/plugins/omo/components/start-work-continuation/test/codex-hook.test.ts
+++ b/plugins/omo/components/start-work-continuation/test/codex-hook.test.ts
@@ -69,6 +69,26 @@ describe("start-work Stop hook", () => {
expect(parsed.reason).toContain("- Your session id in boulder.json: `codex:sess_abc`");
});
+ it("#given active codex work with zero remaining tasks #when hook runs #then blocks for the final gate", () => {
+ // given
+ const workspace = createWorkspace({
+ boulderJson: createBoulderJson({ sessionIds: ["codex:sess_abc"], status: "active" }),
+ planMarkdown: ["# Plan", "", "## TODOs", "- [x] Done"].join("\n"),
+ });
+ const fs = createMemoryFs();
+
+ // when
+ const output = runStopHook(createStopInput(workspace), fs);
+
+ // then
+ const parsed = parseBlockOutput(output);
+ expect(parsed.decision).toBe("block");
+ expect(parsed.reason).toContain("- Remaining top-level checkboxes: `0` of `1`");
+ expect(parsed.reason).toContain("- Next incomplete task: `none (final gate pending)`");
+ expect(parsed.reason).toContain("When the remaining count is `0`, skip checkbox execution");
+ expect(parsed.reason).toContain("re-read the ledger record and verify the exact lane/SHA pair");
+ });
+
it("#given context-window pressure in transcript #when hook runs #then it does not inject continuation text", () => {
// given
const transcriptPath = "/repo/transcript.jsonl";
diff --git a/plugins/omo/components/teammode/hooks/hooks.json b/plugins/omo/components/teammode/hooks/hooks.json
index 2ccbdafa..58d38c74 100644
--- a/plugins/omo/components/teammode/hooks/hooks.json
+++ b/plugins/omo/components/teammode/hooks/hooks.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Thread Title Hygiene"
+ "statusMessage": "(OmO 4.18.2) Checking Thread Title Hygiene"
}
]
}
diff --git a/plugins/omo/components/teammode/package.json b/plugins/omo/components/teammode/package.json
index 9f904923..90f90b25 100644
--- a/plugins/omo/components/teammode/package.json
+++ b/plugins/omo/components/teammode/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/codex-teammode",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex team-mode hook component that keeps background thread titles descriptive after create_thread.",
"type": "module",
"private": true,
diff --git a/plugins/omo/components/telemetry/hooks/hooks.json b/plugins/omo/components/telemetry/hooks/hooks.json
index 5c4bedbb..47eb318f 100644
--- a/plugins/omo/components/telemetry/hooks/hooks.json
+++ b/plugins/omo/components/telemetry/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook session-start",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Recording Session Telemetry"
+ "statusMessage": "(OmO 4.18.2) Recording Session Telemetry"
}
]
}
diff --git a/plugins/omo/components/telemetry/package.json b/plugins/omo/components/telemetry/package.json
index d961a029..0a26fb13 100644
--- a/plugins/omo/components/telemetry/package.json
+++ b/plugins/omo/components/telemetry/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-telemetry",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex plugin component that emits omo-codex anonymous daily-active telemetry on SessionStart.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ultrawork/directive.md b/plugins/omo/components/ultrawork/directive.md
index 260bbaf2..33c7bbb0 100644
--- a/plugins/omo/components/ultrawork/directive.md
+++ b/plugins/omo/components/ultrawork/directive.md
@@ -105,9 +105,7 @@ notepad with a one-line reason each. Skipping a skill that fits the
task is a defect. Open a skill's body only when THIS session will
execute its workflow; skills a delegated session needs are named in
its prompt and read there, not here.
-Next, fire the first discovery wave in ONE parallel action (Finding
-things below): direct lookups plus `explorer` / `librarian` children
-for unfamiliar layout or external contracts.
+Next, fire the first discovery wave under Finding things below.
Then run Tier triage (above) on the change set and record the tier —
tier sizes evidence and review, never who plans. Size planning by
what the wave left UNDECIDED, not by how many steps you can list:
@@ -207,25 +205,27 @@ GOOD pair (test-first, ordered):
BAD: "Implement feature" / "Fix bug" / "Add tests later" / writing
production code before its failing test → rewrite.
-# Finding things (lead with these, parallel-flood the first wave)
+# Finding things (lead with these, code-mode the first wave)
Never guess from memory — locate with the right tool, and re-read before
-you claim or change. Fire 3+ independent lookups in one action;
-serialize only when one output strictly feeds the next.
-- CodeGraph, when `codegraph_*` tools exist -> use `codegraph_explore`
- first for how/where/what/flow questions and before edits; if absent,
- inactive/uninitialized, or cold-start unavailable, keep moving with
- Read/Grep/Glob/LSP and the ast-grep skill.
-- Repo-wide inspection, CLI smoke tests, git/history, bounded command
- output → use native shell commands directly: `rg`, `rg --files`,
- `cat`, and `git`. Narrow huge output before reading it.
-- Symbols — definitions, references, rename impact, diagnostics →
- `lsp_goto_definition`, `lsp_find_references`, `lsp_symbols`,
- `lsp_diagnostics`. Use the LSP, not text search, for anything
- symbol-shaped.
-- Structural shapes — call/function/class/import patterns, codemods →
- the `ast-grep` skill or `sg` CLI with `$VAR` / `$$$` metavars.
-- Text / strings / comments / logs → `rg`. File-name discovery →
- `glob` / `find`. Verbatim content → `read`.
+you claim or change. **USE CODE MODE AGGRESSIVELY FOR BOUNDED WAVES.**
+When multiple independent tool calls produce results that can be materially
+filtered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript
+program that calls eligible tools concurrently with `Promise.all` and emits only
+decision-relevant evidence. For shell-native repo work without programmatic
+tool access, use ONE Python script with `concurrent.futures`, `subprocess`,
+and utility functions to batch commands and reduce output. Keep direct calls
+when one result chooses the next action, outputs are already small, semantic
+judgment is required between calls, approval or side effects are involved,
+or native artifacts / citations must be preserved.
+- Architecture / flow / blast radius → `codegraph_explore` first when
+ `codegraph_*` exists; if unavailable, continue with repo tools and LSP.
+- **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,
+ workspace symbols, and diagnostics use the available `lsp_*` tools, not
+ text search. Run diagnostics after edits and treat errors as blocking.
+- Repo text / filenames / history / bounded shell output → `rg`,
+ `rg --files`, `git`, and native utilities; narrow output in-program.
+- Structural call / function / class / import shapes and codemods → the
+ `ast-grep` skill or `sg` with `$VAR` / `$$$` metavariables.
When discovery needs multiple angles or the module layout is
unfamiliar, delegate to the `explorer` subagent (read-only codebase
search, absolute-path results). For research that leaves the repo —
@@ -289,21 +289,39 @@ Until every success criterion PASSES with its evidence captured:
vars. Append a one-line cleanup receipt to the notepad next to the
artifact, e.g. `cleanup: killed 12345; tmux kill-session ulw-qa-foo;
rm -rf /tmp/ulw.aB12cD`. No receipt → criterion stays in_progress.
-6. Verify: LSP diagnostics clean on changed files + full test suite
- green (no skipped, no xfail added this turn).
+6. Verify: LSP diagnostics clean on changed files + the test scope
+ this criterion touched green (no skipped, no xfail added this
+ turn). Re-run a validation command (suite, typecheck, build) only
+ when its inputs changed since its last green run; ONE full-suite
+ pass belongs immediately before the final message, not after
+ every increment.
7. Mark completed. Append non-obvious findings / learnings.
-8. After each increment, re-run every criterion's scenario. Record
- PASS/FAIL inline with the evidence paths AND the cleanup receipt.
- Loop until all PASS.
-
-Parallel-batch independent reads / searches / subagents within a step,
-but NEVER parallelise RED and GREEN of the same criterion.
+8. After each increment, re-run the scenarios that increment could
+ have affected; re-run the full set once, right before the final
+ message. Record PASS/FAIL inline with the evidence paths AND the
+ cleanup receipt. Loop until all PASS.
+
+Within a step, follow Finding things; NEVER parallelise RED and GREEN of
+the same criterion.
+
+# Waiting discipline (a poll costs a full model round)
+Every status check you issue as a tool call replays the entire
+accumulated context through the model. When a command will run long
+(installs, builds, test suites, containers, CI), run it to completion
+in ONE call with a timeout sized to the expected duration, or send
+output to a log file and read it once when a completion signal is
+expected. Never re-poll the same surface with empty reads or
+sub-minute waits — batch waiting into the fewest, longest blocking
+calls the harness allows, and do independent root work while the
+command runs. If two consecutive checks show no state change, double
+the wait before the next check or switch to a completion signal.
# Codex subagent reliability
Every `multi_agent_v1.spawn_agent` message is self-contained and starts with
-`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`, and
-`VERIFY`. State that it is an executable assignment, not a context
-handoff. Use `fork_context: false` unless full history is truly
+`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`,
+`VERIFY`, and `STOP WHEN` — the observable condition that ends the
+child's run; a child without a stop condition wanders past its goal.
+State that it is an executable assignment, not a context handoff. Use `fork_context: false` unless full history is truly
required; paste only the context the child needs. Full-history forks can
make the child continue old parent context instead of the delegated task.
If your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.
@@ -413,7 +431,6 @@ message + present for approval.
- Never suppress lints / errors / test failures. Never delete, skip,
`.only`, `.skip`, `xfail`, or comment out tests to green the suite.
- Never claim done from inference — only from captured evidence.
-- Parallel tool calls for any independent work.
# Output discipline
- First line literally: `ULTRAWORK MODE ENABLED!`
diff --git a/plugins/omo/components/ultrawork/hooks/hooks.json b/plugins/omo/components/ultrawork/hooks/hooks.json
index a6b8e3f2..469da420 100644
--- a/plugins/omo/components/ultrawork/hooks/hooks.json
+++ b/plugins/omo/components/ultrawork/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Checking Ultrawork Trigger"
+ "statusMessage": "(OmO 4.18.2) Checking Ultrawork Trigger"
}
]
}
diff --git a/plugins/omo/components/ultrawork/package.json b/plugins/omo/components/ultrawork/package.json
index 9c683ca0..535d22cd 100644
--- a/plugins/omo/components/ultrawork/package.json
+++ b/plugins/omo/components/ultrawork/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-ultrawork",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex plugin that injects the ultrawork orchestration directive and ships LazyCodex planning, review, QA, and gate agent roles.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ultrawork/skills/ultrawork/SKILL.md b/plugins/omo/components/ultrawork/skills/ultrawork/SKILL.md
index 6cab3364..32a8853a 100644
--- a/plugins/omo/components/ultrawork/skills/ultrawork/SKILL.md
+++ b/plugins/omo/components/ultrawork/skills/ultrawork/SKILL.md
@@ -112,9 +112,7 @@ notepad with a one-line reason each. Skipping a skill that fits the
task is a defect. Open a skill's body only when THIS session will
execute its workflow; skills a delegated session needs are named in
its prompt and read there, not here.
-Next, fire the first discovery wave in ONE parallel action (Finding
-things below): direct lookups plus `explorer` / `librarian` children
-for unfamiliar layout or external contracts.
+Next, fire the first discovery wave under Finding things below.
Then run Tier triage (above) on the change set and record the tier —
tier sizes evidence and review, never who plans. Size planning by
what the wave left UNDECIDED, not by how many steps you can list:
@@ -214,25 +212,27 @@ GOOD pair (test-first, ordered):
BAD: "Implement feature" / "Fix bug" / "Add tests later" / writing
production code before its failing test → rewrite.
-# Finding things (lead with these, parallel-flood the first wave)
+# Finding things (lead with these, code-mode the first wave)
Never guess from memory — locate with the right tool, and re-read before
-you claim or change. Fire 3+ independent lookups in one action;
-serialize only when one output strictly feeds the next.
-- CodeGraph, when `codegraph_*` tools exist -> use `codegraph_explore`
- first for how/where/what/flow questions and before edits; if absent,
- inactive/uninitialized, or cold-start unavailable, keep moving with
- Read/Grep/Glob/LSP and the ast-grep skill.
-- Repo-wide inspection, CLI smoke tests, git/history, bounded command
- output → use native shell commands directly: `rg`, `rg --files`,
- `cat`, and `git`. Narrow huge output before reading it.
-- Symbols — definitions, references, rename impact, diagnostics →
- `lsp_goto_definition`, `lsp_find_references`, `lsp_symbols`,
- `lsp_diagnostics`. Use the LSP, not text search, for anything
- symbol-shaped.
-- Structural shapes — call/function/class/import patterns, codemods →
- the `ast-grep` skill or `sg` CLI with `$VAR` / `$$$` metavars.
-- Text / strings / comments / logs → `rg`. File-name discovery →
- `glob` / `find`. Verbatim content → `read`.
+you claim or change. **USE CODE MODE AGGRESSIVELY FOR BOUNDED WAVES.**
+When multiple independent tool calls produce results that can be materially
+filtered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript
+program that calls eligible tools concurrently with `Promise.all` and emits only
+decision-relevant evidence. For shell-native repo work without programmatic
+tool access, use ONE Python script with `concurrent.futures`, `subprocess`,
+and utility functions to batch commands and reduce output. Keep direct calls
+when one result chooses the next action, outputs are already small, semantic
+judgment is required between calls, approval or side effects are involved,
+or native artifacts / citations must be preserved.
+- Architecture / flow / blast radius → `codegraph_explore` first when
+ `codegraph_*` exists; if unavailable, continue with repo tools and LSP.
+- **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,
+ workspace symbols, and diagnostics use the available `lsp_*` tools, not
+ text search. Run diagnostics after edits and treat errors as blocking.
+- Repo text / filenames / history / bounded shell output → `rg`,
+ `rg --files`, `git`, and native utilities; narrow output in-program.
+- Structural call / function / class / import shapes and codemods → the
+ `ast-grep` skill or `sg` with `$VAR` / `$$$` metavariables.
When discovery needs multiple angles or the module layout is
unfamiliar, delegate to the `explorer` subagent (read-only codebase
search, absolute-path results). For research that leaves the repo —
@@ -296,21 +296,39 @@ Until every success criterion PASSES with its evidence captured:
vars. Append a one-line cleanup receipt to the notepad next to the
artifact, e.g. `cleanup: killed 12345; tmux kill-session ulw-qa-foo;
rm -rf /tmp/ulw.aB12cD`. No receipt → criterion stays in_progress.
-6. Verify: LSP diagnostics clean on changed files + full test suite
- green (no skipped, no xfail added this turn).
+6. Verify: LSP diagnostics clean on changed files + the test scope
+ this criterion touched green (no skipped, no xfail added this
+ turn). Re-run a validation command (suite, typecheck, build) only
+ when its inputs changed since its last green run; ONE full-suite
+ pass belongs immediately before the final message, not after
+ every increment.
7. Mark completed. Append non-obvious findings / learnings.
-8. After each increment, re-run every criterion's scenario. Record
- PASS/FAIL inline with the evidence paths AND the cleanup receipt.
- Loop until all PASS.
-
-Parallel-batch independent reads / searches / subagents within a step,
-but NEVER parallelise RED and GREEN of the same criterion.
+8. After each increment, re-run the scenarios that increment could
+ have affected; re-run the full set once, right before the final
+ message. Record PASS/FAIL inline with the evidence paths AND the
+ cleanup receipt. Loop until all PASS.
+
+Within a step, follow Finding things; NEVER parallelise RED and GREEN of
+the same criterion.
+
+# Waiting discipline (a poll costs a full model round)
+Every status check you issue as a tool call replays the entire
+accumulated context through the model. When a command will run long
+(installs, builds, test suites, containers, CI), run it to completion
+in ONE call with a timeout sized to the expected duration, or send
+output to a log file and read it once when a completion signal is
+expected. Never re-poll the same surface with empty reads or
+sub-minute waits — batch waiting into the fewest, longest blocking
+calls the harness allows, and do independent root work while the
+command runs. If two consecutive checks show no state change, double
+the wait before the next check or switch to a completion signal.
# Codex subagent reliability
Every `multi_agent_v1.spawn_agent` message is self-contained and starts with
-`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`, and
-`VERIFY`. State that it is an executable assignment, not a context
-handoff. Use `fork_context: false` unless full history is truly
+`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`,
+`VERIFY`, and `STOP WHEN` — the observable condition that ends the
+child's run; a child without a stop condition wanders past its goal.
+State that it is an executable assignment, not a context handoff. Use `fork_context: false` unless full history is truly
required; paste only the context the child needs. Full-history forks can
make the child continue old parent context instead of the delegated task.
If your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.
@@ -420,7 +438,6 @@ message + present for approval.
- Never suppress lints / errors / test failures. Never delete, skip,
`.only`, `.skip`, `xfail`, or comment out tests to green the suite.
- Never claim done from inference — only from captured evidence.
-- Parallel tool calls for any independent work.
# Output discipline
- First line literally: `ULTRAWORK MODE ENABLED!`
diff --git a/plugins/omo/components/ulw-loop/directive.md b/plugins/omo/components/ulw-loop/directive.md
index 260bbaf2..33c7bbb0 100644
--- a/plugins/omo/components/ulw-loop/directive.md
+++ b/plugins/omo/components/ulw-loop/directive.md
@@ -105,9 +105,7 @@ notepad with a one-line reason each. Skipping a skill that fits the
task is a defect. Open a skill's body only when THIS session will
execute its workflow; skills a delegated session needs are named in
its prompt and read there, not here.
-Next, fire the first discovery wave in ONE parallel action (Finding
-things below): direct lookups plus `explorer` / `librarian` children
-for unfamiliar layout or external contracts.
+Next, fire the first discovery wave under Finding things below.
Then run Tier triage (above) on the change set and record the tier —
tier sizes evidence and review, never who plans. Size planning by
what the wave left UNDECIDED, not by how many steps you can list:
@@ -207,25 +205,27 @@ GOOD pair (test-first, ordered):
BAD: "Implement feature" / "Fix bug" / "Add tests later" / writing
production code before its failing test → rewrite.
-# Finding things (lead with these, parallel-flood the first wave)
+# Finding things (lead with these, code-mode the first wave)
Never guess from memory — locate with the right tool, and re-read before
-you claim or change. Fire 3+ independent lookups in one action;
-serialize only when one output strictly feeds the next.
-- CodeGraph, when `codegraph_*` tools exist -> use `codegraph_explore`
- first for how/where/what/flow questions and before edits; if absent,
- inactive/uninitialized, or cold-start unavailable, keep moving with
- Read/Grep/Glob/LSP and the ast-grep skill.
-- Repo-wide inspection, CLI smoke tests, git/history, bounded command
- output → use native shell commands directly: `rg`, `rg --files`,
- `cat`, and `git`. Narrow huge output before reading it.
-- Symbols — definitions, references, rename impact, diagnostics →
- `lsp_goto_definition`, `lsp_find_references`, `lsp_symbols`,
- `lsp_diagnostics`. Use the LSP, not text search, for anything
- symbol-shaped.
-- Structural shapes — call/function/class/import patterns, codemods →
- the `ast-grep` skill or `sg` CLI with `$VAR` / `$$$` metavars.
-- Text / strings / comments / logs → `rg`. File-name discovery →
- `glob` / `find`. Verbatim content → `read`.
+you claim or change. **USE CODE MODE AGGRESSIVELY FOR BOUNDED WAVES.**
+When multiple independent tool calls produce results that can be materially
+filtered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript
+program that calls eligible tools concurrently with `Promise.all` and emits only
+decision-relevant evidence. For shell-native repo work without programmatic
+tool access, use ONE Python script with `concurrent.futures`, `subprocess`,
+and utility functions to batch commands and reduce output. Keep direct calls
+when one result chooses the next action, outputs are already small, semantic
+judgment is required between calls, approval or side effects are involved,
+or native artifacts / citations must be preserved.
+- Architecture / flow / blast radius → `codegraph_explore` first when
+ `codegraph_*` exists; if unavailable, continue with repo tools and LSP.
+- **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,
+ workspace symbols, and diagnostics use the available `lsp_*` tools, not
+ text search. Run diagnostics after edits and treat errors as blocking.
+- Repo text / filenames / history / bounded shell output → `rg`,
+ `rg --files`, `git`, and native utilities; narrow output in-program.
+- Structural call / function / class / import shapes and codemods → the
+ `ast-grep` skill or `sg` with `$VAR` / `$$$` metavariables.
When discovery needs multiple angles or the module layout is
unfamiliar, delegate to the `explorer` subagent (read-only codebase
search, absolute-path results). For research that leaves the repo —
@@ -289,21 +289,39 @@ Until every success criterion PASSES with its evidence captured:
vars. Append a one-line cleanup receipt to the notepad next to the
artifact, e.g. `cleanup: killed 12345; tmux kill-session ulw-qa-foo;
rm -rf /tmp/ulw.aB12cD`. No receipt → criterion stays in_progress.
-6. Verify: LSP diagnostics clean on changed files + full test suite
- green (no skipped, no xfail added this turn).
+6. Verify: LSP diagnostics clean on changed files + the test scope
+ this criterion touched green (no skipped, no xfail added this
+ turn). Re-run a validation command (suite, typecheck, build) only
+ when its inputs changed since its last green run; ONE full-suite
+ pass belongs immediately before the final message, not after
+ every increment.
7. Mark completed. Append non-obvious findings / learnings.
-8. After each increment, re-run every criterion's scenario. Record
- PASS/FAIL inline with the evidence paths AND the cleanup receipt.
- Loop until all PASS.
-
-Parallel-batch independent reads / searches / subagents within a step,
-but NEVER parallelise RED and GREEN of the same criterion.
+8. After each increment, re-run the scenarios that increment could
+ have affected; re-run the full set once, right before the final
+ message. Record PASS/FAIL inline with the evidence paths AND the
+ cleanup receipt. Loop until all PASS.
+
+Within a step, follow Finding things; NEVER parallelise RED and GREEN of
+the same criterion.
+
+# Waiting discipline (a poll costs a full model round)
+Every status check you issue as a tool call replays the entire
+accumulated context through the model. When a command will run long
+(installs, builds, test suites, containers, CI), run it to completion
+in ONE call with a timeout sized to the expected duration, or send
+output to a log file and read it once when a completion signal is
+expected. Never re-poll the same surface with empty reads or
+sub-minute waits — batch waiting into the fewest, longest blocking
+calls the harness allows, and do independent root work while the
+command runs. If two consecutive checks show no state change, double
+the wait before the next check or switch to a completion signal.
# Codex subagent reliability
Every `multi_agent_v1.spawn_agent` message is self-contained and starts with
-`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`, and
-`VERIFY`. State that it is an executable assignment, not a context
-handoff. Use `fork_context: false` unless full history is truly
+`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`,
+`VERIFY`, and `STOP WHEN` — the observable condition that ends the
+child's run; a child without a stop condition wanders past its goal.
+State that it is an executable assignment, not a context handoff. Use `fork_context: false` unless full history is truly
required; paste only the context the child needs. Full-history forks can
make the child continue old parent context instead of the delegated task.
If your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.
@@ -413,7 +431,6 @@ message + present for approval.
- Never suppress lints / errors / test failures. Never delete, skip,
`.only`, `.skip`, `xfail`, or comment out tests to green the suite.
- Never claim done from inference — only from captured evidence.
-- Parallel tool calls for any independent work.
# Output discipline
- First line literally: `ULTRAWORK MODE ENABLED!`
diff --git a/plugins/omo/components/ulw-loop/hooks/hooks.json b/plugins/omo/components/ulw-loop/hooks/hooks.json
index 1ba2155e..3136ba44 100644
--- a/plugins/omo/components/ulw-loop/hooks/hooks.json
+++ b/plugins/omo/components/ulw-loop/hooks/hooks.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook user-prompt-submit --with-ultrawork",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Ulw-Loop Steering"
+ "statusMessage": "(OmO 4.18.2) Checking Ulw-Loop Steering"
}
]
}
@@ -20,7 +20,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Enforcing Unlimited Ulw-Loop Budget"
+ "statusMessage": "(OmO 4.18.2) Enforcing Unlimited Ulw-Loop Budget"
}
]
},
@@ -31,7 +31,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook pre-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Guarding Ulw-Loop Spawns"
+ "statusMessage": "(OmO 4.18.2) Guarding Ulw-Loop Spawns"
}
]
}
@@ -43,7 +43,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Ulw-Loop Resume"
+ "statusMessage": "(OmO 4.18.2) Checking Ulw-Loop Resume"
}
]
}
diff --git a/plugins/omo/components/ulw-loop/package.json b/plugins/omo/components/ulw-loop/package.json
index 3753cd01..d48c5374 100644
--- a/plugins/omo/components/ulw-loop/package.json
+++ b/plugins/omo/components/ulw-loop/package.json
@@ -1,6 +1,6 @@
{
"name": "@code-yeongyu/codex-ulw-loop",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Codex plugin: durable repo-native multi-goal orchestration with embedded success criteria and observable evidence audit.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/components/ulw-loop/skills/ulw-loop/references/full-workflow.md b/plugins/omo/components/ulw-loop/skills/ulw-loop/references/full-workflow.md
index 1ba6a194..dd331b0b 100644
--- a/plugins/omo/components/ulw-loop/skills/ulw-loop/references/full-workflow.md
+++ b/plugins/omo/components/ulw-loop/skills/ulw-loop/references/full-workflow.md
@@ -187,7 +187,7 @@ Trigger only for the final aggregate goal after every criterion in every goal is
2. FREEZE first — no more edits or rebases. At the frozen HEAD, re-run Manual-QA for any PASS criterion whose stamped tree differs from `git rev-parse --short "HEAD^{tree}"`, so every criterion is proven on the frozen tree; each artifact exists and is non-empty.
3a. Spawn lazycodex-code-reviewer and lazycodex-qa-executor in parallel (`fork_context: false` on v1; `fork_turns: "none"` on v2) with brief, goals, desired outcome, diff, evidence; wait for BOTH and confirm their report artifacts exist on disk.
3b. Only then spawn lazycodex-gate-reviewer with those artifact paths.
-3c. The gate's approval binds to the frozen tree and covers its three lanes — code quality, hands-on QA, and goal verification. A later rebase or amend that keeps the tree identical keeps the approval; changed content needs fresh review of the delta.
+3c. The gate's approval binds to the frozen tree and full commit SHA and covers its three lanes — code quality, hands-on QA, and goal verification. Immediately append one durable `.omo/ulw-loop/ledger.jsonl` record per passing lane with the lane name, full SHA, verdict, and report artifact/source. Before reuse after continuation or compaction, re-read the ledger and require the exact lane/SHA pair; memory or an unstamped report is not coverage. A later rebase or amend that keeps the tree identical still has a new SHA and needs fresh lane stamps; changed content needs fresh review of the delta.
4. Treat timeout, missing deliverable, ack-only, `BLOCKED:`, or inconclusive review as a blocker. Any fix restarts the freeze at the new HEAD: re-run ONLY the proofs it invalidated and stamp the fresh output — never regenerate all evidence or relabel stale output to HEAD — re-review the delta at most TWICE; then record-review-blockers (step 5) and surface to the user.
5. If review remains blocked, run `omo ulw-loop record-review-blockers --goal-id <id> --title "<...>" --objective "<...>" --evidence "<review findings>" --codex-goal-json <snapshot> --json`.
6. If clean, checkpoint final completion:
diff --git a/plugins/omo/components/ulw-loop/src/stop-resume-hook.ts b/plugins/omo/components/ulw-loop/src/stop-resume-hook.ts
index 1ffaf4c3..289a1450 100644
--- a/plugins/omo/components/ulw-loop/src/stop-resume-hook.ts
+++ b/plugins/omo/components/ulw-loop/src/stop-resume-hook.ts
@@ -142,7 +142,7 @@ function boulderContinuationWillFire(cwd: string, sessionId: string): boolean {
const entry = work as Record<string, unknown>;
const sessionIds = Array.isArray(entry["session_ids"]) ? entry["session_ids"] : [];
const continuable = entry["status"] === "active" || entry["status"] === "paused";
- return continuable && sessionIds.includes(`codex:${sessionId}`) && boulderPlanHasRemainingTask(cwd, entry);
+ return continuable && sessionIds.includes(`codex:${sessionId}`) && boulderPlanHasChecklist(cwd, entry);
});
} catch (error) {
if (error instanceof Error) return false;
@@ -160,10 +160,9 @@ function transcriptShowsContextPressure(transcriptPath: string): boolean {
}
}
-// start-work-continuation only fires while its plan checklist has remaining
-// items; a boulder work whose plan is exhausted (or unreadable) leaves the
-// Stop event to this hook.
-function boulderPlanHasRemainingTask(cwd: string, entry: Record<string, unknown>): boolean {
+// start-work-continuation owns an active Boulder plan until its final gate marks
+// the work complete, including the zero-remaining checklist state.
+function boulderPlanHasChecklist(cwd: string, entry: Record<string, unknown>): boolean {
const activePlan = entry["active_plan"];
if (typeof activePlan !== "string" || activePlan.trim().length === 0) return false;
const planPath = isAbsolute(activePlan) ? activePlan : join(cwd, activePlan);
@@ -176,7 +175,7 @@ function boulderPlanHasRemainingTask(cwd: string, entry: Record<string, unknown>
try {
return readFileSync(candidate, "utf8")
.split(/\r?\n/)
- .some((line) => line.startsWith("- [ ] "));
+ .some((line) => line.startsWith("- [ ] ") || line.startsWith("- [x] ") || line.startsWith("- [X] "));
} catch (error) {
if (!(error instanceof Error)) throw error;
}
diff --git a/plugins/omo/components/ulw-loop/test/stop-resume-hook.test.ts b/plugins/omo/components/ulw-loop/test/stop-resume-hook.test.ts
index e9b090fb..e870c4fe 100644
--- a/plugins/omo/components/ulw-loop/test/stop-resume-hook.test.ts
+++ b/plugins/omo/components/ulw-loop/test/stop-resume-hook.test.ts
@@ -110,7 +110,7 @@ describe("runStopResumeHook", () => {
expect(runStopResumeHook(stopPayload())).toBe("");
});
- it("#given an active boulder work whose plan is exhausted #when the hook runs #then resumes instead of deferring", () => {
+ it("#given an active boulder work whose plan is exhausted #when the hook runs #then defers to the final gate continuation", () => {
writeGoals([pendingGoal()]);
const plan = writeBoulderPlan(false);
writeFileSync(
@@ -118,7 +118,7 @@ describe("runStopResumeHook", () => {
JSON.stringify({ works: { w1: { session_ids: ["codex:s1"], status: "active", active_plan: plan } } }),
);
- expect(JSON.parse(runStopResumeHook(stopPayload())).decision).toBe("block");
+ expect(runStopResumeHook(stopPayload())).toBe("");
});
it("#given a flat legacy boulder work with remaining plan tasks #when the hook runs #then still defers", () => {
diff --git a/plugins/omo/dist/cli-node/index.js b/plugins/omo/dist/cli-node/index.js
index 2fca9678..b3970ced 100755
--- a/plugins/omo/dist/cli-node/index.js
+++ b/plugins/omo/dist/cli-node/index.js
@@ -2146,7 +2146,7 @@ var package_default;
var init_package = __esm(() => {
package_default = {
name: "oh-my-opencode",
- version: "4.18.1",
+ version: "4.18.2",
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
main: "./dist/index.js",
types: "dist/index.d.ts",
@@ -2358,18 +2358,18 @@ var init_package = __esm(() => {
typescript: "^6.0.3"
},
optionalDependencies: {
- "oh-my-opencode-darwin-arm64": "4.18.1",
- "oh-my-opencode-darwin-x64": "4.18.1",
- "oh-my-opencode-darwin-x64-baseline": "4.18.1",
- "oh-my-opencode-linux-arm64": "4.18.1",
- "oh-my-opencode-linux-arm64-musl": "4.18.1",
- "oh-my-opencode-linux-x64": "4.18.1",
- "oh-my-opencode-linux-x64-baseline": "4.18.1",
- "oh-my-opencode-linux-x64-musl": "4.18.1",
- "oh-my-opencode-linux-x64-musl-baseline": "4.18.1",
- "oh-my-opencode-windows-arm64": "4.18.1",
- "oh-my-opencode-windows-x64": "4.18.1",
- "oh-my-opencode-windows-x64-baseline": "4.18.1"
+ "oh-my-opencode-darwin-arm64": "4.18.2",
+ "oh-my-opencode-darwin-x64": "4.18.2",
+ "oh-my-opencode-darwin-x64-baseline": "4.18.2",
+ "oh-my-opencode-linux-arm64": "4.18.2",
+ "oh-my-opencode-linux-arm64-musl": "4.18.2",
+ "oh-my-opencode-linux-x64": "4.18.2",
+ "oh-my-opencode-linux-x64-baseline": "4.18.2",
+ "oh-my-opencode-linux-x64-musl": "4.18.2",
+ "oh-my-opencode-linux-x64-musl-baseline": "4.18.2",
+ "oh-my-opencode-windows-arm64": "4.18.2",
+ "oh-my-opencode-windows-x64": "4.18.2",
+ "oh-my-opencode-windows-x64-baseline": "4.18.2"
},
overrides: {
"@earendil-works/pi-agent-core": "0.80.3",
@@ -9223,7 +9223,7 @@ var init_agent_model_requirements = __esm(() => {
hephaestus: {
fallbackChain: [
{
- providers: ["openai", "vercel"],
+ providers: ["openai", "github-copilot", "vercel"],
model: "gpt-5.6-sol",
variant: "high"
},
@@ -9334,6 +9334,11 @@ var init_agent_model_requirements = __esm(() => {
model: "gpt-5.6-sol",
variant: "xhigh"
},
+ {
+ providers: ["github-copilot"],
+ model: "gpt-5.6-sol",
+ variant: "high"
+ },
{
providers: ["openai", "github-copilot", "opencode", "vercel"],
model: "gpt-5.5",
@@ -9412,6 +9417,11 @@ var init_category_model_requirements = __esm(() => {
model: "gpt-5.6-sol",
variant: "xhigh"
},
+ {
+ providers: ["github-copilot"],
+ model: "gpt-5.6-sol",
+ variant: "high"
+ },
{
providers: ["openai", "opencode", "vercel"],
model: "gpt-5.5",
@@ -9438,7 +9448,12 @@ var init_category_model_requirements = __esm(() => {
variant: "xhigh"
},
{
- providers: ["openai", "vercel"],
+ providers: ["github-copilot"],
+ model: "gpt-5.6-terra",
+ variant: "high"
+ },
+ {
+ providers: ["openai", "github-copilot", "vercel"],
model: "gpt-5.6-sol",
variant: "high"
},
@@ -9505,6 +9520,11 @@ var init_category_model_requirements = __esm(() => {
model: "gpt-5.6-luna",
variant: "xhigh"
},
+ {
+ providers: ["github-copilot"],
+ model: "gpt-5.6-luna",
+ variant: "high"
+ },
{
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
model: "claude-sonnet-4-6"
@@ -9594,9 +9614,12 @@ function stripProviderPrefixForAliasLookup(normalizedModelID) {
}
return normalizedModelID.slice(slashIndex + 1);
}
-function resolveModelIDAlias(modelID) {
+function resolveModelIDAlias(modelID, providerID) {
const requestedModelID = normalizeLookupModelID(modelID);
const aliasLookupModelID = stripProviderPrefixForAliasLookup(requestedModelID);
+ const normalizedProviderID = providerID ? normalizeLookupModelID(providerID) : undefined;
+ const providerPrefixEnd = requestedModelID.indexOf("/");
+ const embeddedProviderID = providerPrefixEnd > 0 ? requestedModelID.slice(0, providerPrefixEnd) : undefined;
const exactRule = EXACT_ALIAS_RULES_BY_MODEL.get(aliasLookupModelID);
if (exactRule) {
return {
@@ -9607,6 +9630,13 @@ function resolveModelIDAlias(modelID) {
};
}
for (const rule of PATTERN_ALIAS_RULES) {
+ if (rule.providerIDs) {
+ const matchesProviderID = normalizedProviderID !== undefined && rule.providerIDs.includes(normalizedProviderID);
+ const matchesEmbeddedProviderID = normalizedProviderID !== undefined && rule.allowedSubproviderHosts?.includes(normalizedProviderID) === true && embeddedProviderID !== undefined && rule.providerIDs.includes(embeddedProviderID);
+ if (!matchesProviderID && !matchesEmbeddedProviderID) {
+ continue;
+ }
+ }
if (!rule.match(aliasLookupModelID)) {
continue;
}
@@ -9647,6 +9677,14 @@ var init_model_capability_aliases = __esm(() => {
];
EXACT_ALIAS_RULES_BY_MODEL = new Map(EXACT_ALIAS_RULES.map((rule) => [rule.aliasModelID, rule]));
PATTERN_ALIAS_RULES = [
+ {
+ ruleID: "openai-gpt-5.6-fast-service-tier-alias",
+ description: "Normalizes OpenCode's OpenAI GPT-5.6 fast service-tier IDs to canonical snapshot IDs.",
+ providerIDs: ["openai"],
+ allowedSubproviderHosts: ["vercel"],
+ match: (normalizedModelID) => /^gpt-5\.6-(?:sol|terra|luna)-fast$/.test(normalizedModelID),
+ canonicalize: (normalizedModelID) => normalizedModelID.slice(0, -"-fast".length)
+ },
{
ruleID: "claude-thinking-legacy-alias",
description: "Normalizes the legacy claude-opus-4-7-thinking id to the canonical snapshot ID.",
@@ -10314,7 +10352,7 @@ function getProviderOverride(providerID, modelID) {
return GITHUB_COPILOT_GPT5_MODEL.test(normalizeLookupModelID2(modelID)) ? GITHUB_COPILOT_GPT5_OVERRIDE : undefined;
}
function getModelCapabilities(input) {
- const canonicalization = resolveModelIDAlias(input.modelID);
+ const canonicalization = resolveModelIDAlias(input.modelID, input.providerID);
const override = getOverride(input.modelID);
const providerOverride = getProviderOverride(input.providerID, canonicalization.canonicalModelID);
const runtimeModel = readRuntimeModel(input.runtimeModel ?? input.providerCache?.findProviderModelMetadata(input.providerID, input.modelID));
@@ -11419,6 +11457,7 @@ var init_opencode_storage_detection = __esm(() => {
var opencodePluginsCache;
var init_load_opencode_plugins = __esm(() => {
init_jsonc_parser2();
+ init_opencode_config_dir();
opencodePluginsCache = new Map;
});
@@ -72658,7 +72697,7 @@ var package_default2;
var init_package2 = __esm(() => {
package_default2 = {
name: "@oh-my-opencode/omo-codex",
- version: "4.18.1",
+ version: "4.18.2",
type: "module",
private: true,
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
diff --git a/plugins/omo/dist/cli/index.js b/plugins/omo/dist/cli/index.js
index 77906fdf..9b18bcfc 100755
--- a/plugins/omo/dist/cli/index.js
+++ b/plugins/omo/dist/cli/index.js
@@ -2145,7 +2145,7 @@ var package_default;
var init_package = __esm(() => {
package_default = {
name: "oh-my-opencode",
- version: "4.18.1",
+ version: "4.18.2",
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
main: "./dist/index.js",
types: "dist/index.d.ts",
@@ -2357,18 +2357,18 @@ var init_package = __esm(() => {
typescript: "^6.0.3"
},
optionalDependencies: {
- "oh-my-opencode-darwin-arm64": "4.18.1",
- "oh-my-opencode-darwin-x64": "4.18.1",
- "oh-my-opencode-darwin-x64-baseline": "4.18.1",
- "oh-my-opencode-linux-arm64": "4.18.1",
- "oh-my-opencode-linux-arm64-musl": "4.18.1",
- "oh-my-opencode-linux-x64": "4.18.1",
- "oh-my-opencode-linux-x64-baseline": "4.18.1",
- "oh-my-opencode-linux-x64-musl": "4.18.1",
- "oh-my-opencode-linux-x64-musl-baseline": "4.18.1",
- "oh-my-opencode-windows-arm64": "4.18.1",
- "oh-my-opencode-windows-x64": "4.18.1",
- "oh-my-opencode-windows-x64-baseline": "4.18.1"
+ "oh-my-opencode-darwin-arm64": "4.18.2",
+ "oh-my-opencode-darwin-x64": "4.18.2",
+ "oh-my-opencode-darwin-x64-baseline": "4.18.2",
+ "oh-my-opencode-linux-arm64": "4.18.2",
+ "oh-my-opencode-linux-arm64-musl": "4.18.2",
+ "oh-my-opencode-linux-x64": "4.18.2",
+ "oh-my-opencode-linux-x64-baseline": "4.18.2",
+ "oh-my-opencode-linux-x64-musl": "4.18.2",
+ "oh-my-opencode-linux-x64-musl-baseline": "4.18.2",
+ "oh-my-opencode-windows-arm64": "4.18.2",
+ "oh-my-opencode-windows-x64": "4.18.2",
+ "oh-my-opencode-windows-x64-baseline": "4.18.2"
},
overrides: {
"@earendil-works/pi-agent-core": "0.80.3",
@@ -9222,7 +9222,7 @@ var init_agent_model_requirements = __esm(() => {
hephaestus: {
fallbackChain: [
{
- providers: ["openai", "vercel"],
+ providers: ["openai", "github-copilot", "vercel"],
model: "gpt-5.6-sol",
variant: "high"
},
@@ -9333,6 +9333,11 @@ var init_agent_model_requirements = __esm(() => {
model: "gpt-5.6-sol",
variant: "xhigh"
},
+ {
+ providers: ["github-copilot"],
+ model: "gpt-5.6-sol",
+ variant: "high"
+ },
{
providers: ["openai", "github-copilot", "opencode", "vercel"],
model: "gpt-5.5",
@@ -9411,6 +9416,11 @@ var init_category_model_requirements = __esm(() => {
model: "gpt-5.6-sol",
variant: "xhigh"
},
+ {
+ providers: ["github-copilot"],
+ model: "gpt-5.6-sol",
+ variant: "high"
+ },
{
providers: ["openai", "opencode", "vercel"],
model: "gpt-5.5",
@@ -9437,7 +9447,12 @@ var init_category_model_requirements = __esm(() => {
variant: "xhigh"
},
{
- providers: ["openai", "vercel"],
+ providers: ["github-copilot"],
+ model: "gpt-5.6-terra",
+ variant: "high"
+ },
+ {
+ providers: ["openai", "github-copilot", "vercel"],
model: "gpt-5.6-sol",
variant: "high"
},
@@ -9504,6 +9519,11 @@ var init_category_model_requirements = __esm(() => {
model: "gpt-5.6-luna",
variant: "xhigh"
},
+ {
+ providers: ["github-copilot"],
+ model: "gpt-5.6-luna",
+ variant: "high"
+ },
{
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
model: "claude-sonnet-4-6"
@@ -9593,9 +9613,12 @@ function stripProviderPrefixForAliasLookup(normalizedModelID) {
}
return normalizedModelID.slice(slashIndex + 1);
}
-function resolveModelIDAlias(modelID) {
+function resolveModelIDAlias(modelID, providerID) {
const requestedModelID = normalizeLookupModelID(modelID);
const aliasLookupModelID = stripProviderPrefixForAliasLookup(requestedModelID);
+ const normalizedProviderID = providerID ? normalizeLookupModelID(providerID) : undefined;
+ const providerPrefixEnd = requestedModelID.indexOf("/");
+ const embeddedProviderID = providerPrefixEnd > 0 ? requestedModelID.slice(0, providerPrefixEnd) : undefined;
const exactRule = EXACT_ALIAS_RULES_BY_MODEL.get(aliasLookupModelID);
if (exactRule) {
return {
@@ -9606,6 +9629,13 @@ function resolveModelIDAlias(modelID) {
};
}
for (const rule of PATTERN_ALIAS_RULES) {
+ if (rule.providerIDs) {
+ const matchesProviderID = normalizedProviderID !== undefined && rule.providerIDs.includes(normalizedProviderID);
+ const matchesEmbeddedProviderID = normalizedProviderID !== undefined && rule.allowedSubproviderHosts?.includes(normalizedProviderID) === true && embeddedProviderID !== undefined && rule.providerIDs.includes(embeddedProviderID);
+ if (!matchesProviderID && !matchesEmbeddedProviderID) {
+ continue;
+ }
+ }
if (!rule.match(aliasLookupModelID)) {
continue;
}
@@ -9646,6 +9676,14 @@ var init_model_capability_aliases = __esm(() => {
];
EXACT_ALIAS_RULES_BY_MODEL = new Map(EXACT_ALIAS_RULES.map((rule) => [rule.aliasModelID, rule]));
PATTERN_ALIAS_RULES = [
+ {
+ ruleID: "openai-gpt-5.6-fast-service-tier-alias",
+ description: "Normalizes OpenCode's OpenAI GPT-5.6 fast service-tier IDs to canonical snapshot IDs.",
+ providerIDs: ["openai"],
+ allowedSubproviderHosts: ["vercel"],
+ match: (normalizedModelID) => /^gpt-5\.6-(?:sol|terra|luna)-fast$/.test(normalizedModelID),
+ canonicalize: (normalizedModelID) => normalizedModelID.slice(0, -"-fast".length)
+ },
{
ruleID: "claude-thinking-legacy-alias",
description: "Normalizes the legacy claude-opus-4-7-thinking id to the canonical snapshot ID.",
@@ -10313,7 +10351,7 @@ function getProviderOverride(providerID, modelID) {
return GITHUB_COPILOT_GPT5_MODEL.test(normalizeLookupModelID2(modelID)) ? GITHUB_COPILOT_GPT5_OVERRIDE : undefined;
}
function getModelCapabilities(input) {
- const canonicalization = resolveModelIDAlias(input.modelID);
+ const canonicalization = resolveModelIDAlias(input.modelID, input.providerID);
const override = getOverride(input.modelID);
const providerOverride = getProviderOverride(input.providerID, canonicalization.canonicalModelID);
const runtimeModel = readRuntimeModel(input.runtimeModel ?? input.providerCache?.findProviderModelMetadata(input.providerID, input.modelID));
@@ -11418,6 +11456,7 @@ var init_opencode_storage_detection = __esm(() => {
var opencodePluginsCache;
var init_load_opencode_plugins = __esm(() => {
init_jsonc_parser2();
+ init_opencode_config_dir();
opencodePluginsCache = new Map;
});
@@ -72602,7 +72641,7 @@ var package_default2;
var init_package2 = __esm(() => {
package_default2 = {
name: "@oh-my-opencode/omo-codex",
- version: "4.18.1",
+ version: "4.18.2",
type: "module",
private: true,
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
diff --git a/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json b/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
index 8ccc9fc9..9f73defd 100644
--- a/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
+++ b/plugins/omo/hooks/post-compact-resetting-git-bash-mcp-reminder.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/git-bash/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Resetting Git Bash MCP Reminder",
+ "statusMessage": "(OmO 4.18.2) Resetting Git Bash MCP Reminder",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\git-bash\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json b/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
index 93c60f7b..10a11f7b 100644
--- a/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
+++ b/plugins/omo/hooks/post-compact-resetting-lsp-diagnostics-cache.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lsp/dist/cli.js\" hook post-compact",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Resetting LSP Diagnostics Cache",
+ "statusMessage": "(OmO 4.18.2) Resetting LSP Diagnostics Cache",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lsp\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json b/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
index 7873de9b..a35e977b 100644
--- a/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
+++ b/plugins/omo/hooks/post-compact-resetting-project-rule-cache.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook post-compact",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Resetting Project Rule Cache",
+ "statusMessage": "(OmO 4.18.2) Resetting Project Rule Cache",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook post-compact"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-codegraph-init-guidance.json b/plugins/omo/hooks/post-tool-use-checking-codegraph-init-guidance.json
index 7dc31e8a..3f18badc 100644
--- a/plugins/omo/hooks/post-tool-use-checking-codegraph-init-guidance.json
+++ b/plugins/omo/hooks/post-tool-use-checking-codegraph-init-guidance.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/codegraph/dist/cli.js\" hook post-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Checking CodeGraph Init Guidance",
+ "statusMessage": "(OmO 4.18.2) Checking CodeGraph Init Guidance",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\codegraph\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-comments.json b/plugins/omo/hooks/post-tool-use-checking-comments.json
index 92c06b84..22d31d12 100644
--- a/plugins/omo/hooks/post-tool-use-checking-comments.json
+++ b/plugins/omo/hooks/post-tool-use-checking-comments.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/comment-checker/dist/cli.js\" hook post-tool-use",
"timeout": 30,
- "statusMessage": "(OmO 4.18.1) Checking Comments",
+ "statusMessage": "(OmO 4.18.2) Checking Comments",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\comment-checker\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json b/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
index c2336d4b..fcb64023 100644
--- a/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
+++ b/plugins/omo/hooks/post-tool-use-checking-lsp-diagnostics.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lsp/dist/cli.js\" hook post-tool-use",
"timeout": 60,
- "statusMessage": "(OmO 4.18.1) Checking LSP Diagnostics",
+ "statusMessage": "(OmO 4.18.2) Checking LSP Diagnostics",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lsp\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json b/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
index 385331e7..d2d4533d 100644
--- a/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
+++ b/plugins/omo/hooks/post-tool-use-checking-thread-title-hygiene.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/teammode/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Thread Title Hygiene",
+ "statusMessage": "(OmO 4.18.2) Checking Thread Title Hygiene",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\teammode\\dist\\cli.js\" hook post-tool-use"
}
]
diff --git a/plugins/omo/hooks/post-tool-use-matching-project-rules.json b/plugins/omo/hooks/post-tool-use-matching-project-rules.json
index 1d9fec2d..d5177e44 100644
--- a/plugins/omo/hooks/post-tool-use-matching-project-rules.json
+++ b/plugins/omo/hooks/post-tool-use-matching-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook post-tool-use",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Matching Project Rules",
+ "statusMessage": "(OmO 4.18.2) Matching Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook post-tool-use"
}
],
diff --git a/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json b/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
index 6dccce0d..797399cb 100644
--- a/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
+++ b/plugins/omo/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Enforcing Unlimited Goal Budget",
+ "statusMessage": "(OmO 4.18.2) Enforcing Unlimited Goal Budget",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook pre-tool-use"
}
],
diff --git a/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json b/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
index 290ff8d6..e48c0ed4 100644
--- a/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
+++ b/plugins/omo/hooks/pre-tool-use-guarding-ulw-loop-spawns.json
@@ -8,7 +8,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook pre-tool-use-spawn",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Guarding Ulw-Loop Spawns",
+ "statusMessage": "(OmO 4.18.2) Guarding Ulw-Loop Spawns",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook pre-tool-use-spawn"
}
]
diff --git a/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json b/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
index f93adad1..86048f10 100644
--- a/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
+++ b/plugins/omo/hooks/pre-tool-use-recommending-git-bash-mcp.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/git-bash/dist/cli.js\" hook pre-tool-use",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Recommending Git Bash MCP",
+ "statusMessage": "(OmO 4.18.2) Recommending Git Bash MCP",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\git-bash\\dist\\cli.js\" hook pre-tool-use"
}
],
diff --git a/plugins/omo/hooks/session-start-checking-auto-update.json b/plugins/omo/hooks/session-start-checking-auto-update.json
index 8d56d79c..6f53b506 100644
--- a/plugins/omo/hooks/session-start-checking-auto-update.json
+++ b/plugins/omo/hooks/session-start-checking-auto-update.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/scripts/auto-update.mjs\" hook session-start",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Checking Auto Update",
+ "statusMessage": "(OmO 4.18.2) Checking Auto Update",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\scripts\\auto-update.mjs\" hook session-start"
}
],
diff --git a/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json b/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
index 9e975dd5..df104f0b 100644
--- a/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
+++ b/plugins/omo/hooks/session-start-checking-bootstrap-provisioning.json
@@ -8,7 +8,7 @@
"command": "node \"${PLUGIN_ROOT}/components/bootstrap/dist/cli.js\" hook session-start",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\bootstrap.ps1\"",
"timeout": 30,
- "statusMessage": "(OmO 4.18.1) Checking Bootstrap Provisioning"
+ "statusMessage": "(OmO 4.18.2) Checking Bootstrap Provisioning"
}
]
}
diff --git a/plugins/omo/hooks/session-start-checking-codegraph-bootstrap.json b/plugins/omo/hooks/session-start-checking-codegraph-bootstrap.json
index 5d38aba8..ad29b278 100644
--- a/plugins/omo/hooks/session-start-checking-codegraph-bootstrap.json
+++ b/plugins/omo/hooks/session-start-checking-codegraph-bootstrap.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/codegraph/dist/cli.js\" hook session-start",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Checking CodeGraph Bootstrap",
+ "statusMessage": "(OmO 4.18.2) Checking CodeGraph Bootstrap",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\codegraph\\dist\\cli.js\" hook session-start"
}
]
diff --git a/plugins/omo/hooks/session-start-loading-project-rules.json b/plugins/omo/hooks/session-start-loading-project-rules.json
index 3f8d79e9..010c55a0 100644
--- a/plugins/omo/hooks/session-start-loading-project-rules.json
+++ b/plugins/omo/hooks/session-start-loading-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook session-start",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Loading Project Rules",
+ "statusMessage": "(OmO 4.18.2) Loading Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook session-start"
}
]
diff --git a/plugins/omo/hooks/session-start-recording-session-telemetry.json b/plugins/omo/hooks/session-start-recording-session-telemetry.json
index 26ee921b..5cc6ddb7 100644
--- a/plugins/omo/hooks/session-start-recording-session-telemetry.json
+++ b/plugins/omo/hooks/session-start-recording-session-telemetry.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/telemetry/dist/cli.js\" hook session-start",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Recording Session Telemetry",
+ "statusMessage": "(OmO 4.18.2) Recording Session Telemetry",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\telemetry\\dist\\cli.js\" hook session-start"
}
]
diff --git a/plugins/omo/hooks/stop-checking-start-work-continuation.json b/plugins/omo/hooks/stop-checking-start-work-continuation.json
index dc7573b0..2c57deaf 100644
--- a/plugins/omo/hooks/stop-checking-start-work-continuation.json
+++ b/plugins/omo/hooks/stop-checking-start-work-continuation.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/start-work-continuation/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Start-Work Continuation",
+ "statusMessage": "(OmO 4.18.2) Checking Start-Work Continuation",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\start-work-continuation\\dist\\cli.js\" hook stop"
}
]
diff --git a/plugins/omo/hooks/stop-checking-ulw-loop-resume.json b/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
index 9345ae6f..90144a22 100644
--- a/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
+++ b/plugins/omo/hooks/stop-checking-ulw-loop-resume.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook stop",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Ulw-Loop Resume",
+ "statusMessage": "(OmO 4.18.2) Checking Ulw-Loop Resume",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook stop"
}
]
diff --git a/plugins/omo/hooks/subagent-stop-checking-start-work-continuation.json b/plugins/omo/hooks/subagent-stop-checking-start-work-continuation.json
index ddb37f79..0922c53a 100644
--- a/plugins/omo/hooks/subagent-stop-checking-start-work-continuation.json
+++ b/plugins/omo/hooks/subagent-stop-checking-start-work-continuation.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/start-work-continuation/dist/cli.js\" hook subagent-stop",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Start-Work Continuation",
+ "statusMessage": "(OmO 4.18.2) Checking Start-Work Continuation",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\start-work-continuation\\dist\\cli.js\" hook subagent-stop"
}
]
diff --git a/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json b/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
index 3eff92d7..5693a06e 100644
--- a/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
+++ b/plugins/omo/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/lazycodex-executor-verify/dist/cli.js\" hook subagent-stop",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Verifying LazyCodex Executor Evidence",
+ "statusMessage": "(OmO 4.18.2) Verifying LazyCodex Executor Evidence",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\lazycodex-executor-verify\\dist\\cli.js\" hook subagent-stop"
}
],
diff --git a/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json b/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
index d33e02ce..9711f1ae 100644
--- a/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
+++ b/plugins/omo/hooks/user-prompt-submit-checking-ultrawork-trigger.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ultrawork/dist/cli.js\" hook user-prompt-submit",
"timeout": 5,
- "statusMessage": "(OmO 4.18.1) Checking Ultrawork Trigger",
+ "statusMessage": "(OmO 4.18.2) Checking Ultrawork Trigger",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ultrawork\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json b/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
index 63a5cdb1..111665e9 100644
--- a/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
+++ b/plugins/omo/hooks/user-prompt-submit-checking-ulw-loop-steering.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/ulw-loop/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Checking Ulw-Loop Steering",
+ "statusMessage": "(OmO 4.18.2) Checking Ulw-Loop Steering",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\ulw-loop\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json b/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
index 40cd142d..2a1e3af1 100644
--- a/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
+++ b/plugins/omo/hooks/user-prompt-submit-loading-project-rules.json
@@ -7,7 +7,7 @@
"type": "command",
"command": "node \"${PLUGIN_ROOT}/components/rules/dist/cli.js\" hook user-prompt-submit",
"timeout": 10,
- "statusMessage": "(OmO 4.18.1) Loading Project Rules",
+ "statusMessage": "(OmO 4.18.2) Loading Project Rules",
"commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -File \"${PLUGIN_ROOT}\\components\\bootstrap\\scripts\\node-dispatch.ps1\" \"${PLUGIN_ROOT}\\components\\rules\\dist\\cli.js\" hook user-prompt-submit"
}
]
diff --git a/plugins/omo/package-lock.json b/plugins/omo/package-lock.json
index 318cb149..a6c39c61 100644
--- a/plugins/omo/package-lock.json
+++ b/plugins/omo/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "4.18.1",
+ "version": "4.18.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "4.18.1",
+ "version": "4.18.2",
"workspaces": [
"components/codegraph",
"components/comment-checker",
@@ -100,7 +100,7 @@
},
"components/codegraph": {
"name": "@sisyphuslabs/codex-codegraph",
- "version": "4.18.1",
+ "version": "4.18.2",
"bin": {
"omo-codegraph": "dist/cli.js"
},
@@ -119,7 +119,7 @@
},
"components/comment-checker": {
"name": "@code-yeongyu/codex-comment-checker",
- "version": "4.18.1",
+ "version": "4.18.2",
"license": "MIT",
"bin": {
"omo-comment-checker": "dist/cli.js"
@@ -140,7 +140,7 @@
},
"components/git-bash": {
"name": "@sisyphuslabs/codex-git-bash-hook",
- "version": "4.18.1",
+ "version": "4.18.2",
"bin": {
"omo-git-bash-hook": "dist/cli.js"
},
@@ -155,7 +155,7 @@
},
"components/lazycodex-executor-verify": {
"name": "@code-yeongyu/codex-lazycodex-executor-verify",
- "version": "4.18.1",
+ "version": "4.18.2",
"license": "MIT",
"bin": {
"lazycodex-executor-verify": "dist/cli.js"
@@ -172,7 +172,7 @@
},
"components/lsp": {
"name": "@code-yeongyu/codex-lsp",
- "version": "4.18.1",
+ "version": "4.18.2",
"license": "MIT",
"dependencies": {
"@code-yeongyu/lsp-daemon": "file:../../../../lsp-daemon",
@@ -193,7 +193,7 @@
},
"components/rules": {
"name": "@code-yeongyu/codex-rules",
- "version": "4.18.1",
+ "version": "4.18.2",
"license": "MIT",
"dependencies": {
"picomatch": "^4.0.3"
@@ -215,7 +215,7 @@
},
"components/start-work-continuation": {
"name": "@code-yeongyu/codex-start-work-continuation",
- "version": "4.18.1",
+ "version": "4.18.2",
"license": "MIT",
"bin": {
"omo-start-work-continuation": "dist/cli.js"
@@ -232,7 +232,7 @@
},
"components/teammode": {
"name": "@sisyphuslabs/codex-teammode",
- "version": "4.18.1",
+ "version": "4.18.2",
"devDependencies": {
"@types/node": "^25.9.3",
"bun-types": "^1.3.1",
@@ -245,7 +245,7 @@
},
"components/telemetry": {
"name": "@code-yeongyu/codex-telemetry",
- "version": "4.18.1",
+ "version": "4.18.2",
"license": "MIT",
"bin": {
"omo-telemetry": "dist/cli.js"
@@ -263,7 +263,7 @@
},
"components/ultrawork": {
"name": "@code-yeongyu/codex-ultrawork",
- "version": "4.18.1",
+ "version": "4.18.2",
"license": "MIT",
"bin": {
"omo-ultrawork": "dist/cli.js"
@@ -281,7 +281,7 @@
},
"components/ulw-loop": {
"name": "@code-yeongyu/codex-ulw-loop",
- "version": "4.18.1",
+ "version": "4.18.2",
"license": "MIT",
"bin": {
"omo-ulw-loop": "dist/cli.js",
diff --git a/plugins/omo/package.json b/plugins/omo/package.json
index 2d4fde29..06d09fc3 100644
--- a/plugins/omo/package.json
+++ b/plugins/omo/package.json
@@ -1,6 +1,6 @@
{
"name": "@sisyphuslabs/omo-codex-plugin",
- "version": "4.18.1",
+ "version": "4.18.2",
"description": "Aggregate Codex plugin root for OMO components.",
"type": "module",
"packageManager": "[email protected]",
diff --git a/plugins/omo/scripts/sync-skills.mjs b/plugins/omo/scripts/sync-skills.mjs
index aea24486..36c7880f 100644
--- a/plugins/omo/scripts/sync-skills.mjs
+++ b/plugins/omo/scripts/sync-skills.mjs
@@ -132,9 +132,10 @@ const startWorkOriginalCompletion = `When all top-level checkboxes in \`## TODOs
const startWorkCodexCompletion = `When all top-level checkboxes in \`## TODOs\` and \`## Final Verification Wave\` are complete:
1. Run the plan's final verification commands.
-2. Complete the **Global Review and Debugging Gate** before any completion claim, PR creation, PR handoff, branch handoff, or merge. The gate's pass binds to the commit SHA it reviewed and covers every later checkpoint at that same SHA — never re-run it on an already-passed SHA; re-run only when new commits land:
+2. Complete the **Global Review and Debugging Gate** before any completion claim, PR creation, PR handoff, branch handoff, or merge:
- Invoke the \`review-work\` skill with the final diff, changed files, user goal, constraints, run command, and verification evidence. All five review lanes must return PASS. A timeout, missing deliverable, ack-only child, \`BLOCKED:\`, or inconclusive lane is a gate failure, not approval.
- - Run a debugging-oriented runtime audit even when the review passes: name at least three plausible failure hypotheses for the changed surface, run the distinguishing checks against the actual artifact, and append the ruled-out or confirmed result to \`.omo/start-work/ledger.jsonl\`.
+ - Each passing review lane binds to the exact full commit SHA it reviewed. Immediately append a durable record to \`.omo/start-work/ledger.jsonl\` with the lane name, full SHA, PASS verdict, and report artifact/source. Before same-SHA reuse after any continuation or compaction, re-read the ledger record and require the exact lane/SHA pair; memory, chat history, or an unstamped report is not coverage. New commits require fresh applicable lane coverage.
+ - Run a debugging-oriented runtime audit even when the review passes: name at least three plausible failure hypotheses for the changed surface, run the distinguishing checks against the actual artifact, and append a separate durable record with the audit name, exact full SHA, verdict, and evidence artifact/source to \`.omo/start-work/ledger.jsonl\`. Reuse it only after re-reading an exact audit/SHA match.
- If any review lane or debugging hypothesis fails, invoke the \`debugging\` skill, confirm root cause with runtime evidence, add the minimal failing test or reproduction, fix it, rerun the affected verification, then rerun the Global Review and Debugging Gate.
- Evidence hygiene is mandatory: redact or mask secrets and sensitive user data before writing \`.omo/start-work/ledger.jsonl\`, a PR body, or a handoff. Never include raw tokens, credentials, auth headers, cookies, API keys, env dumps, private logs, or PII; use concise summaries, lengths, hashes, or short non-sensitive prefixes instead.
- If the work includes creating, updating, or handing off a PR, refresh \`git status\` and the PR/branch state from the task-owned worktree after the gate, and include only redacted review/debugging evidence in the PR body or handoff.
@@ -156,6 +157,13 @@ failed, investigate the underlying uncertainty with the \`debugging\` skill when
runtime behavior may be wrong, fix with evidence, and rerun the affected lane
before claiming completion, creating or handing off a PR, or merging.
+After each lane reaches PASS, immediately append a durable task-evidence record
+to the active ledger with the lane name, exact full commit SHA, PASS verdict,
+and report artifact/source. Before reusing coverage after continuation or
+compaction, re-read that record and require the exact lane/SHA pair. Memory,
+chat history, or an unstamped report is not coverage; a new commit requires
+fresh applicable lane records.
+
A rejecting lane must name its blockers inline in its final message — each
blocker cites the violated goal criterion or requirement plus an evidence
pointer. A bare REJECT/FAIL token without findings is not a verdict; treat it
diff --git a/plugins/omo/skills/review-work/SKILL.md b/plugins/omo/skills/review-work/SKILL.md
index 0ee54fa2..ffafd86a 100644
--- a/plugins/omo/skills/review-work/SKILL.md
+++ b/plugins/omo/skills/review-work/SKILL.md
@@ -70,6 +70,13 @@ failed, investigate the underlying uncertainty with the `debugging` skill when
runtime behavior may be wrong, fix with evidence, and rerun the affected lane
before claiming completion, creating or handing off a PR, or merging.
+After each lane reaches PASS, immediately append a durable task-evidence record
+to the active ledger with the lane name, exact full commit SHA, PASS verdict,
+and report artifact/source. Before reusing coverage after continuation or
+compaction, re-read that record and require the exact lane/SHA pair. Memory,
+chat history, or an unstamped report is not coverage; a new commit requires
+fresh applicable lane records.
+
A rejecting lane must name its blockers inline in its final message — each
blocker cites the violated goal criterion or requirement plus an evidence
pointer. A bare REJECT/FAIL token without findings is not a verdict; treat it
diff --git a/plugins/omo/skills/start-work/SKILL.md b/plugins/omo/skills/start-work/SKILL.md
index 85f5d941..8c1edbfc 100644
--- a/plugins/omo/skills/start-work/SKILL.md
+++ b/plugins/omo/skills/start-work/SKILL.md
@@ -176,9 +176,10 @@ Only after verification passes:
When all top-level checkboxes in `## TODOs` and `## Final Verification Wave` are complete:
1. Run the plan's final verification commands.
-2. Complete the **Global Review and Debugging Gate** before any completion claim, PR creation, PR handoff, branch handoff, or merge. The gate's pass binds to the commit SHA it reviewed and covers every later checkpoint at that same SHA — never re-run it on an already-passed SHA; re-run only when new commits land:
+2. Complete the **Global Review and Debugging Gate** before any completion claim, PR creation, PR handoff, branch handoff, or merge:
- Invoke the `review-work` skill with the final diff, changed files, user goal, constraints, run command, and verification evidence. All five review lanes must return PASS. A timeout, missing deliverable, ack-only child, `BLOCKED:`, or inconclusive lane is a gate failure, not approval.
- - Run a debugging-oriented runtime audit even when the review passes: name at least three plausible failure hypotheses for the changed surface, run the distinguishing checks against the actual artifact, and append the ruled-out or confirmed result to `.omo/start-work/ledger.jsonl`.
+ - Each passing review lane binds to the exact full commit SHA it reviewed. Immediately append a durable record to `.omo/start-work/ledger.jsonl` with the lane name, full SHA, PASS verdict, and report artifact/source. Before same-SHA reuse after any continuation or compaction, re-read the ledger record and require the exact lane/SHA pair; memory, chat history, or an unstamped report is not coverage. New commits require fresh applicable lane coverage.
+ - Run a debugging-oriented runtime audit even when the review passes: name at least three plausible failure hypotheses for the changed surface, run the distinguishing checks against the actual artifact, and append a separate durable record with the audit name, exact full SHA, verdict, and evidence artifact/source to `.omo/start-work/ledger.jsonl`. Reuse it only after re-reading an exact audit/SHA match.
- If any review lane or debugging hypothesis fails, invoke the `debugging` skill, confirm root cause with runtime evidence, add the minimal failing test or reproduction, fix it, rerun the affected verification, then rerun the Global Review and Debugging Gate.
- Evidence hygiene is mandatory: redact or mask secrets and sensitive user data before writing `.omo/start-work/ledger.jsonl`, a PR body, or a handoff. Never include raw tokens, credentials, auth headers, cookies, API keys, env dumps, private logs, or PII; use concise summaries, lengths, hashes, or short non-sensitive prefixes instead.
- If the work includes creating, updating, or handing off a PR, refresh `git status` and the PR/branch state from the task-owned worktree after the gate, and include only redacted review/debugging evidence in the PR body or handoff.
diff --git a/plugins/omo/skills/ultrawork/SKILL.md b/plugins/omo/skills/ultrawork/SKILL.md
index 6cab3364..32a8853a 100644
--- a/plugins/omo/skills/ultrawork/SKILL.md
+++ b/plugins/omo/skills/ultrawork/SKILL.md
@@ -112,9 +112,7 @@ notepad with a one-line reason each. Skipping a skill that fits the
task is a defect. Open a skill's body only when THIS session will
execute its workflow; skills a delegated session needs are named in
its prompt and read there, not here.
-Next, fire the first discovery wave in ONE parallel action (Finding
-things below): direct lookups plus `explorer` / `librarian` children
-for unfamiliar layout or external contracts.
+Next, fire the first discovery wave under Finding things below.
Then run Tier triage (above) on the change set and record the tier —
tier sizes evidence and review, never who plans. Size planning by
what the wave left UNDECIDED, not by how many steps you can list:
@@ -214,25 +212,27 @@ GOOD pair (test-first, ordered):
BAD: "Implement feature" / "Fix bug" / "Add tests later" / writing
production code before its failing test → rewrite.
-# Finding things (lead with these, parallel-flood the first wave)
+# Finding things (lead with these, code-mode the first wave)
Never guess from memory — locate with the right tool, and re-read before
-you claim or change. Fire 3+ independent lookups in one action;
-serialize only when one output strictly feeds the next.
-- CodeGraph, when `codegraph_*` tools exist -> use `codegraph_explore`
- first for how/where/what/flow questions and before edits; if absent,
- inactive/uninitialized, or cold-start unavailable, keep moving with
- Read/Grep/Glob/LSP and the ast-grep skill.
-- Repo-wide inspection, CLI smoke tests, git/history, bounded command
- output → use native shell commands directly: `rg`, `rg --files`,
- `cat`, and `git`. Narrow huge output before reading it.
-- Symbols — definitions, references, rename impact, diagnostics →
- `lsp_goto_definition`, `lsp_find_references`, `lsp_symbols`,
- `lsp_diagnostics`. Use the LSP, not text search, for anything
- symbol-shaped.
-- Structural shapes — call/function/class/import patterns, codemods →
- the `ast-grep` skill or `sg` CLI with `$VAR` / `$$$` metavars.
-- Text / strings / comments / logs → `rg`. File-name discovery →
- `glob` / `find`. Verbatim content → `read`.
+you claim or change. **USE CODE MODE AGGRESSIVELY FOR BOUNDED WAVES.**
+When multiple independent tool calls produce results that can be materially
+filtered, joined, deduplicated, or reduced, make ONE `exec` / eval JavaScript
+program that calls eligible tools concurrently with `Promise.all` and emits only
+decision-relevant evidence. For shell-native repo work without programmatic
+tool access, use ONE Python script with `concurrent.futures`, `subprocess`,
+and utility functions to batch commands and reduce output. Keep direct calls
+when one result chooses the next action, outputs are already small, semantic
+judgment is required between calls, approval or side effects are involved,
+or native artifacts / citations must be preserved.
+- Architecture / flow / blast radius → `codegraph_explore` first when
+ `codegraph_*` exists; if unavailable, continue with repo tools and LSP.
+- **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,
+ workspace symbols, and diagnostics use the available `lsp_*` tools, not
+ text search. Run diagnostics after edits and treat errors as blocking.
+- Repo text / filenames / history / bounded shell output → `rg`,
+ `rg --files`, `git`, and native utilities; narrow output in-program.
+- Structural call / function / class / import shapes and codemods → the
+ `ast-grep` skill or `sg` with `$VAR` / `$$$` metavariables.
When discovery needs multiple angles or the module layout is
unfamiliar, delegate to the `explorer` subagent (read-only codebase
search, absolute-path results). For research that leaves the repo —
@@ -296,21 +296,39 @@ Until every success criterion PASSES with its evidence captured:
vars. Append a one-line cleanup receipt to the notepad next to the
artifact, e.g. `cleanup: killed 12345; tmux kill-session ulw-qa-foo;
rm -rf /tmp/ulw.aB12cD`. No receipt → criterion stays in_progress.
-6. Verify: LSP diagnostics clean on changed files + full test suite
- green (no skipped, no xfail added this turn).
+6. Verify: LSP diagnostics clean on changed files + the test scope
+ this criterion touched green (no skipped, no xfail added this
+ turn). Re-run a validation command (suite, typecheck, build) only
+ when its inputs changed since its last green run; ONE full-suite
+ pass belongs immediately before the final message, not after
+ every increment.
7. Mark completed. Append non-obvious findings / learnings.
-8. After each increment, re-run every criterion's scenario. Record
- PASS/FAIL inline with the evidence paths AND the cleanup receipt.
- Loop until all PASS.
-
-Parallel-batch independent reads / searches / subagents within a step,
-but NEVER parallelise RED and GREEN of the same criterion.
+8. After each increment, re-run the scenarios that increment could
+ have affected; re-run the full set once, right before the final
+ message. Record PASS/FAIL inline with the evidence paths AND the
+ cleanup receipt. Loop until all PASS.
+
+Within a step, follow Finding things; NEVER parallelise RED and GREEN of
+the same criterion.
+
+# Waiting discipline (a poll costs a full model round)
+Every status check you issue as a tool call replays the entire
+accumulated context through the model. When a command will run long
+(installs, builds, test suites, containers, CI), run it to completion
+in ONE call with a timeout sized to the expected duration, or send
+output to a log file and read it once when a completion signal is
+expected. Never re-poll the same surface with empty reads or
+sub-minute waits — batch waiting into the fewest, longest blocking
+calls the harness allows, and do independent root work while the
+command runs. If two consecutive checks show no state change, double
+the wait before the next check or switch to a completion signal.
# Codex subagent reliability
Every `multi_agent_v1.spawn_agent` message is self-contained and starts with
-`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`, and
-`VERIFY`. State that it is an executable assignment, not a context
-handoff. Use `fork_context: false` unless full history is truly
+`TASK: <imperative assignment>`, then names `DELIVERABLE`, `SCOPE`,
+`VERIFY`, and `STOP WHEN` — the observable condition that ends the
+child's run; a child without a stop condition wanders past its goal.
+State that it is an executable assignment, not a context handoff. Use `fork_context: false` unless full history is truly
required; paste only the context the child needs. Full-history forks can
make the child continue old parent context instead of the delegated task.
If your tool list has a flat `spawn_agent` with a required `task_name` instead of `multi_agent_v1.*` (`multi_agent_v2`), rewrite: `fork_context: false` becomes `fork_turns: "none"`, `send_input` becomes `send_message`, finished agents end on their own (no `close_agent`; `followup_task` re-tasks, `interrupt_agent` stops), and `wait_agent` takes only `timeout_ms`, returning on any child mailbox activity.
@@ -420,7 +438,6 @@ message + present for approval.
- Never suppress lints / errors / test failures. Never delete, skip,
`.only`, `.skip`, `xfail`, or comment out tests to green the suite.
- Never claim done from inference — only from captured evidence.
-- Parallel tool calls for any independent work.
# Output discipline
- First line literally: `ULTRAWORK MODE ENABLED!`
diff --git a/plugins/omo/skills/ulw-loop/references/full-workflow.md b/plugins/omo/skills/ulw-loop/references/full-workflow.md
index 1ba6a194..dd331b0b 100644
--- a/plugins/omo/skills/ulw-loop/references/full-workflow.md
+++ b/plugins/omo/skills/ulw-loop/references/full-workflow.md
@@ -187,7 +187,7 @@ Trigger only for the final aggregate goal after every criterion in every goal is
2. FREEZE first — no more edits or rebases. At the frozen HEAD, re-run Manual-QA for any PASS criterion whose stamped tree differs from `git rev-parse --short "HEAD^{tree}"`, so every criterion is proven on the frozen tree; each artifact exists and is non-empty.
3a. Spawn lazycodex-code-reviewer and lazycodex-qa-executor in parallel (`fork_context: false` on v1; `fork_turns: "none"` on v2) with brief, goals, desired outcome, diff, evidence; wait for BOTH and confirm their report artifacts exist on disk.
3b. Only then spawn lazycodex-gate-reviewer with those artifact paths.
-3c. The gate's approval binds to the frozen tree and covers its three lanes — code quality, hands-on QA, and goal verification. A later rebase or amend that keeps the tree identical keeps the approval; changed content needs fresh review of the delta.
+3c. The gate's approval binds to the frozen tree and full commit SHA and covers its three lanes — code quality, hands-on QA, and goal verification. Immediately append one durable `.omo/ulw-loop/ledger.jsonl` record per passing lane with the lane name, full SHA, verdict, and report artifact/source. Before reuse after continuation or compaction, re-read the ledger and require the exact lane/SHA pair; memory or an unstamped report is not coverage. A later rebase or amend that keeps the tree identical still has a new SHA and needs fresh lane stamps; changed content needs fresh review of the delta.
4. Treat timeout, missing deliverable, ack-only, `BLOCKED:`, or inconclusive review as a blocker. Any fix restarts the freeze at the new HEAD: re-run ONLY the proofs it invalidated and stamp the fresh output — never regenerate all evidence or relabel stale output to HEAD — re-review the delta at most TWICE; then record-review-blockers (step 5) and surface to the user.
5. If review remains blocked, run `omo ulw-loop record-review-blockers --goal-id <id> --title "<...>" --objective "<...>" --evidence "<review findings>" --codex-goal-json <snapshot> --json`.
6. If clean, checkpoint final completion:
diff --git a/plugins/omo/test/mcp-research-servers.test.mjs b/plugins/omo/test/mcp-research-servers.test.mjs
index cf1f08d3..5c3c37ce 100644
--- a/plugins/omo/test/mcp-research-servers.test.mjs
+++ b/plugins/omo/test/mcp-research-servers.test.mjs
@@ -20,4 +20,5 @@ test("#given aggregate MCP config #when inspected #then registers research MCPs
assert.equal(Object.hasOwn(mcp.mcpServers, "ast_grep"), false);
assert.deepEqual(mcp.mcpServers.codegraph.args, ["components/codegraph/dist/serve.js"]);
assert.equal(mcp.mcpServers.codegraph.required, false);
+ assert.equal(mcp.mcpServers.lsp.startup_timeout_sec, 10);
});
diff --git a/plugins/omo/test/sync-skills-orchestration.test.mjs b/plugins/omo/test/sync-skills-orchestration.test.mjs
index 90370b22..df89f096 100644
--- a/plugins/omo/test/sync-skills-orchestration.test.mjs
+++ b/plugins/omo/test/sync-skills-orchestration.test.mjs
@@ -241,6 +241,9 @@ test("#given start-work skill #when synced for Codex #then the difficulty-tier d
assert.match(content, /lazycodex-worker-medium/);
assert.match(content, /Delegation by difficulty/);
assert.match(content, /Global Review and Debugging Gate/);
+ assert.match(content, /full commit SHA/);
+ assert.match(content, /re-read the ledger record/);
+ assert.match(content, /exact lane\/SHA pair/);
assert.doesNotMatch(content, /works the same on both surfaces/);
});
@@ -256,6 +259,10 @@ test("#given review-work skill #when some lanes do not finish #then aggregate re
assert.match(content, /Do not spin in repeated/);
assert.match(content, /bare REJECT\/FAIL token without findings is not a verdict/);
assert.match(content, /cites the violated goal criterion/);
+ assert.match(content, /append a durable task-evidence record/);
+ assert.match(content, /full commit SHA/);
+ assert.match(content, /re-read that record/);
+ assert.match(content, /exact lane\/SHA pair/);
assert.match(content, /Do not use `multi_agent_v1\.send_input` as an interrupt/);
});
diff --git a/plugins/omo/test/sync-skills-test-support.mjs b/plugins/omo/test/sync-skills-test-support.mjs
index b22def5a..6839c061 100644
--- a/plugins/omo/test/sync-skills-test-support.mjs
+++ b/plugins/omo/test/sync-skills-test-support.mjs
@@ -77,9 +77,10 @@ const startWorkOriginalCompletion = `When all top-level checkboxes in \`## TODOs
const startWorkCodexCompletion = `When all top-level checkboxes in \`## TODOs\` and \`## Final Verification Wave\` are complete:
1. Run the plan's final verification commands.
-2. Complete the **Global Review and Debugging Gate** before any completion claim, PR creation, PR handoff, branch handoff, or merge. The gate's pass binds to the commit SHA it reviewed and covers every later checkpoint at that same SHA — never re-run it on an already-passed SHA; re-run only when new commits land:
+2. Complete the **Global Review and Debugging Gate** before any completion claim, PR creation, PR handoff, branch handoff, or merge:
- Invoke the \`review-work\` skill with the final diff, changed files, user goal, constraints, run command, and verification evidence. All five review lanes must return PASS. A timeout, missing deliverable, ack-only child, \`BLOCKED:\`, or inconclusive lane is a gate failure, not approval.
- - Run a debugging-oriented runtime audit even when the review passes: name at least three plausible failure hypotheses for the changed surface, run the distinguishing checks against the actual artifact, and append the ruled-out or confirmed result to \`.omo/start-work/ledger.jsonl\`.
+ - Each passing review lane binds to the exact full commit SHA it reviewed. Immediately append a durable record to \`.omo/start-work/ledger.jsonl\` with the lane name, full SHA, PASS verdict, and report artifact/source. Before same-SHA reuse after any continuation or compaction, re-read the ledger record and require the exact lane/SHA pair; memory, chat history, or an unstamped report is not coverage. New commits require fresh applicable lane coverage.
+ - Run a debugging-oriented runtime audit even when the review passes: name at least three plausible failure hypotheses for the changed surface, run the distinguishing checks against the actual artifact, and append a separate durable record with the audit name, exact full SHA, verdict, and evidence artifact/source to \`.omo/start-work/ledger.jsonl\`. Reuse it only after re-reading an exact audit/SHA match.
- If any review lane or debugging hypothesis fails, invoke the \`debugging\` skill, confirm root cause with runtime evidence, add the minimal failing test or reproduction, fix it, rerun the affected verification, then rerun the Global Review and Debugging Gate.
- Evidence hygiene is mandatory: redact or mask secrets and sensitive user data before writing \`.omo/start-work/ledger.jsonl\`, a PR body, or a handoff. Never include raw tokens, credentials, auth headers, cookies, API keys, env dumps, private logs, or PII; use concise summaries, lengths, hashes, or short non-sensitive prefixes instead.
- If the work includes creating, updating, or handing off a PR, refresh \`git status\` and the PR/branch state from the task-owned worktree after the gate, and include only redacted review/debugging evidence in the PR body or handoff.
@@ -91,8 +92,38 @@ const startWorkOriginalHardRule = "- No completion claim while an applicable ult
const startWorkCodexHardRule = "- No completion claim while an applicable ultraqa adversarial class was never probed. Each applicable class needs a captured observable result; each skipped class needs a one-line not-applicable reason in the ledger.\n- No `ORCHESTRATION COMPLETE`, final response, PR creation, PR handoff, or merge before the Global Review and Debugging Gate passes with recorded evidence.\n- No PR/branch implementation or review in the main worktree; create or use a task-owned git worktree first.\n- No unprefixed session ids in Boulder state. Codex sessions are always `codex:<session_id>`.";
-const reviewWorkCodexGatePattern =
- /\nWhen `review-work` is used as a final implementation, PR, or `\$start-work`\ngate, it is blocking\. A timeout, missing deliverable, ack-only response,\nexplicit `BLOCKED:`, or inconclusive lane is not a pass\. Treat that lane as\nfailed, investigate the underlying uncertainty with the `debugging` skill when\nruntime behavior may be wrong, fix with evidence, and rerun the affected lane\nbefore claiming completion, creating or handing off a PR, or merging\.\n\nA rejecting lane must name its blockers inline in its final message — each\nblocker cites the violated goal criterion or requirement plus an evidence\npointer\. A bare REJECT\/FAIL token without findings is not a verdict; treat it\nas an inconclusive lane \(one bounded respawn, then record it inconclusive with\nthat reason\)\.\n\nWhen reviewing a PR or branch, collect diff, file contents, and verification\nresults from a dedicated review worktree attached to that branch\. Never\ncheckout, test, or edit the review branch in the main worktree\.\n\nReview evidence must be safe to share\. Redact or mask secrets and sensitive\nuser data before including evidence in logs, PR bodies, or handoffs\. Never\ninclude raw tokens, credentials, auth headers, cookies, API keys, env dumps,\nprivate logs, or PII; summarize with lengths, hashes, and short non-sensitive\nprefixes when identity is needed\.\n/;
+const reviewWorkCodexGate = `
+When \`review-work\` is used as a final implementation, PR, or \`$start-work\`
+gate, it is blocking. A timeout, missing deliverable, ack-only response,
+explicit \`BLOCKED:\`, or inconclusive lane is not a pass. Treat that lane as
+failed, investigate the underlying uncertainty with the \`debugging\` skill when
+runtime behavior may be wrong, fix with evidence, and rerun the affected lane
+before claiming completion, creating or handing off a PR, or merging.
+
+After each lane reaches PASS, immediately append a durable task-evidence record
+to the active ledger with the lane name, exact full commit SHA, PASS verdict,
+and report artifact/source. Before reusing coverage after continuation or
+compaction, re-read that record and require the exact lane/SHA pair. Memory,
+chat history, or an unstamped report is not coverage; a new commit requires
+fresh applicable lane records.
+
+A rejecting lane must name its blockers inline in its final message — each
+blocker cites the violated goal criterion or requirement plus an evidence
+pointer. A bare REJECT/FAIL token without findings is not a verdict; treat it
+as an inconclusive lane (one bounded respawn, then record it inconclusive with
+that reason).
+
+When reviewing a PR or branch, collect diff, file contents, and verification
+results from a dedicated review worktree attached to that branch. Never
+checkout, test, or edit the review branch in the main worktree.
+
+Review evidence must be safe to share. Redact or mask secrets and sensitive
+user data before including evidence in logs, PR bodies, or handoffs. Never
+include raw tokens, credentials, auth headers, cookies, API keys, env dumps,
+private logs, or PII; summarize with lengths, hashes, and short non-sensitive
+prefixes when identity is needed.
+`;
+const reviewWorkCodexGatePattern = new RegExp(reviewWorkCodexGate.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
export function removeCodexSkillOverlays(skillName, content) {
if (skillName === "ulw-research") {