From 296275b53b3d1912900207411ecdc13a71fdca65 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 18 Jan 2026 15:59:39 +0000 Subject: [PATCH] fix: boot-md hook + exec approvals parsing (#1164) (thanks @ngutman) --- CHANGELOG.md | 2 ++ src/cli/exec-approvals-cli.ts | 6 +++--- src/infra/exec-approvals.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8348921a5..c652e61d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Docs: https://docs.clawd.bot - macOS: add approvals socket UI server + node exec lifecycle events. - Nodes: add headless node host (`clawdbot node start`) for `system.run`/`system.which`. - Nodes: add node daemon service install/status/start/stop/restart. +- Hooks: run `BOOT.md` on gateway startup with the boot-md hook. (#1164) — thanks @ngutman. - Bridge: add `skills.bins` RPC to support node host auto-allow skill bins. - Slash commands: replace `/cost` with `/usage off|tokens|full` to control per-response usage footer; `/usage` no longer aliases `/status`. (Supersedes #1140) — thanks @Nachx639. - Sessions: add daily reset policy with per-type overrides and idle windows (default 4am local), preserving legacy idle-only configs. (#1146) — thanks @austinm911. @@ -47,6 +48,7 @@ Docs: https://docs.clawd.bot - Memory: index atomically so failed reindex preserves the previous memory database. (#1151) - Memory: avoid sqlite-vec unique constraint failures when reindexing duplicate chunk ids. (#1151) - Exec approvals: enforce allowlist when ask is off; prefer raw command for node approvals/events. +- Exec approvals: parse command tokens correctly for PATH and relative resolution. - Tools: return a companion-app-required message when node exec is requested with no paired node. - Streaming: emit assistant deltas for OpenAI-compatible SSE chunks. (#1147) — thanks @alauppe. - Model fallback: treat timeout aborts as failover while preserving user aborts. (#1137) — thanks @cheeeee. diff --git a/src/cli/exec-approvals-cli.ts b/src/cli/exec-approvals-cli.ts index 64e932969..b25e80d6a 100644 --- a/src/cli/exec-approvals-cli.ts +++ b/src/cli/exec-approvals-cli.ts @@ -185,7 +185,7 @@ export function registerExecApprovalsCli(program: Command) { } allowlistEntries.push({ pattern: trimmed, lastUsedAt: Date.now() }); agent.allowlist = allowlistEntries; - file.agents = { ...(file.agents ?? {}), [agentKey]: agent }; + file.agents = { ...file.agents, [agentKey]: agent }; const next = await saveSnapshot(opts, nodeId, file, snapshot.hash); const payload = opts.json ? JSON.stringify(next) : JSON.stringify(next, null, 2); defaultRuntime.log(payload); @@ -229,11 +229,11 @@ export function registerExecApprovalsCli(program: Command) { agent.allowlist = nextEntries; } if (isEmptyAgent(agent)) { - const agents = { ...(file.agents ?? {}) }; + const agents = { ...file.agents }; delete agents[agentKey]; file.agents = Object.keys(agents).length > 0 ? agents : undefined; } else { - file.agents = { ...(file.agents ?? {}), [agentKey]: agent }; + file.agents = { ...file.agents, [agentKey]: agent }; } const next = await saveSnapshot(opts, nodeId, file, snapshot.hash); const payload = opts.json ? JSON.stringify(next) : JSON.stringify(next, null, 2); diff --git a/src/infra/exec-approvals.ts b/src/infra/exec-approvals.ts index 213ce5a7c..eb51d369a 100644 --- a/src/infra/exec-approvals.ts +++ b/src/infra/exec-approvals.ts @@ -242,7 +242,7 @@ function parseFirstToken(command: string): string | null { if (end > 1) return trimmed.slice(1, end); return trimmed.slice(1); } - const match = /^[^\\s]+/.exec(trimmed); + const match = /^[^\s]+/.exec(trimmed); return match ? match[0] : null; }