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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Changelog

## 1.0.15-beta.0 — 2026-11-18
## 1.0.15 — 2026-11-18

The stable release of the OpenClaw plugin fix for tool calls blocked as "failproofaid could not be reached" while the daemon was healthy, plus the refreshed README and docs and the dependency updates that landed on `main` since 1.0.14.

### Fixes

- The OpenClaw plugin's 250 ms connect timer no longer blocks tool calls as "failproofaid could not be reached" while the gateway's event loop is busy and the daemon is healthy. The timer ran on the gateway's own event loop and fired ahead of a connect that had already completed; it is gone. A missing daemon still fails at once and a hung one within the 30 s request budget, which both attempts now share; a connect that fails outright is retried once after 100 ms; and the gateway log says why a call was blocked: each attempt's cause, the elapsed time and the attempt count (#1024, #1029)

### Docs

- Bring the README, npm description and English docs up to date with the website and the live Cloud dashboard: trace / analyse / fix navigation, insights, checks, the failproof agent, the free plan, and corrected CLI and OTLP details (#1022)

### Dependencies

- OSV gate: time-boxed allow-list entry for picomatch GHSA-fc5q-39xc-vjpf (ReDoS, no fixed release). It is in build/test tooling and ships inside the Next.js dashboard bundle, where it only matches image URLs against globs from next.config, of which we declare none; re-review by 2026-12-18 (#1029)
- Bump `posthog-node` to 5.73.0 (#1012) and `sql.js` to 1.16.0 (#1013), and Next.js to 16.4.6 in the bundled dashboard (#1007)

## 1.0.14-beta.0 — 2026-11-16

### Features
Expand Down
9 changes: 8 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,14 @@ it is **daemon-only** (`requiresHealthyDaemon`): install refuses without a daemo
and when no verdict comes back `before_tool_call` and `before_agent_run` **fail
closed** (blocked, reason logged through `api.logger`) while `before_agent_finalize`
does not force a revise — that cannot bring the daemon back and would only loop the
turn. All I/O is async: the gateway is a long-running multi-channel process. It
turn. All I/O is async: the gateway is a long-running multi-channel process. That
also means **no short timer may decide that a pending connection is unreachable**: a
timer shares the gateway's event loop with every agent, so a busy gateway makes it fire
late and ahead of I/O that already completed. A 250 ms connect timer did exactly that
and reported a healthy daemon as unreachable (#1024). The client now has one 30 s
budget for the whole request, shared by both attempts, and retries once after 100 ms —
a pause that starts only after a connection has already failed, so it classifies
nothing. It
carries **no inline tool maps** (unlike the OpenCode/Pi shims) — it forwards raw
event/tool names and a Claude-shaped stdin (`params→tool_input`,
`toolName→tool_name`, `transcriptPath→transcript_path`,
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "3"
members = ["crates/*"]

[workspace.package]
version = "1.0.15-beta.0"
version = "1.0.15"
edition = "2024"
license-file = "LICENSE"
repository = "https://github.com/FailproofAI/failproofai"
139 changes: 139 additions & 0 deletions __tests__/hooks/openclaw-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,130 @@ describe("openclaw-plugin daemon-client: requestHookVerdict", () => {
expect(result).toMatchObject({ ok: false, failure: "unreachable" });
});

// The plugin runs on the OpenClaw gateway's own event loop, shared with
// every agent on it. A healthy daemon accepts in the kernel at once, but
// the gateway only hears about it once it has finished whatever it is
// doing — so a busy gateway must not read as an unreachable daemon.
//
// The hook starts from a setImmediate callback, as one fired by the gateway
// does: the next loop pass then reaches its timers before its I/O poll, so
// an overdue timer always runs before the queued connect event. Started from
// arbitrary test code the order depends on the loop phase and the race is
// only sometimes lost.
it.each([300, 1_500])("still gets a verdict when the gateway is busy for %i ms", async (busyMs) => {
const daemon = await fakeDaemon(socketPath, () => hookResult(""));
try {
const pending = new Promise<Awaited<ReturnType<typeof requestHookVerdict>>>((done) => {
setImmediate(() => {
const result = requestHookVerdict({ event: "before_tool_call", payload: {}, socketPath });
const until = Date.now() + busyMs;
while (Date.now() < until) { /* the gateway, busy with another agent */ }
done(result);
});
});
expect(await pending).toEqual({ ok: true, verdict: { permission: "allow" } });
} finally {
await daemon.close();
}
});

it("retries once when the daemon is briefly not listening", async () => {
const pending = requestHookVerdict({ event: "before_tool_call", payload: {}, socketPath });
const daemon = await fakeDaemon(socketPath, () => hookResult(""));
try {
expect(await pending).toEqual({ ok: true, verdict: { permission: "allow" } });
} finally {
await daemon.close();
}
});

// Both attempts share one budget: when the first used it up, there is no
// second attempt with a fresh one (that let a call wait twice as long).
it("does not retry past the request budget", async () => {
const daemon = await fakeDaemon(socketPath, () => "hang");
try {
const pending = new Promise<Awaited<ReturnType<typeof requestHookVerdict>>>((done) => {
setImmediate(() => {
const result = requestHookVerdict({
event: "before_tool_call",
payload: {},
socketPath,
responseTimeoutMs: 150,
});
const until = Date.now() + 250; // the gateway, busy past the whole budget
while (Date.now() < until) { /* busy */ }
done(result);
});
});
const result = await pending;
expect(result).toMatchObject({ ok: false, failure: "unreachable" });
expect(result.detail).toMatch(/no time left in the 150 ms budget to retry/);
// A retry with a fresh budget would have reached the hanging daemon,
// sent it a frame, and ended as a timeout instead.
expect(daemon.requests).toHaveLength(0);
} finally {
await daemon.close();
}
});

it("gives a retry that connects only what is left of the request budget", async () => {
// First attempt: no socket (ENOENT). Then a daemon appears that accepts
// the request and never answers. With a 600 ms pause before the retry and
// a 1,000 ms budget, the retry has ~400 ms left: a shared budget ends near
// 1,000 ms, a fresh one would run to ~1,600 ms.
const started = performance.now();
const pending = requestHookVerdict({
event: "before_tool_call",
payload: {},
socketPath,
responseTimeoutMs: 1_000,
retryDelayMs: 600,
});
const daemon = await fakeDaemon(socketPath, () => "hang");
try {
const result = await pending;
const elapsed = performance.now() - started;
expect(result).toMatchObject({ ok: false, failure: "timeout" });
expect(result.detail).toMatch(/attempt 1: ENOENT/);
expect(daemon.requests).toHaveLength(1);
expect(elapsed).toBeGreaterThanOrEqual(950);
expect(elapsed).toBeLessThan(1_350);
Comment thread
chhhee10 marked this conversation as resolved.
Resolved
} finally {
await daemon.close();
}
});

it("keeps the first attempt's cause when the retry connects and then fails", async () => {
// First attempt: no socket yet (ENOENT). Retry: a listener that accepts the
// request and closes without a verdict.
let server: Server | undefined;
const pending = requestHookVerdict({ event: "before_tool_call", payload: {}, socketPath });
server = createServer((socket) => socket.once("data", () => socket.destroy()));
await new Promise<void>((done) => server!.listen(socketPath, done));
try {
const result = await pending;
expect(result).toMatchObject({
ok: false,
failure: "evaluation",
message: "failproofaid closed the connection before returning a verdict",
});
expect(result.detail).toMatch(/attempt 1: ENOENT after \d+ ms/);
expect(result.detail).toMatch(/attempt 2: failproofaid closed the connection/);
expect(result.detail).toMatch(/2 attempts, \d+ ms total/);
} finally {
await new Promise<void>((done) => server!.close(() => done()));
}
});

it("says why the daemon could not be reached, and does so promptly", async () => {
const started = Date.now();
const result = await requestHookVerdict({ event: "before_tool_call", payload: {}, socketPath });
expect(result).toMatchObject({ ok: false, failure: "unreachable" });
expect(result.detail).toMatch(/ENOENT/);
expect(result.detail).toMatch(/2 attempts/);
expect(Date.now() - started).toBeLessThan(1_000);
});

it("gives up on a daemon that never answers", async () => {
const daemon = await fakeDaemon(socketPath, () => "hang");
try {
Expand Down Expand Up @@ -373,6 +497,21 @@ describe("openclaw-plugin hooks", () => {
expect(logged[0]).toContain("before_tool_call");
});

it("logs why the daemon could not be reached, and keeps that out of the agent's reason", async () => {
const { api, handlers, logged } = fakeApi();
registerFailproofaiHooks(api, {
evaluate: async () => ({
ok: false,
failure: "unreachable",
message: "failproofaid could not be reached.",
detail: "ECONNREFUSED after 1 ms; 2 attempts",
}),
});
const result = (await handlers.get("before_tool_call")!(toolCall, ctx)) as { blockReason: string };
expect(logged[0]).toContain("failproofaid could not be reached. (ECONNREFUSED after 1 ms; 2 attempts)");
expect(result.blockReason).not.toContain("ECONNREFUSED");
});

it.each([
["an unknown permission", hookResult(JSON.stringify({ permission: "unknown" }))],
["a hookResult with no stdout", { type: "hookResult", protocolVersion: 2, exitCode: 0, stderr: "" }],
Expand Down
2 changes: 1 addition & 1 deletion hermes-plugin/plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: failproofai
version: 1.0.15-beta.0
version: 1.0.15
description: Real-time FailproofAI policy enforcement for Hermes
manifest_version: 2
api_version: 1
Expand Down
Loading
Loading