Skip to content
Prev Previous commit
Next Next commit
fix: preserve plugin login command precedence
  • Loading branch information
jalehman authored and obviyus committed Jul 1, 2026
commit 3a2f418db6cc8f284f202bf3cd03dc78fbffff44
2 changes: 1 addition & 1 deletion src/auto-reply/reply/commands-handlers.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import { handleWhoamiCommand } from "./commands-whoami.js";

export function loadCommandHandlers(): CommandHandler[] {
return [
handleLoginCommand,
handlePluginCommand,
handleLoginCommand,
handleDockCommand,
handleBtwCommand,
handleBashCommand,
Expand Down
8 changes: 8 additions & 0 deletions src/auto-reply/reply/commands-login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ vi.mock("../../commands/models/auth.js", () => ({

const { handleLoginCommand, testing } = await import("./commands-login.js");
const { loadCommandHandlers } = await import("./commands-handlers.runtime.js");
const { handlePluginCommand } = await import("./commands-plugin.js");

function buildLoginParams(
commandBody: string,
Expand Down Expand Up @@ -100,6 +101,13 @@ describe("handleLoginCommand", () => {
expect(loadCommandHandlers()).toContain(handleLoginCommand);
});

it("keeps plugin text commands ahead of built-in /login", () => {
const handlers = loadCommandHandlers();
expect(handlers.indexOf(handlePluginCommand)).toBeLessThan(
handlers.indexOf(handleLoginCommand),
);
});

it("starts Codex device-code login and emits the pairing code through block delivery", async () => {
const onBlockReply = vi.fn(async () => {});
mockSuccessfulLoginFlow();
Expand Down