дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
fix(agents): start a new task with the agent the composer shows after its agent was removed (#8289)
After the selected agent was removed, the composer fell back to the first agent but Start still sent the removed id and failed with "unknown agent". Start and option changes now resolve the agent like the composer.
Цей коміт міститься в:
1 джерело
c341799768
коміт
e98eb5e755
2 files changed
+19
-12
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Заблокувати користувача