Skip to content

Commit e2596e4

Browse files
Drop duplicate New workbench row from global search (#375)
* CL-6820: Assert global search lists New workbench once * CL-6820: Drop duplicate New workbench row from global search * Drop the new-agent ACTION_COMMANDS assertion
1 parent b1b110e commit e2596e4

3 files changed

Lines changed: 29 additions & 31 deletions

File tree

‎apps/web/src/command-palette-actions.test.ts‎

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,27 @@ describe("ACTION_COMMANDS", () => {
7171
}
7272
});
7373

74-
test("new-workbench and new-agent speak consumer language, not mint", () => {
74+
test("exactly one New workbench create row — no duplicate title+destination (CL-6820)", () => {
75+
const newWorkbenchRows = ACTION_COMMANDS.filter(
76+
(c) => c.title === "New workbench",
77+
);
78+
expect(newWorkbenchRows).toHaveLength(1);
79+
expect(newWorkbenchRows[0]?.id).toBe("new-workbench");
80+
81+
const titleCounts = new Map<string, number>();
82+
for (const command of ACTION_COMMANDS) {
83+
titleCounts.set(command.title, (titleCounts.get(command.title) ?? 0) + 1);
84+
}
85+
for (const [title, count] of titleCounts) {
86+
expect(count, `duplicate title: ${title}`).toBe(1);
87+
}
88+
});
89+
90+
test("new-workbench speaks consumer language, not mint", () => {
7591
const workbench = ACTION_COMMANDS.find((c) => c.id === "new-workbench");
76-
const agent = ACTION_COMMANDS.find((c) => c.id === "new-agent");
7792
expect(workbench?.title).toBe("New workbench");
78-
expect(agent?.title).toBe("New workbench");
7993
expect(workbench?.subtitle).toBe("Start a new workbench");
80-
expect(agent?.subtitle).toBe("Start a new workbench");
8194
expect(workbench?.subtitle.toLowerCase()).not.toContain("mint");
82-
expect(agent?.subtitle.toLowerCase()).not.toContain("mint");
8395
});
8496

8597
test("labels 'New skill' to match the app's authoring model, not 'Install skill'", () => {
@@ -96,13 +108,6 @@ describe("runActionCommand", () => {
96108
expect(navigated).toEqual([NEW_WORKBENCH_PATH]);
97109
});
98110

99-
test("new-agent is the same entry point as new-workbench — opens the template picker", async () => {
100-
const { ctx, navigated, dispatched } = context({ path: "/w/abc" });
101-
await runActionCommand("new-agent", ctx);
102-
expect(dispatched).toEqual([]);
103-
expect(navigated).toEqual([NEW_WORKBENCH_PATH]);
104-
});
105-
106111
test("new-routine opens the routine panel synchronously, beside whatever page is showing — no navigation, no pending flag", async () => {
107112
const { ctx, navigated, openedRoutines } = context({ path: "/library" });
108113
await runActionCommand("new-routine", ctx);

‎apps/web/src/command-palette-actions.ts‎

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
// tasks are dispatched by Myra from inside a workbench now.
1313
//
1414
// Workbench creation is not one of those — there is no dialog to race, no
15-
// page to mount first: "new-workbench" and "new-agent" both navigate
16-
// straight to the template picker (`/new`, CL-6342 — superseding CL-6138's
17-
// direct mint for these two entry points), the same hop the sidebar's own
18-
// "+" control uses. "New thread" is out of scope (killed by owner
19-
// decision).
15+
// page to mount first: "new-workbench" navigates straight to the template
16+
// picker (`/new`, CL-6342 — superseding CL-6138's direct mint), the same
17+
// hop the sidebar's own "+" control uses. A second "new-agent" row that
18+
// said and did the same thing was dropped (CL-6820). "New thread" is out
19+
// of scope (killed by owner decision).
2020
//
2121
// "New routine" (CL-6125, reworked CL-6139) needs none of that: it opens
2222
// the canvas column's routine pane, and canvas state lives in
@@ -75,7 +75,6 @@ export function resetPendingDialogRequests(): void {
7575

7676
export type ActionCommandId =
7777
| "new-workbench"
78-
| "new-agent"
7978
| "new-routine"
8079
| "new-skill"
8180
| "upload-artifact"
@@ -101,11 +100,6 @@ export const ACTION_COMMANDS: readonly ActionCommand[] = [
101100
title: CHAT_STRINGS.newWorkbenchAction,
102101
subtitle: "Start a new workbench",
103102
},
104-
{
105-
id: "new-agent",
106-
title: CHAT_STRINGS.newWorkbenchAction,
107-
subtitle: "Start a new workbench",
108-
},
109103
{
110104
id: "new-routine",
111105
title: "New routine",
@@ -150,19 +144,18 @@ export type ActionCommandContext = {
150144
};
151145

152146
/**
153-
* Runs one action command. "new-workbench" and "new-agent" both open the
154-
* template picker (see the module doc); "new-skill" still goes through a
155-
* pending flag when the palette fires it off-route (see the module doc),
156-
* so the target page's own mount effect opens the dialog instead of a
157-
* dispatch racing against that page's not-yet-mounted listener.
147+
* Runs one action command. "new-workbench" opens the template picker (see
148+
* the module doc); "new-skill" still goes through a pending flag when the
149+
* palette fires it off-route (see the module doc), so the target page's
150+
* own mount effect opens the dialog instead of a dispatch racing against
151+
* that page's not-yet-mounted listener.
158152
*/
159153
export async function runActionCommand(
160154
id: ActionCommandId,
161155
ctx: ActionCommandContext,
162156
): Promise<void> {
163157
switch (id) {
164-
case "new-workbench":
165-
case "new-agent": {
158+
case "new-workbench": {
166159
ctx.navigate(NEW_WORKBENCH_PATH);
167160
return;
168161
}

‎apps/web/test/create-agent-panel.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ describe("agent creation entry points", () => {
362362
expect(chatPageSource).not.toContain("instant-agent-create");
363363
});
364364

365-
test("the command palette's new-workbench/new-agent open the template picker, not an instant mint (CL-6342)", () => {
365+
test("the command palette's new-workbench opens the template picker, not an instant mint (CL-6342)", () => {
366366
const commandPaletteActionsSource = readFileSync(
367367
new URL("../src/command-palette-actions.ts", import.meta.url),
368368
"utf8",

0 commit comments

Comments
 (0)