| ... | ... | @@ -891,8 +891,92 @@ describe("ProviderCommandReactor", () => { |
| 891 | 891 | expect(thread?.session?.threadId).toBe("thread-1"); |
| 892 | 892 | expect(thread?.session?.status).toBe("starting"); |
| 893 | 893 | expect(thread?.session?.runtimeMode).toBe("approval-required"); |
| 894 | expect(harness.startSession.mock.calls[0]?.[1]).not.toHaveProperty("title"); |
| 894 | 895 | }); |
| 895 | 896 | |
| 897 | effectIt.effect("forwards only a user-renamed title when starting a provider session", () => |
| 898 | Effect.gen(function* () { |
| 899 | const harness = yield* Effect.promise(() => |
| 900 | createHarness({ initialTitle: "Add a progressive blur as you scroll" }), |
| 901 | ); |
| 902 | const now = "2026-01-01T00:00:00.000Z"; |
| 903 | const modelSelection = { |
| 904 | instanceId: ProviderInstanceId.make("codex"), |
| 905 | model: "gpt-5-codex", |
| 906 | }; |
| 907 | const startTurn = (threadId: string, text: string, titleSeed: string) => |
| 908 | harness.engine.dispatch({ |
| 909 | type: "thread.turn.start", |
| 910 | commandId: CommandId.make(`cmd-title-${threadId}`), |
| 911 | threadId: ThreadId.make(threadId), |
| 912 | message: { |
| 913 | messageId: asMessageId(`message-${threadId}`), |
| 914 | role: "user", |
| 915 | text, |
| 916 | attachments: [], |
| 917 | }, |
| 918 | titleSeed, |
| 919 | interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE, |
| 920 | runtimeMode: "approval-required", |
| 921 | createdAt: now, |
| 922 | }); |
| 923 | |
| 924 | yield* startTurn( |
| 925 | "thread-1", |
| 926 | "Add a progressive blur as you scroll", |
| 927 | "Add a progressive blur as you scroll", |
| 928 | ); |
| 929 | yield* Effect.promise(() => waitFor(() => harness.startSession.mock.calls.length === 1)); |
| 930 | expect(harness.startSession.mock.calls[0]?.[1]).not.toHaveProperty("title"); |
| 931 | |
| 932 | yield* harness.engine.dispatch({ |
| 933 | type: "thread.create", |
| 934 | commandId: CommandId.make("cmd-thread-create-renamed"), |
| 935 | threadId: ThreadId.make("thread-renamed"), |
| 936 | projectId: asProjectId("project-1"), |
| 937 | title: "New thread", |
| 938 | modelSelection, |
| 939 | interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE, |
| 940 | runtimeMode: "approval-required", |
| 941 | branch: null, |
| 942 | worktreePath: null, |
| 943 | createdAt: now, |
| 944 | }); |
| 945 | yield* harness.engine.dispatch({ |
| 946 | type: "thread.meta.update", |
| 947 | commandId: CommandId.make("cmd-thread-rename"), |
| 948 | threadId: ThreadId.make("thread-renamed"), |
| 949 | title: "Keep this name", |
| 950 | }); |
| 951 | yield* startTurn("thread-renamed", "hello there", "hello there"); |
| 952 | yield* Effect.promise(() => waitFor(() => harness.startSession.mock.calls.length === 2)); |
| 953 | expect(harness.startSession.mock.calls[1]?.[1]).toMatchObject({ title: "Keep this name" }); |
| 954 | |
| 955 | yield* harness.engine.dispatch({ |
| 956 | type: "thread.create", |
| 957 | commandId: CommandId.make("cmd-thread-create-seeded"), |
| 958 | threadId: ThreadId.make("thread-seeded"), |
| 959 | projectId: asProjectId("project-1"), |
| 960 | title: "New thread", |
| 961 | modelSelection, |
| 962 | interactionMode: DEFAULT_PROVIDER_INTERACTION_MODE, |
| 963 | runtimeMode: "approval-required", |
| 964 | branch: null, |
| 965 | worktreePath: null, |
| 966 | createdAt: now, |
| 967 | }); |
| 968 | yield* harness.engine.dispatch({ |
| 969 | type: "thread.meta.update", |
| 970 | commandId: CommandId.make("cmd-thread-autotitle"), |
| 971 | threadId: ThreadId.make("thread-seeded"), |
| 972 | title: "hello there", |
| 973 | }); |
| 974 | yield* startTurn("thread-seeded", "hello there", "hello there"); |
| 975 | yield* Effect.promise(() => waitFor(() => harness.startSession.mock.calls.length === 3)); |
| 976 | expect(harness.startSession.mock.calls[2]?.[1]).not.toHaveProperty("title"); |
| 977 | }), |
| 978 | ); |
| 979 | |
| 896 | 980 | effectIt.effect("projects inline context before sending the provider turn", () => |
| 897 | 981 | Effect.gen(function* () { |
| 898 | 982 | const harness = yield* Effect.promise(() => createHarness()); |