fix(plugins): late-binding subagent runtime for non-gateway load paths (#46648)

Merged via squash.

Prepared head SHA: 44742652c9
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
This commit is contained in:
Josh Lehman
2026-03-16 14:27:54 -07:00
committed by GitHub
parent abce640772
commit eeb140b4f0
42 changed files with 555 additions and 28 deletions

View File

@@ -5,9 +5,10 @@ import type {
SetSessionConfigOptionRequest,
SetSessionModeRequest,
} from "@agentclientprotocol/sdk";
import { describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { GatewayClient } from "../gateway/client.js";
import type { EventFrame } from "../gateway/protocol/index.js";
import { resetProviderRuntimeHookCacheForTest } from "../plugins/provider-runtime.js";
import { createInMemorySessionStore } from "./session.js";
import { AcpGatewayAgent } from "./translator.js";
import { createAcpConnection, createAcpGateway } from "./translator.test-helpers.js";
@@ -119,6 +120,10 @@ async function expectOversizedPromptRejected(params: { sessionId: string; text:
sessionStore.clearAllSessionsForTest();
}
beforeEach(() => {
resetProviderRuntimeHookCacheForTest();
});
describe("acp session creation rate limit", () => {
it("rate limits excessive newSession bursts", async () => {
const sessionStore = createInMemorySessionStore();
@@ -297,7 +302,14 @@ describe("acp session UX bridge behavior", () => {
const result = await agent.loadSession(createLoadSessionRequest("agent:main:work"));
expect(result.modes?.currentModeId).toBe("high");
expect(result.modes?.availableModes.map((mode) => mode.id)).toContain("xhigh");
expect(result.modes?.availableModes.map((mode) => mode.id)).toEqual([
"off",
"minimal",
"low",
"medium",
"high",
"adaptive",
]);
expect(result.configOptions).toEqual(
expect.arrayContaining([
expect.objectContaining({