mirror of
https://github.com/openclaw/openclaw.git
synced 2026-11-22 03:40:05 +00:00
fix(daemon): recognize released waiting task launchers
Recognize the exact waiting VBS wrapper shipped by 2026.9.3 during owned service reconciliation. Keep custom launcher behavior unknown and preserve all command, root, Task and authority checks. The real audit entry point rejected this released form as TaskLauncher unknown-edit before repair. The causal regression and edited-launcher control pass with 55 audit and 140 backup/rewrite sibling cases.
This commit is contained in:
parent
c0f54abf1a
commit
ec74258473
3 changed files with 23 additions and 5 deletions
|
|
@ -173,6 +173,9 @@ Strict maintenance inspection follows the task's registered CMD or VBS launcher,
|
|||
|
||||
Doctor and deep status provide read-only `schtasks /Query` hints for extra Scheduled Tasks, including Node hosts. Discovery shares one 60-second budget across the inventory query and launcher inspection. If it expires, completed discoveries remain available and Doctor reports that some services could not be inspected. Review the registered command and purpose before choosing removal through the service's owner.
|
||||
|
||||
Doctor recognizes the waiting VBS launcher shipped with 2026.9.3 during an owned
|
||||
service refresh. Custom launcher behavior still preserves the existing definition.
|
||||
|
||||
Doctor compares task definitions using Task Scheduler's defaults. An omitted
|
||||
`Enabled` element means `true` for both the task and its logon trigger, so XML
|
||||
export differences do not cause drift warnings or failed refresh verification.
|
||||
|
|
|
|||
|
|
@ -279,6 +279,8 @@ export async function auditScheduledTaskDefinition(
|
|||
sourcePath
|
||||
) {
|
||||
const legacy = `CreateObject("WScript.Shell").Run """${sourcePath.replaceAll('"', '""')}""", 0, False`;
|
||||
// 2026.9.3 emitted this waiting launcher before the supervisor environment marker.
|
||||
const releasedWaiting = `WScript.Quit CreateObject("WScript.Shell").Run("""${sourcePath.replaceAll('"', '""')}""", 0, True)`;
|
||||
const generated = buildHiddenLauncherScript({
|
||||
scriptPath: sourcePath,
|
||||
taskSupervisor: command?.environment?.OPENCLAW_SERVICE_KIND === "gateway",
|
||||
|
|
@ -291,7 +293,7 @@ export async function auditScheduledTaskDefinition(
|
|||
});
|
||||
if (
|
||||
installedLauncher !== undefined &&
|
||||
![legacy, generated].some(
|
||||
![legacy, releasedWaiting, generated].some(
|
||||
(candidate) => normalize(candidate) === normalize(installedLauncher),
|
||||
)
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -587,6 +587,8 @@ it.each(["canonical-wrapper", "legacy-wrapper", "malformed-args", "wrapper", "me
|
|||
|
||||
it.each([
|
||||
"canonical",
|
||||
"released-waiting",
|
||||
"released-waiting-custom",
|
||||
"script",
|
||||
"launcher",
|
||||
"metadata",
|
||||
|
|
@ -596,6 +598,7 @@ it.each([
|
|||
"custom-script",
|
||||
"native-defaults",
|
||||
])("checks generated Scheduled Task %s before a rewrite", async (kind) => {
|
||||
const releasedWaiting = kind.startsWith("released-waiting");
|
||||
const home = dirs.make("rewrite-task-preservation-");
|
||||
const env = {
|
||||
USERPROFILE: home,
|
||||
|
|
@ -604,6 +607,9 @@ it.each([
|
|||
...(kind === "custom-script" ? { OPENCLAW_TASK_SCRIPT_NAME: "gateway.bat" } : {}),
|
||||
};
|
||||
const environment: Record<string, string> = { ...staleServiceEnvironment };
|
||||
if (releasedWaiting) {
|
||||
environment.OPENCLAW_SERVICE_VERSION = "2026.9.3";
|
||||
}
|
||||
if (kind === "path") {
|
||||
environment.PATH = "C:\\operator-private";
|
||||
}
|
||||
|
|
@ -621,8 +627,10 @@ it.each([
|
|||
buildTaskScript(command) +
|
||||
(kind === "script" ? "echo operator-private\r\n" : "");
|
||||
const launcher =
|
||||
buildHiddenLauncherScript({ scriptPath, taskSupervisor: true }) +
|
||||
(kind === "launcher" || kind === "planned-launcher"
|
||||
(releasedWaiting
|
||||
? `' OpenClaw Gateway (v2026.9.3)\r\nWScript.Quit CreateObject("WScript.Shell").Run("""${scriptPath.replaceAll('"', '""')}""", 0, True)\r\n`
|
||||
: buildHiddenLauncherScript({ scriptPath, taskSupervisor: true })) +
|
||||
(kind === "launcher" || kind === "planned-launcher" || kind === "released-waiting-custom"
|
||||
? 'WScript.Echo "operator-private"\r\n'
|
||||
: "");
|
||||
await fs.writeFile(scriptPath, script);
|
||||
|
|
@ -664,7 +672,12 @@ it.each([
|
|||
environment: { ...environment, OPENCLAW_WINDOWS_TASK_HIDDEN_LAUNCHER: "1" },
|
||||
},
|
||||
});
|
||||
if (kind === "canonical" || kind === "missing-launcher" || kind === "custom-script") {
|
||||
if (
|
||||
kind === "canonical" ||
|
||||
kind === "released-waiting" ||
|
||||
kind === "missing-launcher" ||
|
||||
kind === "custom-script"
|
||||
) {
|
||||
expect(result.definitionDrift).toBeUndefined();
|
||||
} else if (kind === "script") {
|
||||
expect(result.definitionDrift).toBeUndefined();
|
||||
|
|
@ -700,7 +713,7 @@ it.each([
|
|||
expect.objectContaining({
|
||||
kind: "unknown-edit",
|
||||
key:
|
||||
kind === "launcher" || kind === "planned-launcher"
|
||||
kind === "launcher" || kind === "planned-launcher" || kind === "released-waiting-custom"
|
||||
? "TaskLauncher"
|
||||
: kind === "path"
|
||||
? "Environment.PATH"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue