Skip to content

Commit 81e177a

Browse files
committed
fix(webapp): no watch offer on a paused queue, in the button or the chips
A paused queue can neither drain nor grow, so every condition it could watch for is a promise nothing keeps until someone resumes it.
1 parent ed8d649 commit 81e177a

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,16 @@ describe("queueAgentPageContext", () => {
244244
expect(context?.signals).toEqual([]);
245245
});
246246

247+
it("offers no watch on a paused queue, even when it is at capacity", () => {
248+
// Paused and saturated at once: nothing will drain or grow until it is resumed, so a
249+
// watch would promise an answer that can't come.
250+
const context = queueAgentPageContext(
251+
queueLoaderData({ paused: true, running: 10, queued: 40, concurrencyLimit: 10 })
252+
);
253+
254+
expect(context?.signals).toEqual([]);
255+
});
256+
247257
it("emits nothing for an unlimited queue, however deep the backlog", () => {
248258
const context = queueAgentPageContext(
249259
queueLoaderData({ concurrencyLimit: null, running: 99, queued: 99 })

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ export function queueAgentPageContext(data: unknown): AgentPageContext | undefin
210210
const health = atCapacity ? "crit" : paused || queued > 0 || waitingTooLong ? "warn" : "ok";
211211

212212
const signals: AgentPageSignal[] = [];
213-
if (atCapacity) {
213+
// Nothing to watch on a paused queue: it can neither drain nor grow until it is resumed.
214+
if (atCapacity && !paused) {
214215
// A backlog at least as deep as the limit won't clear this cycle.
215216
signals.push({ kind: "concurrency_saturation", severity: queued >= limit! ? "crit" : "warn" });
216217
}

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues_.$queueParam/route.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,11 @@ export default function Page() {
342342
tooltip="Ask why this queue is backed up"
343343
/>
344344
) : null}
345-
<WatchButton spec={queueWatchRecommendation(queue.name, { oldestWaitMs })} />
345+
{/* A paused queue can't drain or grow, so every watch it could offer is a
346+
promise nothing will keep until someone resumes it. */}
347+
{queue.paused ? null : (
348+
<WatchButton spec={queueWatchRecommendation(queue.name, { oldestWaitMs })} />
349+
)}
346350
<QueueOverrideConcurrencyButton
347351
queue={queue}
348352
environmentConcurrencyLimit={environmentConcurrencyLimit}

internal-packages/dashboard-agent/GUIDEBOOK.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Two separate mechanisms, decided differently — worth knowing before a demo.
8282
| Page | Button | Shown when |
8383
| --- | --- | --- |
8484
| Queue | Investigate | the queue is degraded: not paused, and either `running >= concurrencyLimit` with a non-empty queue, or the oldest run has waited >= 5 min |
85-
| Queue | Watch… | always |
85+
| Queue | Watch… | unless the queue is paused — a paused queue can neither drain nor grow |
8686
| Error group | Investigate this error | always |
8787
| Error group | Watch… | always |
8888
| Run (span panel) | Watch… | while the run is not in a final status |
@@ -104,7 +104,9 @@ page's live signals — a different decision from the buttons above:
104104
| `concurrency_saturation` | watch |
105105

106106
A backed-up queue therefore offers "tell me when the backlog drains", never
107-
"investigate" — the page's own Investigate button is the one that asks that.
107+
"investigate" — the page's own Investigate button is the one that asks that. A
108+
paused queue offers neither: `concurrency_saturation` is withheld while it is
109+
paused, for the same reason the button is.
108110

109111
---
110112

0 commit comments

Comments
 (0)