mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-26 00:21:59 +00:00
fix(ci): restore matrix guardrails and windows exec shim
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { resolveAckReaction, type OpenClawConfig } from "openclaw/plugin-sdk/matrix";
|
||||
import { resolveAckReaction, type OpenClawConfig } from "../../runtime-api.js";
|
||||
import type { CoreConfig } from "../../types.js";
|
||||
import { resolveMatrixAccountConfig } from "../accounts.js";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RuntimeEnv } from "openclaw/plugin-sdk/matrix";
|
||||
import type { RuntimeEnv } from "../../runtime-api.js";
|
||||
import { getMatrixRuntime } from "../../runtime.js";
|
||||
import type { MatrixConfig } from "../../types.js";
|
||||
import type { MatrixClient } from "../sdk.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { resolveMatrixTargets } from "../../resolve-targets.js";
|
||||
import {
|
||||
addAllowlistUserEntriesFromConfigEntry,
|
||||
buildAllowlistResolutionSummary,
|
||||
@@ -5,8 +6,7 @@ import {
|
||||
patchAllowlistUsersInConfigEntries,
|
||||
summarizeMapping,
|
||||
type RuntimeEnv,
|
||||
} from "openclaw/plugin-sdk/matrix";
|
||||
import { resolveMatrixTargets } from "../../resolve-targets.js";
|
||||
} from "../../runtime-api.js";
|
||||
import type { CoreConfig, MatrixRoomConfig } from "../../types.js";
|
||||
import { normalizeMatrixUserId } from "./allowlist.js";
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
getAgentScopedMediaLocalRoots,
|
||||
logInboundDrop,
|
||||
logTypingFailure,
|
||||
ensureConfiguredAcpBindingReady,
|
||||
type PluginRuntime,
|
||||
type ReplyPayload,
|
||||
type RuntimeEnv,
|
||||
type RuntimeLogger,
|
||||
} from "openclaw/plugin-sdk/matrix";
|
||||
import { ensureConfiguredAcpBindingReady } from "openclaw/plugin-sdk/matrix-runtime-heavy";
|
||||
} from "../../runtime-api.js";
|
||||
import type { CoreConfig, MatrixRoomConfig, ReplyToMode } from "../../types.js";
|
||||
import { createMatrixDraftStream } from "../draft-stream.js";
|
||||
import {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
formatLocationText,
|
||||
toLocationContext,
|
||||
type NormalizedLocation,
|
||||
} from "openclaw/plugin-sdk/matrix";
|
||||
} from "../../runtime-api.js";
|
||||
import type { LocationMessageEventContent } from "../sdk.js";
|
||||
import { EventType } from "./types.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
|
||||
import type { PluginRuntime } from "openclaw/plugin-sdk/matrix";
|
||||
import type { PluginRuntime } from "../../runtime-api.js";
|
||||
import type { CoreConfig } from "../../types.js";
|
||||
import { resolveMatrixAccountConfig } from "../accounts.js";
|
||||
import { extractMatrixReactionAnnotation } from "../reaction-common.js";
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {
|
||||
OpenClawConfig,
|
||||
ReplyPayload,
|
||||
RuntimeEnv,
|
||||
} from "openclaw/plugin-sdk/matrix";
|
||||
} from "../../runtime-api.js";
|
||||
import { getMatrixRuntime } from "../../runtime.js";
|
||||
import type { MatrixClient } from "../sdk.js";
|
||||
import { chunkMatrixText, sendMessageMatrix } from "../send.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "openclaw/plugin-sdk/matrix";
|
||||
import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "../../runtime-api.js";
|
||||
import type { MatrixRoomConfig } from "../../types.js";
|
||||
|
||||
export type MatrixRoomConfigResolved = {
|
||||
|
||||
@@ -229,6 +229,19 @@ export async function runCommandWithTimeout(
|
||||
const useCmdWrapper = isWindowsBatchCommand(resolvedCommand);
|
||||
const usesWindowsExitCodeShim =
|
||||
process.platform === "win32" && (useCmdWrapper || finalArgv !== argv);
|
||||
|
||||
const shouldAssumeWindowsShimSuccess = (params: {
|
||||
signal: NodeJS.Signals | null;
|
||||
timedOut: boolean;
|
||||
noOutputTimedOut: boolean;
|
||||
killed: boolean;
|
||||
}): boolean =>
|
||||
usesWindowsExitCodeShim &&
|
||||
params.signal == null &&
|
||||
!params.timedOut &&
|
||||
!params.noOutputTimedOut &&
|
||||
!params.killed;
|
||||
|
||||
const child = spawn(
|
||||
useCmdWrapper ? (process.env.ComSpec ?? "cmd.exe") : resolvedCommand,
|
||||
useCmdWrapper
|
||||
@@ -344,17 +357,18 @@ export async function runCommandWithTimeout(
|
||||
clearNoOutputTimer();
|
||||
clearCloseFallbackTimer();
|
||||
const resolvedSignal = childExitState?.signal ?? signal ?? child.signalCode ?? null;
|
||||
const resolvedCode =
|
||||
childExitState?.code ??
|
||||
code ??
|
||||
child.exitCode ??
|
||||
(usesWindowsExitCodeShim &&
|
||||
resolvedSignal == null &&
|
||||
!timedOut &&
|
||||
!noOutputTimedOut &&
|
||||
!child.killed
|
||||
? 0
|
||||
: null);
|
||||
let resolvedCode = childExitState?.code ?? code ?? child.exitCode ?? null;
|
||||
if (
|
||||
resolvedCode == null &&
|
||||
shouldAssumeWindowsShimSuccess({
|
||||
signal: resolvedSignal,
|
||||
timedOut,
|
||||
noOutputTimedOut,
|
||||
killed: child.killed,
|
||||
})
|
||||
) {
|
||||
resolvedCode = 0;
|
||||
}
|
||||
const termination = noOutputTimedOut
|
||||
? "no-output-timeout"
|
||||
: timedOut
|
||||
|
||||
Reference in New Issue
Block a user