Files
openclaw/src/agents/bash-tools.exec-host-node.types.ts
openperf 2ffbea20d2 fix(agents): drop stale exec approval followups after session rebind
Exec approval followups were dispatched by sessionKey only. When /new or
/reset rotates the sessionId under that key while an approval is pending,
the resolved followup landed in the new session, surfacing stale approval
output (or 'Exec denied' / continuation text) in a fresh conversation.

Capture the session UUID active when the approval is requested and drop the
followup once the key has been rebound to a different sessionId:
- agent-run followups: carry the expected id on the agent request and drop it
  at the gateway as an early preflight, before the handler touches the rebound
  session (session-store write, chat/agent run + active-run registration,
  dedupe, accepted ack) — not just before model dispatch. Covers elevated and
  non-elevated.
- denied / direct fallback followups: resolve the key's current sessionId from
  the session store and drop before the channel send.

Fixes #59349.
2026-06-08 17:29:15 +01:00

44 lines
1.5 KiB
TypeScript

/**
* Node-host exec command parameter contracts.
* Centralizes the full host/runtime boundary so node exec callers and handlers
* cannot drift on approval, routing, env, or timeout fields.
*/
import type { ExecAsk, ExecSecurity } from "../infra/exec-approvals.js";
import type { ExecAutoReviewer } from "../infra/exec-auto-review.js";
import type { ExecElevatedDefaults } from "./bash-tools.exec-types.js";
/** Full parameter bundle for Node-hosted exec command execution. */
export type ExecuteNodeHostCommandParams = {
command: string;
workdir: string | undefined;
env: Record<string, string>;
requestedEnv?: Record<string, string>;
requestedNode?: string;
boundNode?: string;
sessionKey?: string;
/** Session UUID active when the approval was requested; pins the followup. */
sessionId?: string;
/** Session-store template, so the direct/denied followup can detect a rebind. */
sessionStore?: string;
bashElevated?: ExecElevatedDefaults;
turnSourceChannel?: string;
turnSourceTo?: string;
turnSourceAccountId?: string;
turnSourceThreadId?: string | number;
trigger?: string;
agentId?: string;
security: ExecSecurity;
ask: ExecAsk;
autoReview?: boolean;
autoReviewer?: ExecAutoReviewer;
strictInlineEval?: boolean;
commandHighlighting?: boolean;
timeoutSec?: number;
defaultTimeoutSec: number;
approvalRunningNoticeMs: number;
warnings: string[];
notifySessionKey?: string;
notifyOnExit?: boolean;
trustedSafeBinDirs?: ReadonlySet<string>;
};