Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai cc7b64f7f6 fix(agents): start a new task with the agent the composer shows after its agent was removed
When the agent selected for new tasks was removed, the composer and toolbar fell back to the first agent, but Start still sent the removed agent's id, so the task failed with "unknown agent <id>" until another agent was picked. Start and the composer's option changes now resolve the agent the same way the composer does.
2026-12-06 04:16:22 +08:00
2 змінених файлів з 19 додано та 12 видалено

No files matched your search

+10
Переглянути файл
@@ -160,6 +160,16 @@ const paths = [
{ name: "new task", key: HOME, send: () => startTask(), mock: backend.create },
];
describe("new task agent", () => {
it("starts with the agent the composer shows when the draft names a removed agent", async () => {
updateDraft({ provider: "removed-agent" });
updateComposer(HOME, { ...emptyDraft(), text: "hello" });
backend.create.mockResolvedValueOnce(ok(task("created")));
await startTask();
expect(backend.create).toHaveBeenCalledWith(expect.objectContaining({ provider: "codex" }));
});
});
describe.each(paths)("$name acknowledgement", (path) => {
function begin() {
const response = deferred();
+9 -12
Переглянути файл
@@ -483,11 +483,8 @@ export function draftModelSettings(
}
export function setDraftOption(id: string, value: string) {
const { draft, providers } = useAgents.getState();
const config = draftConfig(
providers.find((p) => p.id === draft.provider),
draft,
);
const { draft } = useAgents.getState();
const config = draftConfig(selectedProvider(), draft);
const model = config.find((o) => o.category === "model")?.current;
const target = config.find((o) => o.id === id);
if (model && target && isPerModelOption(target)) {
@@ -1601,15 +1598,15 @@ export async function startTask(
projectRoot: string | null = null,
worktreePath?: string | null,
): Promise<void> {
const { draft, providers } = useAgents.getState();
const { draft } = useAgents.getState();
const composer = composerDraft(HOME);
if (!canSend(composer)) return;
const started = generation;
const command = shellCommand(composer);
const options = draftConfig(
providers.find((p) => p.id === draft.provider),
draft,
);
// The agent the composer shows: a draft naming a removed agent falls back to the first one.
const provider = selectedProvider();
const providerId = provider?.id ?? draft.provider;
const options = draftConfig(provider, draft);
if (
options.some(
(o) =>
@@ -1620,7 +1617,7 @@ export async function startTask(
)
return;
const model = options.find((o) => o.category === "model")?.current;
const defaults = providerDefaults(draft.provider);
const defaults = providerDefaults(providerId);
const config = options.flatMap((o) => {
// An untouched Codex tier inherits the runtime's default; explicit Off must still be sent.
const value =
@@ -1636,7 +1633,7 @@ export async function startTask(
commands.agentCreate({
projectRoot,
prompt: promptOf(HOME, composer),
provider: draft.provider,
provider: providerId,
config,
isolation,
base: isolation === "worktree" && !reusedWorktree ? draft.base : null,