mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 23:56:43 +01:00
fix(runner): honor Codex effort selected in composer (#14568)
## Thinking Path > - Paperclip manages AI agents that work on assigned tasks. > - The task composer lets a person choose an assignee, model, and effort for the next run. > - A Paperclip Runner agent can use Codex as its provider. > - The composer hid Codex effort for that agent because it checked only the older Codex adapter. > - The native Runner input also did not carry an effort choice to Codex. > - This pull request carries the chosen effort from the composer to each Codex turn. > - People can now select a supported effort and get the effort they selected. ## Linked Issues or Issue Description Refs #14322 **What happened?** The composer showed a model but no effort slider when the assignee used Paperclip Runner with the Codex provider. A task-level model override also did not reach the native Runner input. **Expected behavior** The composer shows effort choices for a known Codex model. The next native Codex turn uses the selected model and effort. **Steps to reproduce** 1. Open a task composer. 2. Select an agent that uses Paperclip Runner with the Codex provider. 3. Select a known Codex model such as `gpt-6-astra`. 4. Open the assignee and model picker. The effort slider is missing before this change. ## What Changed - Show known Codex effort levels for Paperclip Runner Codex assignees. - Save the task effort override in the native run input and send it to Codex on each turn. - Apply the task's merged model and effort overrides when the native run starts. - Apply a task model override for OpenCode Runner without changing the agent's provider. - Add Runner effort tests and desktop and mobile Storybook cases. ## Verification - `pnpm -r typecheck` passed. - `pnpm build` passed. - `pnpm build-storybook` passed. - `pnpm check:token-gates` passed. - Focused UI, server, Runner contract, and Codex driver tests passed. - The full CI test matrix, build, typecheck, and canary dry run passed on the latest head. ## Risks - Native Runner inputs add an optional Codex effort field to the current v5 input. Older inputs keep their previous behavior. - A known model rejects an effort that its catalog does not support. Unknown models do not show a slider. > This fixes an existing composer bug. I checked `ROADMAP.md`; it does not describe this bug as planned work. ## Model Used OpenAI Codex, GPT-6. The exact deployment ID and context window are not exposed in this session. The model used reasoning, code execution, and repository tools. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: OpenAI GPT-6 Astra <noreply@openai.com>
This commit is contained in:
19 files changed
+185
-9
No files matched your search
@@ -18,11 +18,14 @@ describe("LCA-05 explicit native work mode", () => {
|
||||
taskPrompt: text,
|
||||
workspace: { id: "50000000-0000-4000-8000-000000000005", cwd: "/workspace", repoUrl: null, repoRef: null, branchName: null },
|
||||
normalizedSessionId: null,
|
||||
provider: "codex",
|
||||
codexReasoningEffort: "high",
|
||||
planningContext: workMode === "planning" ? { documentId: null, baseRevisionId: null, baseRevisionNumber: 0, markdown: "", sha256: "a".repeat(64), reviewContext: {} } : null,
|
||||
completionContract: { id: "70000000-0000-4000-8000-000000000007", sha256: `sha256:${"a".repeat(64)}`, schemaVersion: "paperclip.run-result.v1", contract: { revision: "1", objective: "Deliver the requested work", criteria: [{ id: "output", requirement: "Deliver the requested work" }] } },
|
||||
runtimeContext: nativeRuntimeContextFixture(),
|
||||
});
|
||||
expect(input.task.workMode).toBe(workMode);
|
||||
expect(input.provider).toMatchObject({ kind: "codex", reasoningEffort: "high" });
|
||||
expect(input.executionMode).toBe(workMode === "planning" ? "plan" : "default");
|
||||
expect(input.task.title).toBe(text);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ export function buildNativeExecutionInput(input: {
|
||||
provider?: "codex" | "opencode" | "claude_managed" | "aws_agentcore" | "acpx";
|
||||
acpxAgent?: NativeAcpxAgent;
|
||||
codexApprovalPolicy?: NativeCodexApprovalPolicy;
|
||||
codexReasoningEffort?: string;
|
||||
opencodePermissionMode?: NativeOpenCodePermissionMode;
|
||||
acpxPermissionMode?: NativeAcpxPermissionMode;
|
||||
model?: string | null;
|
||||
@@ -281,6 +282,7 @@ export function buildNativeExecutionInput(input: {
|
||||
kind: "codex",
|
||||
model: input.model ?? null,
|
||||
approvalPolicy: input.codexApprovalPolicy ?? "never",
|
||||
...(input.codexReasoningEffort ? { reasoningEffort: input.codexReasoningEffort } : {}),
|
||||
},
|
||||
completionContract: {
|
||||
id: input.completionContract.id,
|
||||
|
||||
@@ -5,6 +5,10 @@ import {
|
||||
resolvePaperclipRunnerPermissionMode,
|
||||
type PaperclipRunnerProvider,
|
||||
} from "@paperclipai/adapter-utils";
|
||||
import {
|
||||
codexLocalReasoningEffortsForModel,
|
||||
isCodexLocalKnownModel,
|
||||
} from "@paperclipai/adapter-codex-local";
|
||||
import {
|
||||
AGENTCORE_QUALIFIED_MODEL,
|
||||
CLAUDE_MANAGED_QUALIFIED_MODEL,
|
||||
@@ -63,6 +67,7 @@ export type PaperclipRunnerNativeProviderInput =
|
||||
provider: "codex";
|
||||
model: string | null;
|
||||
codexApprovalPolicy: "never" | "on-request" | "untrusted";
|
||||
codexReasoningEffort?: string;
|
||||
}
|
||||
| {
|
||||
provider: "opencode";
|
||||
@@ -138,6 +143,29 @@ function optionalString(value: unknown): string | null {
|
||||
: null;
|
||||
}
|
||||
|
||||
/** A task may change a local Runner model (and Codex effort), but not provider identity. */
|
||||
export function projectPaperclipRunnerTaskConfig(
|
||||
backend: "codex_app_server" | "opencode_server",
|
||||
agentConfig: unknown,
|
||||
taskOverrides: unknown,
|
||||
): Record<string, unknown> {
|
||||
const base = asRecord(agentConfig);
|
||||
const task = asRecord(taskOverrides);
|
||||
const config = { ...base };
|
||||
const model = optionalString(task.model);
|
||||
const effortKey = backend === "codex_app_server"
|
||||
? ["modelReasoningEffort", "reasoningEffort", "effort"].find((key) => key in task)
|
||||
: undefined;
|
||||
if (backend === "codex_app_server" && ((model !== null && model !== optionalString(base.model)) || effortKey !== undefined)) {
|
||||
delete config.modelReasoningEffort;
|
||||
delete config.reasoningEffort;
|
||||
delete config.effort;
|
||||
}
|
||||
if (model !== null) config.model = model;
|
||||
if (effortKey !== undefined) config.modelReasoningEffort = task[effortKey];
|
||||
return config;
|
||||
}
|
||||
|
||||
function positiveNumberOrNull(
|
||||
value: unknown,
|
||||
code: string,
|
||||
@@ -650,6 +678,18 @@ export function resolvePaperclipRunnerNativeProviderInput(input: {
|
||||
},
|
||||
};
|
||||
}
|
||||
const effort = config.modelReasoningEffort ?? config.reasoningEffort ?? config.effort;
|
||||
const allowedEfforts = ["minimal", "low", "medium", "high", "xhigh", "max", "ultra"];
|
||||
if (effort !== undefined && effort !== null && effort !== "" && (
|
||||
typeof effort !== "string" || !allowedEfforts.includes(effort)
|
||||
|| (profile.model && isCodexLocalKnownModel(profile.model)
|
||||
&& !codexLocalReasoningEffortsForModel(profile.model).includes(effort as "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra"))
|
||||
)) {
|
||||
throw new PaperclipRunnerProviderProfileError(
|
||||
"paperclip_runner_codex_effort_invalid",
|
||||
"Paperclip Runner Codex reasoning effort is not supported for this model.",
|
||||
);
|
||||
}
|
||||
return {
|
||||
provider: "codex",
|
||||
model: profile.model,
|
||||
@@ -657,5 +697,6 @@ export function resolvePaperclipRunnerNativeProviderInput(input: {
|
||||
"codex",
|
||||
config.codexPermissionMode,
|
||||
) as "never" | "on-request" | "untrusted",
|
||||
...(typeof effort === "string" && effort ? { codexReasoningEffort: effort } : {}),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user