























@@ -8,7 +8,6 @@ import {
88type EmbeddedRunAttemptParams,
99} from "openclaw/plugin-sdk/agent-harness";
1010import {
11-buildAgentRuntimePlan,
1211embeddedAgentLog,
1312nativeHookRelayTesting,
1413onAgentEvent,
@@ -62,21 +61,25 @@ function createParamsWithRuntimePlan(
6261workspaceDir: string,
6362): EmbeddedRunAttemptParams {
6463const params = createParams(sessionFile, workspaceDir);
65-return {
66- ...params,
67-runtimePlan: buildAgentRuntimePlan({
68-provider: params.provider,
69-modelId: params.modelId,
70-model: params.model,
71-modelApi: params.model.api,
64+useLightweightCodexRuntimePlan(params);
65+return params;
66+}
67+68+function useLightweightCodexRuntimePlan(params: EmbeddedRunAttemptParams): void {
69+params.runtimePlan = {
70+auth: {},
71+prompt: {
72+resolveSystemPromptContribution: () => undefined,
73+},
74+tools: {
75+normalize: (tools: unknown) => tools,
76+logDiagnostics: () => undefined,
77+},
78+observability: {
79+resolvedRef: `${params.provider}/${params.modelId}`,
7280harnessId: "codex",
73-harnessRuntime: "codex",
74-config: params.config,
75- workspaceDir,
76-agentDir: tempDir,
77-thinkingLevel: params.thinkLevel,
78-}),
79-} as EmbeddedRunAttemptParams;
81+},
82+} as NonNullable<EmbeddedRunAttemptParams["runtimePlan"]>;
8083}
81848285function threadStartResult(threadId = "thread-1") {
@@ -364,6 +367,7 @@ function extractRelayIdFromThreadRequest(params: unknown): string {
364367describe("runCodexAppServerAttempt", () => {
365368beforeEach(async () => {
366369resetAgentEventsForTest();
370+vi.stubEnv("OPENCLAW_TRAJECTORY", "0");
367371tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-codex-run-"));
368372});
369373@@ -376,6 +380,7 @@ describe("runCodexAppServerAttempt", () => {
376380resetGlobalHookRunner();
377381vi.useRealTimers();
378382vi.restoreAllMocks();
383+vi.unstubAllEnvs();
379384await fs.rm(tempDir, { recursive: true, force: true });
380385});
381386@@ -476,6 +481,7 @@ describe("runCodexAppServerAttempt", () => {
476481params.config = { tools: { profile: "coding" } };
477482params.sourceReplyDeliveryMode = "message_tool_only";
478483params.messageProvider = "whatsapp";
484+useLightweightCodexRuntimePlan(params);
479485let seenForceMessageTool: boolean | undefined;
480486__testing.setOpenClawCodingToolsFactoryForTests((options) => {
481487seenForceMessageTool = options?.forceMessageTool;
@@ -516,6 +522,7 @@ describe("runCodexAppServerAttempt", () => {
516522session: { store: sessionsPath, mainKey: "main", scope: "per-sender" },
517523tools: { profile: "coding" },
518524};
525+useLightweightCodexRuntimePlan(params);
519526await fs.writeFile(
520527sessionsPath,
521528JSON.stringify({
@@ -1450,7 +1457,7 @@ describe("runCodexAppServerAttempt", () => {
14501457);
14511458await waitForMethod("turn/start");
145214591453-expect(queueAgentHarnessMessage("session-1", "more context")).toBe(true);
1460+expect(queueAgentHarnessMessage("session-1", "more context", { debounceMs: 1 })).toBe(true);
14541461await vi.waitFor(
14551462() => expect(requests.some((entry) => entry.method === "turn/steer")).toBe(true),
14561463{ interval: 1 },
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。