Files
openclaw/src/agents/bash-process-control.ts
T
Peter Steinberger cb50289e28 fix(agents): keep removed background processes alive until exit (#113860)
* fix(agents): keep removed processes live until exit

* test(agents): isolate process registry lifecycle coverage

* chore(plugin-sdk): refresh API closure baseline
2026-08-09 06:04:40 -07:00

22 lines
800 B
TypeScript

// Shared control seam for task-ledger and process-tool cancellation.
import { getProcessSupervisor } from "../process/supervisor/index.js";
import { getSession, hasActiveBackgroundExecSession } from "./bash-process-registry.js";
export function isBackgroundExecSessionActive(sessionId: string): boolean {
return hasActiveBackgroundExecSession(sessionId);
}
export function cancelBackgroundExecSession(sessionId: string): boolean {
const session = getSession(sessionId);
if (!session?.backgrounded || session.exited || session.finalizing) {
return false;
}
const supervisor = getProcessSupervisor();
const record = supervisor.getRecord(sessionId);
if (!record || record.state === "exited") {
return false;
}
supervisor.cancel(sessionId, "manual-cancel");
return true;
}