Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Add Assistant tool chain fixture

rcourtmand89257f9d85a
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 9099d1f465..c99c01d65f 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -714,6 +714,10 @@ deriving an older display status from `workflowStatusHistory`.
the real `provider_retry` workflow state, including attempt metadata and
`retry_after_ms`, so browser proof of retry countdown behavior does not
depend on external provider availability or API spend.
+ The local `tool-chain` fixture must exercise consecutive tool activity with
+ paced `tool_start` -> `tool_progress` -> `tool_end` transitions for one
+ tool followed by a second live tool, so browser proof can verify completed
+ rows compact while the next tool row replaces the active motion.
Dev/test fixture prompts are also part of the Assistant command-discovery
surface: slash autocomplete and Assistant command help must expose an
insertable `/fixture` command in development/test builds, search it by
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index f067356496..8274a79bba 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -153,6 +153,10 @@ enough for the browser to paint the intermediate state, including keeping the
`/fixture tool-burst` running tool row visible before the matching `tool_end`;
unit tests may explicitly disable that pace, but the live dev fixture must not
collapse to the terminal row.
+The `/fixture tool-chain` stream must pace consecutive
+`tool_start`/`tool_progress`/`tool_end` transitions across at least two tools,
+so browser proof can stop on a completed compact row plus the next live running
+row without a provider request.
Fixtures that emit consecutive context/read/query tool events must keep those
events as ordinary typed `tool_start` / `tool_end` activity and must not encode
obsolete grouped-context wording in fixture answer content. The fixture payload
@@ -646,7 +650,10 @@ payload shape change when the portal presents compact client rows.
provider delay between the two events, followed by a paced content/terminal
step, so browser proof can verify that fast command activity remains
perceptible without a real provider request. At least one fixture-backed
- Assistant sequence must exercise `provider_retry` with `attempt`,
+ Assistant tool sequence must exercise consecutive multi-tool activity with a
+ paced completed first row followed by a live second row, so browser proof can
+ verify replacement/compaction motion without provider timing. At least one
+ fixture-backed Assistant sequence must exercise `provider_retry` with `attempt`,
`max_attempts`, and `retry_after_ms` metadata plus a paced retry window, so
browser proof can verify visible retry countdown behavior without a real
provider request, VPN dependency, or API spend. At least one fixture-backed
diff --git a/frontend-modern/src/api/__tests__/aiChat.test.ts b/frontend-modern/src/api/__tests__/aiChat.test.ts
index bd5a98ba98..acb098e435 100644
--- a/frontend-modern/src/api/__tests__/aiChat.test.ts
+++ b/frontend-modern/src/api/__tests__/aiChat.test.ts
@@ -393,6 +393,139 @@ describe('AIChatAPI', () => {
await expect(streamPromise).resolves.toBe(true);
});
+ it('runs the tool-chain dev stream fixture without opening a provider request', async () => {
+ const onEvent = vi.fn();
+
+ await AIChatAPI.chat(
+ '/fixture tool-chain',
+ undefined,
+ 'openrouter:qwen/qwen3.7-plus',
+ onEvent,
+ );
+
+ expect(apiFetchMock).not.toHaveBeenCalled();
+ expect(onEvent.mock.calls.map(([event]) => event.type)).toEqual([
+ 'session',
+ 'workflow_state',
+ 'workflow_state',
+ 'tool_start',
+ 'tool_progress',
+ 'tool_end',
+ 'tool_start',
+ 'tool_progress',
+ 'tool_end',
+ 'content',
+ 'done',
+ ]);
+ expect(onEvent.mock.calls[0][0]).toMatchObject({
+ type: 'session',
+ data: { id: 'dev-fixture-tool-chain' },
+ });
+ expect(onEvent.mock.calls[3][0]).toMatchObject({
+ type: 'tool_start',
+ data: {
+ id: 'fixture-tool-chain-inventory',
+ name: 'pulse_query',
+ phase: 'running',
+ message: 'Reading current Pulse inventory.',
+ },
+ });
+ expect(onEvent.mock.calls[6][0]).toMatchObject({
+ type: 'tool_start',
+ data: {
+ id: 'fixture-tool-chain-read',
+ name: 'pulse_read',
+ phase: 'running',
+ message: 'Running read-only command.',
+ },
+ });
+ expect(onEvent.mock.calls[10][0]).toMatchObject({
+ type: 'done',
+ data: {
+ session_id: 'dev-fixture-tool-chain',
+ model: 'openrouter:qwen/qwen3.7-plus',
+ },
+ });
+ });
+
+ it('paces the tool-chain fixture so each live tool step is inspectable', async () => {
+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
+ const onEvent = vi.fn();
+
+ const streamPromise = maybeRunAIChatDevStreamFixture({
+ prompt: '/fixture tool-chain',
+ model: 'openrouter:deepseek/deepseek-chat',
+ onEvent,
+ stepDelayMs: 25,
+ });
+ const eventTypes = () => onEvent.mock.calls.map(([event]) => event.type);
+
+ await flushMicrotasks();
+ expect(eventTypes()).toEqual(['session']);
+
+ await vi.advanceTimersByTimeAsync(75);
+ expect(eventTypes()).toEqual([
+ 'session',
+ 'workflow_state',
+ 'workflow_state',
+ 'tool_start',
+ ]);
+
+ await vi.advanceTimersByTimeAsync(1399);
+ expect(eventTypes()).toEqual([
+ 'session',
+ 'workflow_state',
+ 'workflow_state',
+ 'tool_start',
+ ]);
+
+ await vi.advanceTimersByTimeAsync(1);
+ expect(eventTypes()).toEqual([
+ 'session',
+ 'workflow_state',
+ 'workflow_state',
+ 'tool_start',
+ 'tool_progress',
+ ]);
+
+ await vi.advanceTimersByTimeAsync(900);
+ expect(eventTypes()).toEqual([
+ 'session',
+ 'workflow_state',
+ 'workflow_state',
+ 'tool_start',
+ 'tool_progress',
+ 'tool_end',
+ ]);
+
+ await vi.advanceTimersByTimeAsync(450);
+ expect(eventTypes()).toEqual([
+ 'session',
+ 'workflow_state',
+ 'workflow_state',
+ 'tool_start',
+ 'tool_progress',
+ 'tool_end',
+ 'tool_start',
+ ]);
+
+ await vi.runAllTimersAsync();
+ await expect(streamPromise).resolves.toBe(true);
+ expect(eventTypes()).toEqual([
+ 'session',
+ 'workflow_state',
+ 'workflow_state',
+ 'tool_start',
+ 'tool_progress',
+ 'tool_end',
+ 'tool_start',
+ 'tool_progress',
+ 'tool_end',
+ 'content',
+ 'done',
+ ]);
+ });
+
it('runs the send-hold dev stream fixture without opening a provider request', async () => {
const onEvent = vi.fn();
@@ -605,6 +738,7 @@ describe('AIChatAPI', () => {
it('exports fixture names and aliases for command discovery', () => {
expect(AI_CHAT_DEV_STREAM_FIXTURE_NAMES).toContain('provider-retry');
expect(AI_CHAT_DEV_STREAM_FIXTURE_NAMES).toContain('send-hold');
+ expect(AI_CHAT_DEV_STREAM_FIXTURE_NAMES).toContain('tool-chain');
expect(AI_CHAT_DEV_STREAM_FIXTURE_NAMES).toContain('command-tool');
expect(AI_CHAT_DEV_STREAM_FIXTURE_NAMES).toContain('reasoning-leak');
expect(AI_CHAT_DEV_STREAM_FIXTURE_NAMES).not.toContain('/fixture provider-retry');
diff --git a/frontend-modern/src/api/aiChatDevStreamFixture.ts b/frontend-modern/src/api/aiChatDevStreamFixture.ts
index 41df3c9a68..bfbff05f72 100644
--- a/frontend-modern/src/api/aiChatDevStreamFixture.ts
+++ b/frontend-modern/src/api/aiChatDevStreamFixture.ts
@@ -5,6 +5,7 @@ export const AI_CHAT_DEV_STREAM_FIXTURE_PROMPTS = [
'/fixture assistant-stream',
'/fixture send-hold',
'/fixture tool-burst',
+ '/fixture tool-chain',
'/fixture reasoning-leak',
'/fixture workflow-burst',
'/fixture context-group',
@@ -351,6 +352,109 @@ const buildToolBurstFixtureEvents = (model?: string): AIChatStreamEvent[] => [
},
];
+const buildToolChainFixtureEvents = (model?: string): AIChatStreamEvent[] => [
+ {
+ type: 'session',
+ data: { id: 'dev-fixture-tool-chain' },
+ },
+ {
+ type: 'workflow_state',
+ data: {
+ phase: 'request_start',
+ message: 'Preparing Pulse context.',
+ },
+ },
+ {
+ type: 'workflow_state',
+ data: {
+ phase: 'provider_start',
+ message: 'Waiting for assistant.',
+ model: assistantFixtureModel(model),
+ },
+ },
+ {
+ type: 'tool_start',
+ data: {
+ id: 'fixture-tool-chain-inventory',
+ name: 'pulse_query',
+ input: '{"query":"current resource inventory"}',
+ raw_input: 'pulse_query(query="current resource inventory")',
+ phase: 'running',
+ message: 'Reading current Pulse inventory.',
+ },
+ },
+ {
+ type: 'tool_progress',
+ data: {
+ id: 'fixture-tool-chain-inventory',
+ name: 'pulse_query',
+ input: '{"query":"current resource inventory"}',
+ raw_input: 'pulse_query(query="current resource inventory")',
+ phase: 'running',
+ message: 'Summarizing inventory facts.',
+ },
+ },
+ {
+ type: 'tool_end',
+ data: {
+ id: 'fixture-tool-chain-inventory',
+ name: 'pulse_query',
+ input: '{"query":"current resource inventory"}',
+ raw_input: 'pulse_query(query="current resource inventory")',
+ output: '{"resources":3,"alerts":1,"source":"fixture"}',
+ success: true,
+ },
+ },
+ {
+ type: 'tool_start',
+ data: {
+ id: 'fixture-tool-chain-read',
+ name: 'pulse_read',
+ input: '{"target_host":"current_resource","command":"ls /dev | wc -l"}',
+ raw_input: 'pulse_read(target_host="current_resource", command="ls /dev | wc -l")',
+ phase: 'running',
+ message: 'Running read-only command.',
+ },
+ },
+ {
+ type: 'tool_progress',
+ data: {
+ id: 'fixture-tool-chain-read',
+ name: 'pulse_read',
+ input: '{"target_host":"current_resource","command":"ls /dev | wc -l"}',
+ raw_input: 'pulse_read(target_host="current_resource", command="ls /dev | wc -l")',
+ phase: 'running',
+ message: 'Collecting command output.',
+ },
+ },
+ {
+ type: 'tool_end',
+ data: {
+ id: 'fixture-tool-chain-read',
+ name: 'pulse_read',
+ input: '{"target_host":"current_resource","command":"ls /dev | wc -l"}',
+ raw_input: 'pulse_read(target_host="current_resource", command="ls /dev | wc -l")',
+ output: '4358',
+ success: true,
+ },
+ },
+ {
+ type: 'content',
+ data: {
+ text: 'The tool-chain fixture kept each tool start, progress update, completion, and replacement visible without opening a provider request.',
+ },
+ },
+ {
+ type: 'done',
+ data: {
+ session_id: 'dev-fixture-tool-chain',
+ model: assistantFixtureModel(model),
+ input_tokens: 97,
+ output_tokens: 35,
+ },
+ },
+];
+
const buildReasoningLeakFixtureEvents = (model?: string): AIChatStreamEvent[] => [
{
type: 'session',
@@ -1048,6 +1152,9 @@ const buildFixtureEvents = (prompt: string, model?: string): AIChatStreamEvent[]
if (normalized === '/fixture tool-burst') {
return buildToolBurstFixtureEvents(model);
}
+ if (normalized === '/fixture tool-chain') {
+ return buildToolChainFixtureEvents(model);
+ }
if (normalized === '/fixture reasoning-leak') {
return buildReasoningLeakFixtureEvents(model);
}
@@ -1133,6 +1240,17 @@ const fixtureStepDelay = (
) {
return 2400;
}
+ if (normalizedPrompt === '/fixture tool-chain') {
+ if (event.type === 'tool_start') {
+ return 1400;
+ }
+ if (event.type === 'tool_progress') {
+ return 900;
+ }
+ if (event.type === 'tool_end') {
+ return 450;
+ }
+ }
if (normalizedPrompt === '/fixture long-output' && event.type === 'content') {
return 1800;
}
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
index 966f139fda..cbf99259ef 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -911,7 +911,7 @@ describe('AIChat', () => {
role: 'assistant',
content: '',
error:
- 'Unknown Assistant fixture "/fixture typo-check". Available fixtures: devices, assistant-stream, send-hold, tool-burst, workflow-burst, context-group, status-boundary, pending-tool, command-tool, long-output, provider-retry, stream-idle, queue-hold, queue-drain, compacted-artifact, skipped-tool.',
+ 'Unknown Assistant fixture "/fixture typo-check". Available fixtures: devices, assistant-stream, send-hold, tool-burst, tool-chain, workflow-burst, context-group, status-boundary, pending-tool, command-tool, long-output, provider-retry, stream-idle, queue-hold, queue-drain, compacted-artifact, skipped-tool.',
timestamp: new Date('2026-06-05T10:00:00Z'),
model: 'openrouter:qwen/qwen3.7-plus',
streamEvents: [
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 121bd6c38b..6e75712326 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -2860,7 +2860,7 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 446,
+ "line": 450,
"heading_line": 117,
}
],