fix(cli): normalize reply-media paths for agent --deliver (#68516)

This commit is contained in:
Frank Yang
2026-04-18 20:05:41 +08:00
committed by GitHub
parent 25ce5a5822
commit 442deb0816
4 changed files with 169 additions and 4 deletions

View File

@@ -82,6 +82,7 @@ function resolveReplyMediaMaxBytes(params: {
export function createReplyMediaPathNormalizer(params: {
cfg: OpenClawConfig;
sessionKey?: string;
agentId?: string;
workspaceDir: string;
messageProvider?: string;
accountId?: string;
@@ -93,9 +94,14 @@ export function createReplyMediaPathNormalizer(params: {
requesterSenderUsername?: string;
requesterSenderE164?: string;
}): (payload: ReplyPayload) => Promise<ReplyPayload> {
const agentId = params.sessionKey
? resolveSessionAgentId({ sessionKey: params.sessionKey, config: params.cfg })
: undefined;
// Prefer an explicit agentId so callers without a resolved sessionKey (e.g.
// `openclaw agent --deliver` with `--reply-channel/--reply-to`) still get
// the stricter agent-scoped file-read policy applied during staging.
const agentId =
params.agentId ??
(params.sessionKey
? resolveSessionAgentId({ sessionKey: params.sessionKey, config: params.cfg })
: undefined);
const maxBytes = resolveReplyMediaMaxBytes({
cfg: params.cfg,
channel: params.messageProvider,