Skip to content

Commit 94a0d2e

Browse files
authored
test: align shifted main assertions (#100897)
1 parent 9997c53 commit 94a0d2e

3 files changed

Lines changed: 28 additions & 26 deletions

File tree

extensions/codex/src/app-server/thread-lifecycle.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,10 @@ describe("Codex app-server native code mode config", () => {
289289
});
290290

291291
expect(instructions).toContain("## Skill Workshop");
292-
expect(instructions).toContain(
293-
"Use `skill_workshop` when the user wants to create, update, revise, list, inspect, apply, reject, or quarantine a reusable skill, Skill Workshop proposal, playbook, workflow, procedure, or durable instruction.",
294-
);
295-
expect(instructions).toContain(
296-
"Use `action=apply`, `action=reject`, or `action=quarantine` only after the user explicitly asks to approve/use/apply, reject, or quarantine a specific proposal.",
297-
);
292+
expect(instructions).toContain("Route durable skill work");
293+
expect(instructions).toContain("through the `skill_workshop` tool");
294+
expect(instructions).toContain("Generated skills are pending proposals.");
295+
expect(instructions).toContain("only when the user explicitly asks");
298296
});
299297

300298
it("keeps developer instructions compact when no dynamic tools are deferred", () => {

src/gateway/server-channels.test.ts

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ function createManager(options?: {
186186
getRuntimeConfig?: () => Record<string, unknown>;
187187
channelIds?: ChannelId[];
188188
startupTrace?: { measure: <T>(name: string, run: () => T | Promise<T>) => Promise<T> };
189+
deferStartupAccountStartsUntil?: Promise<void>;
189190
fillChannelDependencies?: boolean;
190191
}) {
191192
const log = createSubsystemLogger("gateway/server-channels-test");
@@ -208,6 +209,9 @@ function createManager(options?: {
208209
? { resolveChannelRuntime: options.resolveChannelRuntime }
209210
: {}),
210211
...(options?.startupTrace ? { startupTrace: options.startupTrace } : {}),
212+
...(options?.deferStartupAccountStartsUntil
213+
? { deferStartupAccountStartsUntil: options.deferStartupAccountStartsUntil }
214+
: {}),
211215
});
212216
createdManagers.push({ channelIds, manager });
213217
return manager;
@@ -1247,36 +1251,37 @@ describe("server-channels auto restart", () => {
12471251
await flushMicrotasks();
12481252
});
12491253

1250-
it("does not start traced channel accounts after stop wins the handoff", async () => {
1251-
const handoffEntered = createDeferred();
1252-
const releaseHandoff = createDeferred();
1254+
it("does not start deferred channel accounts after stop wins the startup handoff", async () => {
1255+
const releaseAccountStart = createDeferred();
1256+
const measureMock = vi.fn(async (name: string, run: () => unknown) => await run());
12531257
const startupTrace = {
1254-
measure: async <T>(name: string, run: () => T | Promise<T>) => {
1255-
if (name === "channels.discord.start-account-handoff") {
1256-
handoffEntered.resolve();
1257-
await releaseHandoff.promise;
1258-
}
1259-
return await run();
1260-
},
1258+
measure: async <T>(name: string, run: () => T | Promise<T>) =>
1259+
(await measureMock(name, run)) as T,
12611260
};
12621261
const startAccount = vi.fn(async () => {});
12631262

12641263
installTestRegistry(createTestPlugin({ startAccount }));
1265-
const manager = createManager({ startupTrace });
1264+
const manager = createManager({
1265+
startupTrace,
1266+
deferStartupAccountStartsUntil: releaseAccountStart.promise,
1267+
});
12661268

1267-
await manager.startChannel("discord", DEFAULT_ACCOUNT_ID);
1268-
await waitForImmediate();
1269-
await handoffEntered.promise;
1269+
await manager.startChannels();
1270+
await flushMicrotasks();
12701271
const stopTask = manager.stopChannel("discord", DEFAULT_ACCOUNT_ID);
12711272
await flushMicrotasks();
1272-
releaseHandoff.resolve();
12731273
await stopTask;
12741274
await flushMicrotasks();
1275+
releaseAccountStart.resolve();
1276+
await flushMicrotasks();
12751277

12761278
expect(startAccount).not.toHaveBeenCalled();
1279+
expect(measureMock.mock.calls.map(([name]) => name)).not.toContain(
1280+
"channels.discord.start-account-handoff",
1281+
);
12771282
expect(
12781283
manager.getRuntimeSnapshot().channelAccounts.discord?.[DEFAULT_ACCOUNT_ID]?.running,
1279-
).toBe(false);
1284+
).not.toBe(true);
12801285
});
12811286

12821287
it("limits whole-channel account startup fanout to four", async () => {

ui/src/pages/chat/components/chat-tool-cards.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@ describe("tool-cards", () => {
142142
);
143143

144144
expect(container.textContent?.match(/Skill Workshop/g)).toHaveLength(1);
145-
expect(container.querySelector(".chat-tool-msg-body")?.textContent).not.toContain(
146-
"Skill Workshop",
147-
);
148-
expect(container.querySelector(".chat-tool-card__detail")?.textContent).toContain("create");
145+
const bodyText = container.querySelector(".chat-tool-msg-body")?.textContent ?? "";
146+
expect(bodyText).not.toContain("Skill Workshop");
147+
expect(bodyText).toContain('"action": "create"');
149148
expect(container.querySelector(".chat-tool-card__action-btn")).toBeInstanceOf(
150149
HTMLButtonElement,
151150
);

0 commit comments

Comments
 (0)