Skip to content

Commit 2d40177

Browse files
committed
fix(webapp): a paused queue offers no backlog chips either
The page chips come from the page registry, not the signals — so hiding the saturation signal left both the investigate and the watch chip on a paused queue.
1 parent 81e177a commit 2d40177

5 files changed

Lines changed: 25 additions & 8 deletions

File tree

apps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ describe("queueAgentPageContext", () => {
206206
const context = queueAgentPageContext(queueLoaderData());
207207

208208
expect(context).toEqual({
209-
page: { kind: "queue", name: "black-friday", health: "ok" },
209+
page: { kind: "queue", name: "black-friday", health: "ok", paused: false },
210210
signals: [],
211211
});
212212
expect(agentPageContextSchema.safeParse(context).success).toBe(true);

apps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function queueAgentPageContext(data: unknown): AgentPageContext | undefin
216216
signals.push({ kind: "concurrency_saturation", severity: queued >= limit! ? "crit" : "warn" });
217217
}
218218

219-
return { page: { kind: "queue", name, health }, signals };
219+
return { page: { kind: "queue", name, health, paused: Boolean(paused) }, signals };
220220
}
221221

222222
export function deploymentsAgentPageContext(): AgentPageContext {

apps/webapp/app/components/dashboard-agent/suggested-prompts/page-prompts.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,23 @@ export function pageSlotPrompts(page: AgentPage): PageSlotPrompts {
122122

123123
case "queue":
124124
return {
125+
// A paused queue is backed up because someone paused it, and nothing it could be
126+
// watched for will happen until they resume it — so neither chip is offered.
125127
investigate:
126-
page.health === "warn" || page.health === "crit"
128+
!page.paused && (page.health === "warn" || page.health === "crit")
127129
? def(
128130
"queue-backlog-cause",
129131
"Why is this queue backed up?",
130132
queueBacklogPrompt(page.name)
131133
)
132134
: undefined,
133-
watch: def(
134-
"queue-watch-drain",
135-
"Tell me when the backlog drains",
136-
`Watch the ${page.name} queue and tell me when the backlog drains.`
137-
),
135+
watch: page.paused
136+
? undefined
137+
: def(
138+
"queue-watch-drain",
139+
"Tell me when the backlog drains",
140+
`Watch the ${page.name} queue and tell me when the backlog drains.`
141+
),
138142
status: def(
139143
"queue-backlog",
140144
"How big is the backlog?",

apps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,17 @@ describe("pageSlotPrompts", () => {
235235
}
236236
});
237237

238+
it("offers a paused queue neither chip, however unhealthy it looks", () => {
239+
// Paused reads as `warn`, so without the guard the backlog chips would both appear —
240+
// asking why a queue someone paused is backed up, and offering to watch it drain.
241+
const slots = pageSlotPrompts({ kind: "queue", name: "emails", health: "warn", paused: true });
242+
243+
expect(slots.investigate).toBeUndefined();
244+
expect(slots.watch).toBeUndefined();
245+
// The page is still explainable; only the two backlog asks are withheld.
246+
expect(slots.explain).toBeDefined();
247+
});
248+
238249
it("offers a deployment investigate chip only for a deploy that didn't land", () => {
239250
expect(pageSlotPrompts({ kind: "deployment", version: "1.0" }).investigate).toBeUndefined();
240251
expect(

internal-packages/dashboard-agent-contracts/src/page-context.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export const agentPageSchema = z.discriminatedUnion("kind", [
2020
kind: z.literal("queue"),
2121
name: z.string(),
2222
health: z.enum(["ok", "warn", "crit"]).optional(),
23+
/** A paused queue can neither drain nor grow, so it earns no watch and no backlog ask. */
24+
paused: z.boolean().optional(),
2325
}),
2426
z.object({ kind: z.literal("deployments") }),
2527
z.object({

0 commit comments

Comments
 (0)