Skip to content

Commit c3f4d5e

Browse files
authored
fix(codex): deliver task-suggestion tools to Codex-harness runs with calibrated guidance (#121568)
- forward taskSuggestionDeliveryMode through the Codex app-server dynamic tool build (same sibling-harness omission class previously fixed for clientCaps); spawn_task/dismiss_task silently never existed for GPT-backed sessions - regression test asserting the forward, mirroring the existing clientCaps case - spawn_task/dismiss_task descriptions rewritten with usage calibration: when to flag, when not to, scope-vs-flagging, prose-is-lost, operator-phrasing bridge, prompt self-containment, git-checkout cwd, registry ephemerality; param descriptions state where each field renders Release-note context: GPT-backed sessions can now create suggested-task cards (the tools were silently absent on the Codex harness), and the tools carry much clearer model-facing guidance.
1 parent 572fab0 commit c3f4d5e

3 files changed

Lines changed: 41 additions & 7 deletions

File tree

‎extensions/codex/src/app-server/dynamic-tool-build.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,25 @@ describe("Codex app-server dynamic tool build", () => {
442442
});
443443
});
444444

445+
it("forwards the task-suggestion delivery mode", async () => {
446+
// Regression: spawn_task/dismiss_task silently never existed on the Codex
447+
// app-server path because this harness dropped params.taskSuggestionDeliveryMode.
448+
const workspaceDir = path.join(tempDir, "workspace");
449+
const params = createParams(path.join(tempDir, "session.jsonl"), workspaceDir);
450+
params.disableTools = false;
451+
params.runtimePlan = createCodexRuntimePlanFixture();
452+
params.taskSuggestionDeliveryMode = "gateway";
453+
let receivedOptions: unknown;
454+
setOpenClawCodingToolsFactoryForTests((options) => {
455+
receivedOptions = options;
456+
return [createRuntimeDynamicTool("message")];
457+
});
458+
459+
await buildDynamicToolsForTest(params, workspaceDir);
460+
461+
expect(receivedOptions).toMatchObject({ taskSuggestionDeliveryMode: "gateway" });
462+
});
463+
445464
it("preserves the host-provided OpenClaw tool through the Codex allowlist", async () => {
446465
const workspaceDir = path.join(tempDir, "workspace");
447466
const params = createParams(path.join(tempDir, "session.jsonl"), workspaceDir);

‎extensions/codex/src/app-server/dynamic-tool-build.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ export async function buildDynamicTools(input: DynamicToolBuildParams) {
328328
requireExplicitMessageTarget:
329329
params.requireExplicitMessageTarget ?? isSubagentSessionKey(params.sessionKey),
330330
sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
331+
// Same sibling-harness rule as clientCaps above: without this forward,
332+
// spawn_task/dismiss_task silently never exist for Codex-harness runs.
333+
taskSuggestionDeliveryMode: params.taskSuggestionDeliveryMode,
331334
disableMessageTool: input.ignoreDisableMessageTool ? false : params.disableMessageTool,
332335
forceMessageTool: shouldForceMessageTool(messagePolicyParams),
333336
enableHeartbeatTool: params.trigger === "heartbeat" || input.forceHeartbeatTool === true,

‎src/agents/tools/task-suggestion-tools.ts‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@ const SpawnTaskToolSchema = Type.Object(
1717
title: Type.String({
1818
minLength: 1,
1919
maxLength: 60,
20-
description: "Imperative task title under 60 characters.",
20+
description:
21+
"Imperative task title under 60 characters (start with a verb); shown as the card title and the started session's name.",
2122
}),
2223
prompt: Type.String({
2324
minLength: 1,
2425
maxLength: 32_768,
25-
description: "Self-contained task prompt with relevant file paths and context.",
26+
description:
27+
"Self-contained task prompt with file paths and enough context to act without this conversation.",
2628
}),
2729
tldr: Type.String({
2830
minLength: 1,
2931
maxLength: 1_024,
30-
description: "One or two plain-language sentences explaining the value; no code or paths.",
32+
description:
33+
"One or two plain-language sentences shown on the card explaining the value; no code or paths.",
3134
}),
3235
cwd: Type.Optional(
3336
Type.String({
@@ -74,8 +77,14 @@ export function createTaskSuggestionTools(params: {
7477
name: "spawn_task",
7578
displaySummary: SPAWN_TASK_TOOL_DISPLAY_SUMMARY,
7679
description: [
77-
"Suggest confirmed valuable out-of-scope follow-up: dead code, stale docs, missing coverage, verified TODO, security issue.",
78-
"Operator suggestion only; does not start work. cwd must be an absolute path inside a git checkout.",
80+
"Flag an out-of-scope issue as a separate follow-up task instead of ignoring it, fixing it inline, or only mentioning it in your reply — a follow-up described in prose is lost; recording it here is what surfaces it to the operator.",
81+
"This is the tool behind requests like 'flag it as a follow-up', 'note that for later', or 'make a task for that'; whenever you would write 'Follow-up:' in a reply, call this instead.",
82+
"Use this whenever work you were not asked to do surfaces along the way: dead code, stale docs, missing coverage, a confirmed TODO, or a security issue spotted in passing.",
83+
"Requests to stay scoped or skip cleanup apply to doing the work, not to flagging it: this only records a suggestion card in the operator's UI; nothing runs unless they accept it, and your current turn continues uninterrupted.",
84+
"Do not flag vague code-smell observations or low-confidence hunches.",
85+
"The prompt must stand alone: the started task sees only that text, never this conversation.",
86+
"cwd must be an absolute path inside a git checkout.",
87+
"Suggestions are ephemeral; ids do not survive a gateway restart.",
7988
].join(" "),
8089
parameters: SpawnTaskToolSchema,
8190
outputSchema: SpawnTaskOutputSchema,
@@ -110,8 +119,11 @@ export function createTaskSuggestionTools(params: {
110119
label: "Dismiss Task",
111120
name: "dismiss_task",
112121
displaySummary: DISMISS_TASK_TOOL_DISPLAY_SUMMARY,
113-
description:
114-
"Withdraw stale/irrelevant pending spawn_task. Accepted suggestion cannot withdraw.",
122+
description: [
123+
"Withdraw a pending suggestion card you created with spawn_task when it is now stale, superseded, or already handled in this session.",
124+
"To replace a card, call spawn_task with the better suggestion first, then dismiss the old task_id.",
125+
"Only cards the operator has not acted on can be withdrawn; accepted ones cannot.",
126+
].join(" "),
115127
parameters: DismissTaskToolSchema,
116128
execute: async (_toolCallId, args) => {
117129
const input = args as Record<string, unknown>;

0 commit comments

Comments
 (0)