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 queue-drain fixture

rcourtmanfc24ac0aee30
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 807bad0c99..4a94d36921 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -137,8 +137,17 @@ runtime cost control, and shared AI transport surfaces.
selected models as structured `{ providerID, modelID }` values in
`packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx` and
`packages/opencode/src/provider/provider.ts`, so Pulse must preserve the
- equivalent route identity for queued and retried turns. OpenCode's
- `DialogModel` feeds current, recent, favorite, and provider model rows into
+ equivalent route identity for queued and retried turns. Queue-drain UX
+ verification must have a deterministic local fixture path so agents can
+ test queued follow-up echo, hold, drain, and tool-row replacement without
+ opening a real provider stream. The referenced OpenCode source at fetched
+ `origin/dev` commit `31c099be435d59bd6749ace7a9f2bb2245e6d3fa` emits
+ local demo tool events through
+ `packages/opencode/src/cli/cmd/run/demo.ts` (`startTool` and `doneTool`,
+ lines 451-525; demo command routing, lines 1039-1076); Pulse adapts that by
+ keeping `/fixture queue-hold` and `/fixture queued-follow-up` fully local
+ browser fixtures for queue interaction proof. OpenCode's `DialogModel` feeds
+ current, recent, favorite, and provider model rows into
`DialogSelect`, while `DialogSelect` maintains a selected row and handles
up/down/page/home/end/return navigation. The fetched OpenCode
`origin/dev` commit `31c099be435d59bd6749ace7a9f2bb2245e6d3fa` keeps those
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 8f8126b424..7df1d1eca1 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -107,6 +107,7 @@ product API routes free of maintainer commercial analytics.
67. `internal/api/ai_intelligence_handlers.go`
68. `frontend-modern/src/api/ai.ts`
69. `frontend-modern/src/api/aiChat.ts`
+69a. `frontend-modern/src/api/aiChatDevStreamFixture.ts`
70. `frontend-modern/src/api/patrol.ts`
71. `frontend-modern/src/api/generated/aiChatEvents.ts`
72. `internal/api/agent_exec_token_binding.go`
@@ -123,6 +124,13 @@ Provider retry progress must use typed fields (`attempt`, `max_attempts`,
`retry_after_ms`) on that same event instead of frontend-only string parsing or
provider-specific ad hoc events; the Assistant UI may format those fields, but
must not invent retry progress that the stream contract did not carry.
+Assistant local stream fixtures are part of the same frontend API contract:
+`frontend-modern/src/api/aiChatDevStreamFixture.ts` may short-circuit only
+explicit `/fixture ...` prompts in development or test mode, must emit the same
+typed stream event sequence as live chat, and must never open a provider request.
+Queue verification fixtures must cover both the active hold turn and the queued
+drain turn so UX proof can exercise queued follow-up ordering and tool rows
+without consuming external model quota.
Infrastructure settings copied agent commands are a shared API/payload boundary
even when the final command string is assembled in the browser. Selected-row
diff --git a/frontend-modern/src/api/__tests__/aiChat.test.ts b/frontend-modern/src/api/__tests__/aiChat.test.ts
index 86713d135b..cbf3c3d3a7 100644
--- a/frontend-modern/src/api/__tests__/aiChat.test.ts
+++ b/frontend-modern/src/api/__tests__/aiChat.test.ts
@@ -508,6 +508,54 @@ describe('AIChatAPI', () => {
});
});
+ it('runs the queued follow-up drain fixture without opening a provider request', async () => {
+ const onEvent = vi.fn();
+
+ await AIChatAPI.chat(
+ '/fixture queued-follow-up',
+ 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_end',
+ 'content',
+ 'done',
+ ]);
+ expect(onEvent.mock.calls[0][0]).toMatchObject({
+ type: 'session',
+ data: { id: 'dev-fixture-queue-drain' },
+ });
+ expect(onEvent.mock.calls[2][0]).toMatchObject({
+ type: 'workflow_state',
+ data: {
+ phase: 'context',
+ message: 'Replaying queued turn without opening a provider request.',
+ tool: 'pulse_query',
+ },
+ });
+ expect(onEvent.mock.calls[3][0]).toMatchObject({
+ type: 'tool_start',
+ data: {
+ id: 'fixture-tool-queue-drain',
+ name: 'pulse_query',
+ },
+ });
+ expect(onEvent.mock.calls[6][0]).toMatchObject({
+ type: 'done',
+ data: {
+ session_id: 'dev-fixture-queue-drain',
+ model: 'openrouter:qwen/qwen3.7-plus',
+ },
+ });
+ });
+
it('runs the compacted-artifact dev stream fixture without opening a provider request', async () => {
const onEvent = vi.fn();
diff --git a/frontend-modern/src/api/aiChatDevStreamFixture.ts b/frontend-modern/src/api/aiChatDevStreamFixture.ts
index ac0424f573..d1f92a59f4 100644
--- a/frontend-modern/src/api/aiChatDevStreamFixture.ts
+++ b/frontend-modern/src/api/aiChatDevStreamFixture.ts
@@ -9,6 +9,7 @@ export const AI_CHAT_DEV_STREAM_FIXTURE_PROMPTS = [
'/fixture provider-retry',
'/fixture stream-idle',
'/fixture queue-hold',
+ '/fixture queue-drain',
'/fixture compacted-artifact',
'/fixture skipped-tool',
] as const;
@@ -18,6 +19,7 @@ const AI_CHAT_DEV_STREAM_FIXTURE_ALIASES: Record<
(typeof AI_CHAT_DEV_STREAM_FIXTURE_PROMPTS)[number]
> = {
'/fixture burst-tool': '/fixture tool-burst',
+ '/fixture queued-follow-up': '/fixture queue-drain',
};
const availableFixtureNames = AI_CHAT_DEV_STREAM_FIXTURE_PROMPTS.map((prompt) =>
@@ -571,7 +573,7 @@ const buildQueueHoldFixtureEvents = (model?: string): AIChatStreamEvent[] => [
{
type: 'content',
data: {
- text: 'The queue-hold fixture kept the turn active long enough to inspect queued follow-up controls.',
+ text: 'The queue-hold fixture kept the turn active long enough to inspect queued follow-up controls. Queue `/fixture queued-follow-up` while this is running to test the drain offline.',
},
},
{
@@ -585,6 +587,63 @@ const buildQueueHoldFixtureEvents = (model?: string): AIChatStreamEvent[] => [
},
];
+const buildQueueDrainFixtureEvents = (model?: string): AIChatStreamEvent[] => [
+ {
+ type: 'session',
+ data: { id: 'dev-fixture-queue-drain' },
+ },
+ {
+ type: 'workflow_state',
+ data: {
+ phase: 'request_start',
+ message: 'Draining queued follow-up through the local fixture.',
+ },
+ },
+ {
+ type: 'workflow_state',
+ data: {
+ phase: 'context',
+ message: 'Replaying queued turn without opening a provider request.',
+ tool: 'pulse_query',
+ },
+ },
+ {
+ type: 'tool_start',
+ data: {
+ id: 'fixture-tool-queue-drain',
+ name: 'pulse_query',
+ input: '{"query":"queued follow-up smoke check"}',
+ raw_input: 'pulse_query(query="queued follow-up smoke check")',
+ },
+ },
+ {
+ type: 'tool_end',
+ data: {
+ id: 'fixture-tool-queue-drain',
+ name: 'pulse_query',
+ input: '{"query":"queued follow-up smoke check"}',
+ raw_input: 'pulse_query(query="queued follow-up smoke check")',
+ output: '{"queued":true,"drained_offline":true}',
+ success: true,
+ },
+ },
+ {
+ type: 'content',
+ data: {
+ text: 'The queued follow-up drained through the local fixture without opening a provider request.',
+ },
+ },
+ {
+ type: 'done',
+ data: {
+ session_id: 'dev-fixture-queue-drain',
+ model: assistantFixtureModel(model),
+ input_tokens: 37,
+ output_tokens: 21,
+ },
+ },
+];
+
const buildCompactedArtifactFixtureEvents = (model?: string): AIChatStreamEvent[] => [
{
type: 'session',
@@ -670,6 +729,9 @@ const buildFixtureEvents = (prompt: string, model?: string): AIChatStreamEvent[]
if (normalized === '/fixture queue-hold') {
return buildQueueHoldFixtureEvents(model);
}
+ if (normalized === '/fixture queue-drain') {
+ return buildQueueDrainFixtureEvents(model);
+ }
return buildDeviceCountFixtureEvents(model);
};
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 d7b34ba2bc..33d38ba650 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
+++ b/frontend-modern/src/components/AI/Chat/__tests__/AIChat.test.tsx
@@ -840,7 +840,7 @@ describe('AIChat', () => {
role: 'assistant',
content: '',
error:
- 'Unknown Assistant fixture "/fixture typo-check". Available fixtures: devices, assistant-stream, tool-burst, context-group, pending-tool, provider-retry, stream-idle, compacted-artifact, skipped-tool.',
+ 'Unknown Assistant fixture "/fixture typo-check". Available fixtures: devices, assistant-stream, tool-burst, context-group, pending-tool, 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 0170b81933..2bf7fff2d6 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -2860,8 +2860,8 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 390,
- "heading_line": 116,
+ "line": 398,
+ "heading_line": 117,
}
],
)