Compare commits

...

5 Commits

Author SHA1 Message Date
Peter Steinberger
faf046b426 docs: update changelog for #183 2026-01-04 16:36:00 +00:00
Peter Steinberger
71cda84bc9 style: format reply directive test 2026-01-04 16:35:55 +00:00
Peter Steinberger
a405619f56 test: cover elevated default when not allowed 2026-01-04 16:34:54 +00:00
Peter Steinberger
7113b69534 chore: update Peekaboo submodule 2026-01-04 16:34:16 +00:00
Cash Williams
77e03a2a90 fix: default elevated level to 'off' when not allowed
When elevatedAllowed is false (e.g., for heartbeat surface which isn't
in any allowFrom list), the elevated level was incorrectly defaulting
to 'on', causing bash commands to fail with 'elevated is not available'.

Now defaults to 'off' when elevated isn't allowed, so bash works
normally without trying to use elevated mode.

Fixes: https://github.com/clawdbot/clawdbot/issues/181
2026-01-04 10:13:28 -06:00
4 changed files with 48 additions and 2 deletions

View File

@ -30,6 +30,7 @@
- Sessions: prevent `sessions_send` timeouts by running nested agent turns on a separate lane. - Sessions: prevent `sessions_send` timeouts by running nested agent turns on a separate lane.
- Sessions: use per-send run IDs for gateway agent calls to avoid wait collisions. - Sessions: use per-send run IDs for gateway agent calls to avoid wait collisions.
- Auto-reply: drop final payloads when block streaming to avoid duplicate Discord sends. - Auto-reply: drop final payloads when block streaming to avoid duplicate Discord sends.
- Auto-reply: default elevated to off when not allowed (#183) — thanks @cash-echo-bot.
- Auto-reply: fix typing TTL to 2 minutes and log TTL with s/m units. - Auto-reply: fix typing TTL to 2 minutes and log TTL with s/m units.
- Bash tool: default auto-background delay to 10s. - Bash tool: default auto-background delay to 10s.
- Telegram: chunk block-stream replies to avoid “message is too long” errors (#124) — thanks @mukhtharcm. - Telegram: chunk block-stream replies to avoid “message is too long” errors (#124) — thanks @mukhtharcm.

@ -1 +1 @@
Subproject commit b69e4e8dc0f34fca488e034c6cb1373f1259589d Subproject commit 5c8eedd6426aff53041248a3556adeac4e2b714c

View File

@ -828,4 +828,49 @@ describe("directive parsing", () => {
}); });
}); });
}); });
it("defaults elevated to off when sender is not approved", async () => {
await withTempHome(async (home) => {
const storePath = path.join(home, "sessions.json");
vi.mocked(runEmbeddedPiAgent).mockResolvedValue({
payloads: [{ text: "done" }],
meta: {
durationMs: 5,
agentMeta: { sessionId: "s", provider: "p", model: "m" },
},
});
await getReplyFromConfig(
{
Body: "hello",
From: "+1004",
To: "+2000",
Surface: "whatsapp",
SenderE164: "+1004",
},
{},
{
agent: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
elevatedDefault: "on",
elevated: {
allowFrom: { whatsapp: ["+1999"] },
},
},
whatsapp: {
allowFrom: ["*"],
},
session: { store: storePath },
},
);
expect(runEmbeddedPiAgent).toHaveBeenCalledOnce();
const call = vi.mocked(runEmbeddedPiAgent).mock.calls[0]?.[0];
expect(call?.bashElevated).toEqual({
enabled: true,
allowed: false,
defaultLevel: "off",
});
});
});
}); });

View File

@ -305,7 +305,7 @@ export async function getReplyFromConfig(
(sessionEntry?.elevatedLevel as ElevatedLevel | undefined) ?? (sessionEntry?.elevatedLevel as ElevatedLevel | undefined) ??
(agentCfg?.elevatedDefault as ElevatedLevel | undefined) ?? (agentCfg?.elevatedDefault as ElevatedLevel | undefined) ??
"on") "on")
: "on"; : "off";
const resolvedBlockStreaming = const resolvedBlockStreaming =
agentCfg?.blockStreamingDefault === "off" ? "off" : "on"; agentCfg?.blockStreamingDefault === "off" ? "off" : "on";
const resolvedBlockStreamingBreak: "text_end" | "message_end" = const resolvedBlockStreamingBreak: "text_end" | "message_end" =