Skip to content

Commit 8e245fd

Browse files
t3dotggclaude
andcommitted
fix(server): address review on native goals
- Drop unused exports flagged by Knip. - Expect the Codex `goal` slash command in the provider status test. - Match `/goal` case-sensitively in the steer guard, as the Codex parser does. - The orphan goal-turn net still interrupts the turn when the pause fails. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent b35f6f4 commit 8e245fd

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ const CLAUDE_GOAL_ACTIVE = /^Goal active: ([\s\S]+?) \((?:not yet evaluated|(\d+
10251025
* The goal after one root SDK frame, or undefined when the frame says nothing
10261026
* about it. Completion has no frame of its own; see finalizeActiveTurn.
10271027
*/
1028-
export function nextClaudeGoal(
1028+
function nextClaudeGoal(
10291029
current: OrchestrationV2ProviderGoal | null,
10301030
message: SDKMessage,
10311031
): OrchestrationV2ProviderGoal | null | undefined {

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ const CODEX_GOAL_STATUSES = {
899899
complete: "complete",
900900
} as const satisfies Record<CodexThreadGoal["status"], OrchestrationV2ProviderGoal["status"]>;
901901

902-
export function providerGoalFromCodex(goal: CodexThreadGoal): OrchestrationV2ProviderGoal | null {
902+
function providerGoalFromCodex(goal: CodexThreadGoal): OrchestrationV2ProviderGoal | null {
903903
const objective = goal.objective.trim();
904904
if (objective.length === 0) return null;
905905
return {
@@ -4066,6 +4066,9 @@ export function makeCodexAdapterV2(adapterOptions: CodexAdapterV2Options): Provi
40664066
yield* client
40674067
.request("thread/goal/set", { threadId: payload.threadId, status: "paused" })
40684068
.pipe(
4069+
Effect.catch((cause) =>
4070+
Effect.logWarning("orchestration-v2.codex-goal-pause-failed", { cause }),
4071+
),
40694072
Effect.andThen(
40704073
client.request("turn/interrupt", {
40714074
threadId: payload.threadId,

‎apps/server/src/orchestration-v2/Orchestrator.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ function isGoalCommand(message: {
370370
readonly text: string;
371371
readonly attachments: ReadonlyArray<ChatAttachment>;
372372
}): boolean {
373-
return message.attachments.length === 0 && /^\/goal(?:\s|$)/iu.test(message.text.trim());
373+
return message.attachments.length === 0 && /^\/goal(?:\s|$)/u.test(message.text.trim());
374374
}
375375

376376
const threadPullRequestLinksEqual = Schema.toEquivalence(Schema.NullOr(ThreadLinkedPullRequest));

‎apps/server/src/provider/Layers/ProviderRegistry.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,11 @@ it.layer(Layer.mergeAll(TestNodeServices, ServerSettingsModule.layerTest(), Test
446446
},
447447
]);
448448
assert.deepStrictEqual(status.slashCommands.slice(1), [
449+
{
450+
name: "goal",
451+
description: "Set a goal Codex keeps working toward until it is done",
452+
input: { hint: "Objective, or pause, resume, clear" },
453+
},
449454
{
450455
name: "feedback",
451456
description: "Send this thread and Codex logs to OpenAI",

0 commit comments

Comments
 (0)