mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 20:21:13 +00:00
fix(ci): stabilize auto reply and agentic tests
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { createEmbeddedRunReplayState } from "./pi-embedded-runner/replay-state.js";
|
||||
|
||||
export function createBaseToolHandlerState() {
|
||||
return {
|
||||
replayState: createEmbeddedRunReplayState(),
|
||||
toolMetaById: new Map<string, unknown>(),
|
||||
toolMetas: [] as Array<{ toolName?: string; meta?: string }>,
|
||||
toolSummaryById: new Set<string>(),
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
getSubagentRunByChildSessionKey,
|
||||
initSubagentRegistry,
|
||||
listSubagentRunsForRequester,
|
||||
registerSubagentRun,
|
||||
resetSubagentRegistryForTests,
|
||||
} from "./subagent-registry.js";
|
||||
import {
|
||||
@@ -361,14 +362,13 @@ describe("subagent registry persistence", () => {
|
||||
tempStateDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-subagent-"));
|
||||
process.env.OPENCLAW_STATE_DIR = tempStateDir;
|
||||
|
||||
const mod = await import(`./subagent-registry.ts?t=${Date.now()}`);
|
||||
vi.mocked(callGateway).mockResolvedValue({
|
||||
status: "ok",
|
||||
startedAt: 111,
|
||||
endedAt: 222,
|
||||
});
|
||||
|
||||
mod.registerSubagentRun({
|
||||
registerSubagentRun({
|
||||
runId: " run-live ",
|
||||
childSessionKey: " agent:main:subagent:live-child ",
|
||||
controllerSessionKey: " agent:main:subagent:live-controller ",
|
||||
@@ -378,7 +378,7 @@ describe("subagent registry persistence", () => {
|
||||
cleanup: "keep",
|
||||
});
|
||||
|
||||
expect(mod.listSubagentRunsForRequester("agent:main:main")).toEqual([
|
||||
expect(listSubagentRunsForRequester("agent:main:main")).toEqual([
|
||||
expect.objectContaining({
|
||||
runId: "run-live",
|
||||
childSessionKey: "agent:main:subagent:live-child",
|
||||
@@ -386,7 +386,7 @@ describe("subagent registry persistence", () => {
|
||||
requesterSessionKey: "agent:main:main",
|
||||
}),
|
||||
]);
|
||||
expect(mod.getSubagentRunByChildSessionKey("agent:main:subagent:live-child")).toMatchObject({
|
||||
expect(getSubagentRunByChildSessionKey("agent:main:subagent:live-child")).toMatchObject({
|
||||
runId: "run-live",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -148,6 +148,7 @@ describe("handleBtwCommand", () => {
|
||||
const params = buildParams("/btw what changed?");
|
||||
params.agentId = "worker-1";
|
||||
params.agentDir = undefined;
|
||||
delete (params as { sessionKey?: string }).sessionKey;
|
||||
params.sessionEntry = {
|
||||
sessionId: "session-1",
|
||||
updatedAt: Date.now(),
|
||||
|
||||
@@ -96,8 +96,12 @@ export const handleCompactCommand: CommandHandler = async (params) => {
|
||||
const sessionAgentId = params.sessionKey
|
||||
? resolveSessionAgentId({ sessionKey: params.sessionKey, config: params.cfg })
|
||||
: params.agentId;
|
||||
const sessionAgentDir =
|
||||
(sessionAgentId ? resolveAgentDir(params.cfg, sessionAgentId) : undefined) ?? params.agentDir;
|
||||
const shouldResolveSessionAgentDir =
|
||||
sessionAgentId !== undefined &&
|
||||
(!params.agentDir || (params.agentId !== undefined && sessionAgentId !== params.agentId));
|
||||
const sessionAgentDir = shouldResolveSessionAgentDir
|
||||
? resolveAgentDir(params.cfg, sessionAgentId)
|
||||
: params.agentDir;
|
||||
const customInstructions = extractCompactInstructions({
|
||||
rawBody: params.ctx.CommandBody ?? params.ctx.RawBody ?? params.ctx.Body,
|
||||
ctx: params.ctx,
|
||||
|
||||
Reference in New Issue
Block a user