chore: fixed stale executor mock sessions and spawn hint assertion

- added getEnabledToolNames to executor-driving mock sessions (renamed session api)
- task-spawn follow-up hint assertion updated from irc to hub
This commit is contained in:
can1357
2026-07-15 20:21:44 +02:00
parent d25d9300ed
commit d5cd24f39a
8 changed files with 14 additions and 1 deletions
@@ -37,6 +37,7 @@ function createMockSession(
appendSessionInit: () => {},
},
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listeners.push(listener);
@@ -31,6 +31,7 @@ function createMockSession(onPrompt: (params: { emit: (event: AgentSessionEvent)
extensionRunner: undefined,
sessionManager: { appendSessionInit: () => {} },
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async (_toolNames: string[]) => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listeners.push(listener);
@@ -62,6 +62,7 @@ function createMockSession(
extensionRunner: undefined as never,
sessionManager: { appendSessionInit: () => {} } as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listeners.push(listener);
@@ -62,6 +62,7 @@ function createMockSession(
appendSessionInit: () => {},
},
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async (_toolNames: string[]) => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listeners.push(listener);
@@ -37,6 +37,7 @@ function createHangingSession(): HangingSessionHandle {
appendSessionInit: () => {},
} as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async (_names: string[]) => {},
subscribe: (_listener: (event: AgentSessionEvent) => void) => () => {},
prompt: async (_text: string, _options?: PromptOptions) => {
@@ -123,6 +124,7 @@ describe("runSubprocess wall clock (task.maxRuntimeMs)", () => {
extensionRunner: undefined as never,
sessionManager: { appendSessionInit: () => {} } as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
// Fire a synthetic yield on the next tick to drive runSubprocess to
@@ -212,6 +214,7 @@ describe("runSubprocess wall clock (task.maxRuntimeMs)", () => {
extensionRunner: undefined as never,
sessionManager: { appendSessionInit: () => {} } as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listenerRef = listener;
@@ -289,6 +292,7 @@ describe("runSubprocess wall clock (task.maxRuntimeMs)", () => {
extensionRunner: undefined as never,
sessionManager: { appendSessionInit: () => {} } as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listenerRef = listener;
@@ -388,6 +392,7 @@ describe("runSubprocess wall clock (task.maxRuntimeMs)", () => {
extensionRunner: undefined as never,
sessionManager: { appendSessionInit: () => {} } as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listenerRef = listener;
@@ -517,6 +522,7 @@ describe("runSubprocess wall clock (task.maxRuntimeMs)", () => {
extensionRunner: undefined as never,
sessionManager: { appendSessionInit: () => {} } as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listenerRef = listener;
@@ -599,6 +605,7 @@ describe("runSubprocess wall clock (task.maxRuntimeMs)", () => {
extensionRunner: undefined as never,
sessionManager: { appendSessionInit: () => {} } as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
queueMicrotask(() => {
@@ -59,6 +59,7 @@ function createYieldingSession(): AgentSession {
appendSessionInit: () => {},
},
getActiveToolNames: () => ["yield"],
getEnabledToolNames: () => ["yield"],
setActiveToolsByName: async () => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
listeners.push(listener);
@@ -81,6 +81,7 @@ function createFakeSession(config: FakeSessionConfig = {}): FakeSessionHandle {
extensionRunner: undefined as never,
sessionManager: { appendSessionInit: () => {} } as never,
getActiveToolNames: () => ["read", "yield"],
getEnabledToolNames: () => ["read", "yield"],
setActiveToolsByName: async (_names: string[]) => {},
subscribe: (listener: (event: AgentSessionEvent) => void) => {
if (config.events?.length) {
@@ -140,7 +140,7 @@ describe("task spawn routing", () => {
expect(job!.status).toBe("completed");
expect(job!.resultText).toContain("Spawnling is now idle");
expect(job!.resultText).toContain("message it via `irc` to follow up");
expect(job!.resultText).toContain("message it via `hub` to follow up");
expect(job!.resultText).toContain("history://Spawnling");
expect(runSpy).toHaveBeenCalledTimes(1);
});