Skip to content

Commit dda1795

Browse files
committed
fix(webapp): name the saturated queue in the suggested prompt
1 parent 6eceb7b commit dda1795

2 files changed

Lines changed: 57 additions & 2 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { describe, expect, it } from "vitest";
2+
import type { AgentPageContext } from "@internal/dashboard-agent-contracts";
3+
import { contextualPromptsBySlot } from "./signal-prompts";
4+
5+
function contextWith(signal: AgentPageContext["signals"][number]): AgentPageContext {
6+
return {
7+
page: { kind: "runs" },
8+
signals: [signal],
9+
};
10+
}
11+
12+
describe("concurrency_saturation prompt", () => {
13+
it("names the queue when scope is queue", () => {
14+
const bySlot = contextualPromptsBySlot(
15+
contextWith({
16+
kind: "concurrency_saturation",
17+
severity: "crit",
18+
scope: "queue",
19+
queueName: "black-friday",
20+
}),
21+
Date.now()
22+
);
23+
24+
expect(bySlot.watch[0]?.prompt).toBe(
25+
"Why is the black-friday queue at its concurrency limit? Watch it and tell me when the backlog drains."
26+
);
27+
});
28+
29+
it("falls back to generic wording when scope is env", () => {
30+
const bySlot = contextualPromptsBySlot(
31+
contextWith({ kind: "concurrency_saturation", severity: "crit", scope: "env" }),
32+
Date.now()
33+
);
34+
35+
expect(bySlot.watch[0]?.prompt).toBe(
36+
"Concurrency is saturated right now. Watch it and tell me when the backlog drains."
37+
);
38+
});
39+
40+
it("falls back to generic wording when identity is absent", () => {
41+
const bySlot = contextualPromptsBySlot(
42+
contextWith({ kind: "concurrency_saturation", severity: "warn" }),
43+
Date.now()
44+
);
45+
46+
expect(bySlot.watch[0]?.prompt).toBe(
47+
"Concurrency is saturated right now. Watch it and tell me when the backlog drains."
48+
);
49+
});
50+
});

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,17 @@ function promptForSignal(signal: AgentPageSignal, now: number): SuggestedPrompt
7272
);
7373
}
7474

75-
case "concurrency_saturation":
75+
case "concurrency_saturation": {
76+
const why =
77+
signal.scope === "queue" && signal.queueName
78+
? `Why is the ${signal.queueName} queue at its concurrency limit?`
79+
: "Concurrency is saturated right now.";
7680
return ctx(
7781
"concurrency-saturation",
7882
"Tell me when the backlog drains",
79-
"Concurrency is saturated right now. Watch it and tell me when the backlog drains."
83+
`${why} Watch it and tell me when the backlog drains.`
8084
);
85+
}
8186
}
8287
}
8388

0 commit comments

Comments
 (0)