Compare commits

...

3 Commits

Author SHA1 Message Date
pashpashpash
5965453619 test(codex): guard same-session reply guidance 2026-05-01 12:12:24 -04:00
pashpashpash
b1ded0b0df fix(codex): clarify same-session delivery modes 2026-05-01 12:12:24 -04:00
pashpashpash
70a5a470c6 fix(codex): keep same-session replies on normal path 2026-05-01 12:12:24 -04:00
2 changed files with 34 additions and 2 deletions

View File

@@ -1,5 +1,17 @@
import type { EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness-runtime";
import { describe, expect, it } from "vitest";
import { resolveReasoningEffort } from "./thread-lifecycle.js";
import { buildDeveloperInstructions, resolveReasoningEffort } from "./thread-lifecycle.js";
function createAttemptParams(overrides: Partial<EmbeddedRunAttemptParams> = {}) {
return {
provider: "openai-codex",
modelId: "gpt-5.4",
config: {},
agentDir: "/tmp/agent",
workspaceDir: "/tmp/workspace",
...overrides,
} as EmbeddedRunAttemptParams;
}
describe("resolveReasoningEffort (#71946)", () => {
describe("modern Codex models (none/low/medium/high/xhigh enum)", () => {
@@ -57,3 +69,19 @@ describe("resolveReasoningEffort (#71946)", () => {
});
});
});
describe("buildDeveloperInstructions", () => {
it("tells same-session channel replies to answer normally", () => {
const prompt = buildDeveloperInstructions(createAttemptParams());
expect(prompt).toContain(
"When replying in the current chat/session, answer normally and let OpenClaw handle delivery when normal final replies are enabled for that channel.",
);
expect(prompt).toContain(
"If the turn says source channel delivery is private or message-tool-only, use the messaging tool for visible output.",
);
expect(prompt).not.toContain(
"If sending a channel reply, use the OpenClaw messaging tool instead of describing that you would reply",
);
});
});

View File

@@ -223,7 +223,11 @@ export function buildDeveloperInstructions(params: EmbeddedRunAttemptParams): st
const promptOverlay = renderCodexRuntimePromptOverlay(params);
const sections = [
"You are running inside OpenClaw. Use OpenClaw dynamic tools for OpenClaw-specific integrations such as messaging, cron, sessions, media, gateway, and nodes when available.",
"Preserve the user's existing channel/session context. If sending a channel reply, use the OpenClaw messaging tool instead of describing that you would reply.",
[
"Preserve the user's existing channel/session context.",
"When replying in the current chat/session, answer normally and let OpenClaw handle delivery when normal final replies are enabled for that channel.",
"If the turn says source channel delivery is private or message-tool-only, use the messaging tool for visible output.",
].join(" "),
promptOverlay,
params.extraSystemPrompt,
params.skillsSnapshot?.prompt,