feat(webapp): dashboard agent — chat, reports, Investigate, Watch - #4418
feat(webapp): dashboard agent — chat, reports, Investigate, Watch#4418kathiekiwi wants to merge 440 commits into
Conversation
🦋 Changeset detectedLatest commit: 07b83da The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR adds a Dashboard Agent feature set. It introduces a contracts package for shared schemas (view blocks, intents, page context, watches, trigger:// URIs), a dedicated database package for chats, investigations, and watches, and core agent tool/prompt logic. It adds a watch-tick lifecycle with checks, alerts (email, Slack, webhook), and unsubscribe flows. It adds API routes for watches, alerts, queue metrics, and run diagnostics. It redesigns the chat panel UI with investigation, report, and watch cards, suggested prompts, and unread-wake notifications. It adds a Storybook demo gallery with screenshot tooling, seed scripts, and removes "Docs" links from page headers across the webapp. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
There was a problem hiding this comment.
Actionable comments posted: 8
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/route.tsx (1)
95-112: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winGuard
getPromotedDashboardAgentPromptagainst failures, and skip it when access is already false.This loader backs the entire env layout (
Outletwraps every page under this environment), so it runs on nearly every navigation.getPromotedDashboardAgentPromptis called unconditionally and unguarded — if flag evaluation/parsing ever throws, it takes down the whole environment layout for a feature that's purely cosmetic (a suggested-prompt chip). It's also wasted work wheneverhasDashboardAgentAccessisfalse, sinceDashboardAgentnever consumespromotedPromptin that case (it early-returns children without rendering the panel).🛡️ Proposed fix: gate on access and fail closed
- const promotedDashboardAgentPrompt = await getPromotedDashboardAgentPrompt({ - orgFeatureFlags: (project.organization.featureFlags as Record<string, unknown>) ?? {}, - }); + const promotedDashboardAgentPrompt = hasDashboardAgentAccess + ? await getPromotedDashboardAgentPrompt({ + orgFeatureFlags: (project.organization.featureFlags as Record<string, unknown>) ?? {}, + }).catch((error) => { + logger.error("Failed to resolve promoted dashboard agent prompt", { error }); + return undefined; + }) + : undefined;
🟡 Minor comments (13)
apps/webapp/seed-agent-examples.mts-1598-1614 (1)
1598-1614: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
?.value ? … : undefinedcollapses a legitimate zero into the fallback.
pending,donePerMin,triggeredPerMinanddrainMinutesall treat a reported0as "absent" and fall back to theSTORY.*constants. On a recovered or quiet stand the card would read 0 pending while the prose quotes 4,812 — the exact disagreement this function exists to prevent. Use a nullish check instead.🐛 Guard on presence, not truthiness
- pending: metric("pending")?.value ? Math.round(metric("pending")!.value) : undefined, + pending: metric("pending")?.value != null ? Math.round(metric("pending")!.value) : undefined, worstQueueShare: flow?.attribution?.dim === "queue" ? flow.attribution.share : undefined, - donePerMin: vm.facts?.throughput?.donePerMin + donePerMin: vm.facts?.throughput?.donePerMin != null ? Math.round(vm.facts.throughput.donePerMin) : undefined, - triggeredPerMin: vm.facts?.throughput?.triggeredPerMin + triggeredPerMin: vm.facts?.throughput?.triggeredPerMin != null ? Math.round(vm.facts.throughput.triggeredPerMin) : undefined, - drainMinutes: drain?.value ? Math.round(drain.value) : undefined, + drainMinutes: drain?.value != null ? Math.round(drain.value) : undefined,apps/webapp/seed-queue-metrics.mts-581-597 (1)
581-597: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
DELETEwithoutmutations_syncraces the seeding insert that follows.
--resetruns these deletes and then line 941 inserts immediately. The sibling seeder guards the identical sequence withSETTINGS mutations_sync = 2and explains why: left asynchronous, the re-seed races its own predecessor and leaves a second copy of the data behind. Worth settingasync_insert: 0on line 572 too, so the rows are visible to theOPTIMIZE … FINALcalls on lines 949-952.🐛 Make the reset finish before seeding
await raw.command({ - query: `DELETE FROM trigger_dev.${table} WHERE environment_id = '${environmentId}'`, + query: `DELETE FROM trigger_dev.${table} WHERE environment_id = '${environmentId}' SETTINGS mutations_sync = 2`, });apps/webapp/seed-agent-examples-chats.mts-338-339 (1)
338-339: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse the
COMPLETED_WITH_ERRORSstatus literal in the TRQL query.
Failedis not a standard run status in Trigger.dev TRQL; usestatus = 'COMPLETED_WITH_ERRORS'so the seeded failed runs are counted.apps/webapp/seed-queue-metrics.mts-1-6 (1)
1-6: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winKeep this seeder consistent with
seed-agent-examples.mts's documented interop pattern.
seed-agent-examples.mtsdisables the sibling import-entry CommonJS boundary instead of running into the documented named-import loading failure, so this script should use the same default-binding import/interworking pattern.internal-packages/dashboard-agent-contracts/src/blocks.ts-133-146 (1)
133-146: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick winRequire
http(s)on docs action targets.
targetis documented as “an https URL” fordocsactions, but the schema accepts any string. Since this field is LLM-authored UI input, prefer narrowing it tohttp://orhttps://URLs in the schema rather than leaving the contract to later validation.apps/webapp/app/services/dashboardAgentWatchChecks.ts-146-175 (1)
146-175: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMake unreliable queued wait labels include the stale-first-enqueue caveat.
For
WAITING_TO_RESUME/RETRYING_AFTER_FAILURE/PAUSED,run.queuedAtis not a current queue entry, but this path still emitswaitBasis: "queued_at"and a confidentqueued for …label. Bake the caveat into the label or omit the label whenqueueWaitReliableis false so it can’t be surfaced as a current wait time downstream.♻️ Make the label carry its own caveat
if (run.queuedAt) { const waitMs = Math.max(0, end.getTime() - run.queuedAt.getTime()); return { waitMs, waitBasis: "queued_at", - waitLabel: `queued for ${formatMs(waitMs)}`, + waitLabel: queueWaitReliable + ? `queued for ${formatMs(waitMs)}` + : `time since first enqueue: ${formatMs(waitMs)}`, queueWaitReliable, }; }apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx-163-180 (1)
163-180: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
CitationButtonrenders different elements on server vs client.
pathis alwaysnullduring SSR, so the server emits aLinkButtonanchor while the first client render emits aButton— a hydration mismatch for every same-origin citation. Compute the path fromsameOriginPathafter mount (or keep one element type and branch insideonClick).♻️ One option: single element, branch on click
function CitationButton({ url, label }: { url: string; label: string }) { const navigate = useNavigate(); - const path = typeof window === "undefined" ? null : sameOriginPath(url, window.location.origin); - - if (path) { - return ( - <Button variant="docs/small" LeadingIcon={BookOpenIcon} onClick={() => navigate(path)}> - {label} - </Button> - ); - } - return ( - <LinkButton to={url} variant="docs/small" LeadingIcon={BookOpenIcon}> + <LinkButton + to={url} + variant="docs/small" + LeadingIcon={BookOpenIcon} + onClick={(event) => { + const path = sameOriginPath(url, window.location.origin); + if (!path) return; + event.preventDefault(); + navigate(path); + }} + > {label} </LinkButton> ); }apps/webapp/app/components/dashboard-agent/DashboardAgentPanel.tsx-166-189 (1)
166-189: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winPost-mutation reloads can coalesce onto a pre-mutation request.
loadHistoryreturns the in-flight promise, so thevoid loadHistory()calls indeleteChat(Line 422) andcancelWatch(Line 452) can piggyback on a GET that was issued before the POST landed and re-render the stale list — the deleted chat reappears, or the cancelled watch chip comes back, until something else triggers a reload. Chain a fresh request after the in-flight one instead of returning it.🐛 Sketch: let callers ask for post-mutation freshness
- const loadHistory = useCallback(async () => { - if (historyInFlight.current) return historyInFlight.current; + const loadHistory = useCallback(async (options?: { fresh?: boolean }) => { + if (historyInFlight.current) { + // A reload after a mutation must not adopt a request that was already + // in flight before it — that result predates the change. + if (!options?.fresh) return historyInFlight.current; + await historyInFlight.current; + } const request = (async () => {Then call
void loadHistory({ fresh: true })fromdeleteChatandcancelWatch.apps/webapp/app/components/dashboard-agent/RunDiagnosisCard.tsx-161-177 (1)
161-177: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAn enabled button that does nothing is a real click target outside the gallery.
useRunPathreturnsundefinedwhenever org/project/env context is missing — the storybook gallery is one such case, but any future host without that context is another. A user clicking gets silence with no feedback. Preferdisabled(or a tooltip explaining why) so the inert state is honest, and keep the gallery's visual review by passing an explicit prop rather than inferring it from missing context.apps/webapp/test/dashboardAgentWatchChecks.test.ts-123-134 (1)
123-134: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAssert the label in the stale-
queuedAtcase — that's the invariant this file exists to pin.The header calls out the wait label as the thing that must never call a time-from-creation a queue wait, but this test only checks
queueWaitReliableandwaitBasis. A regression that emitted"queued for 10m"for an untrustworthyqueuedAton a resumed run would still pass. Add the label (and theresult) assertion.💚 Proposed addition
expect(outcome.facts.queueWaitReliable).toBe(false); expect(outcome.facts.waitBasis).toBe("queued_at"); + expect(outcome.result).toBe("pending"); + // Reliability is false, so the label must not claim a queue wait. + expect(outcome.facts.waitLabel).not.toMatch(/queued for/);internal-packages/dashboard-agent/src/tools.ts-429-448 (1)
429-448: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winWrap the body read so an aborted/interrupted response doesn't escape as a throw.
The
fetchcall is guarded butawait res.text()on Line 431 is not. If the 30s abort fires while the body is streaming (or the connection resets mid-body), this rejects and the throw escapessearchTriggerDocs, breaking the documented "returns{ error }" contract thatsearch_docsrelies on.🛡️ Proposed fix
if (!res.ok) return { error: `The docs search failed (status ${res.status}).` }; - const body = await res.text(); + let body: string; + try { + body = await res.text(); + } catch (error) { + return { error: `Couldn't read the docs response: ${(error as Error).message}` }; + } let payload: any;internal-packages/dashboard-agent/src/tools.ts-872-883 (1)
872-883: 🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
list_errorsdoesn't clampperiod, unlikelist_runsandlist_deploys.Lines 845 and 1096 both run the model-supplied
periodthroughclampPeriod; Line 877 forwards it raw. Unless the errors route clamps server-side, the model can request an unbounded window here.♻️ Proposed fix
execute: async ({ status, taskIdentifier, search, period, limit }) => { + const effectivePeriod = period ? clampPeriod(period) : undefined; const sp = new URLSearchParams(); if (status) sp.append("filter[status]", status); if (taskIdentifier) sp.append("filter[taskIdentifier]", taskIdentifier); if (search) sp.append("filter[search]", search); - if (period) sp.append("filter[period]", period); + if (effectivePeriod) sp.append("filter[period]", effectivePeriod);apps/webapp/app/routes/api.v1.queues.$queueParam.metrics.ts-72-78 (1)
72-78: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRounding
endMsup withMath.ceilincludes future time in the averaged window.Because
endMsis rounded up to the next bucket boundary, it can be ahead ofDate.now()by up tobucketSeconds(as much as ~1/12 of the requested period).startedPerMinand other rate fields then divide the real (bounded) count by a window that partly hasn't happened yet, systematically under-reporting throughput/rate by the same proportion.Math.floorgives identical cache-alignment benefits without ever querying/averaging over future time.🐛 Proposed fix
- const endMs = Math.ceil(Date.now() / (bucketSeconds * 1000)) * bucketSeconds * 1000; + const endMs = Math.floor(Date.now() / (bucketSeconds * 1000)) * bucketSeconds * 1000;Also applies to: 124-126
🧹 Nitpick comments (32)
apps/webapp/app/components/dashboard-agent/demo/components/DemoChartCard.tsx (1)
12-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate chart-card frame markup — parameterize
rowsinstead of reimplementing the frame for the empty state.
DemoChartCardhardcodesrows={demoChart.rows}with no way to override it, so the gallery's empty-chart state had to copy the entire border/title-strip/height JSX just to passrows={[]}.
apps/webapp/app/components/dashboard-agent/demo/components/DemoChartCard.tsx#L12-L30: accept an optionalrowsprop (defaulting todemoChart.rows) so callers can override the dataset.apps/webapp/app/routes/storybook.agent-ui/route.tsx#L300-L317: replaceEmptyChartCard's duplicated JSX with<DemoChartCard rows={[]} />(or equivalent) once the prop exists.apps/webapp/app/routes/storybook.agent-ui/route.tsx (1)
397-436: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider deriving
untrustworthyReportvia the real stale-guard function rather than hand-rolling its output shape.The comment above this block states it's "Derived exactly the way
applyStaleGuarddoes it," but the code manually reconstructs the transformation instead of calling that function. IfapplyStaleGuard(or equivalent) is exported and importable here, calling it directly would guarantee this fixture never drifts from the real stale-telemetry behavior it's meant to demonstrate.Please confirm whether the health report's stale-guard transformation (referenced as
applyStaleGuard) is exported in a form importable from this route (e.g. fromapps/webapp/app/presenters/v3/reports/health/health.ts), so this fixture could call it directly instead of duplicating its logic.apps/webapp/app/components/dashboard-agent/demo/demo.test.ts (1)
34-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThe isolation guard misses side-effect and dynamic imports.
importSpecifiersonly matches… from "x", soimport "~/foo.server"andawait import("~/db.server")slip through the very check on lines 369-378 that exists to catch them.♻️ Broaden the specifier scan
-/** Every import specifier in a file, from both `import` and `export … from`. */ +/** Every module specifier in a file: `from "x"`, `import "x"` and `import("x")`. */ function importSpecifiers(source: string): string[] { - return [...source.matchAll(/(?:import|export)[\s\S]*?from\s+["']([^"']+)["']/g)].map( - (match) => match[1]! - ); + return [ + ...source.matchAll(/from\s+["']([^"']+)["']/g), + ...source.matchAll(/\bimport\s*\(\s*["']([^"']+)["']/g), + ...source.matchAll(/\bimport\s+["']([^"']+)["']/g), + ].map((match) => match[1]!); }apps/webapp/seed-agent-examples-chats.mts (1)
257-257: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winImport
VIEW_BLOCK_VERSIONinstead of hardcodingversion: 1.The demo fixtures stamp the envelope from the contracts constant; these seeded blocks hardcode
1. If the contract version is bumped, the strict envelope schema rejects these blocks and the cards silently degrade to plain tool rows — exactly the failure mode the transcripts exist to demonstrate. The package is already imported on line 29.♻️ Use the contract constant
-import { formatTriggerUri } from "`@internal/dashboard-agent-contracts`"; +import { formatTriggerUri, VIEW_BLOCK_VERSION } from "`@internal/dashboard-agent-contracts`";- const diagnosisEnvelope = { id: `diag_${w.failedRunId}`, version: 1 }; + const diagnosisEnvelope = { id: `diag_${w.failedRunId}`, version: VIEW_BLOCK_VERSION };const failuresChart = { id: "chart_failures_by_task", revision: 0, - version: 1, + version: VIEW_BLOCK_VERSION,const pendingChart = { id: "chart_pending_runs", revision: 0, - version: 1, + version: VIEW_BLOCK_VERSION,Also applies to: 332-362
apps/webapp/test/seedAgentExamplesChats.test.ts (1)
176-178: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRead the kind with the contracts parser rather than
split("/")[4].Positional indexing silently mis-classifies if the URI layout changes — a
runURI read asreportwould skip the resolution assertion entirely, and the test would still pass.demo.test.tsusessafeParseTriggerUrifor exactly this.♻️ Parse instead of index
for (const uri of uris) { - const kind = uri.split("/")[4]; - if (UNRESOLVABLE_KINDS.includes(kind)) continue; + const parsed = safeParseTriggerUri(uri); + expect(parsed.success, uri).toBe(true); + if (!parsed.success || UNRESOLVABLE_KINDS.includes(parsed.data.kind)) continue; const resolved = resolveTriggerUri(SCOPE, uri);Add the import:
import { safeParseTriggerUri } from "`@internal/dashboard-agent-contracts`";internal-packages/dashboard-agent-contracts/src/trigger-uri.ts (1)
320-341: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueDuplicate
lineparams are silently accepted, last one wins.
trigger://…/source/abc/a.ts?line=1&line=2parses asline: 2. Everything else in the grammar rejects non-canonical input (fragments, unknown params, empty segments), so accepting a duplicate here is inconsistent and lets two different URIs mean the same resource.♻️ Reject duplicates
for (const [key, value] of params) { if (key !== "line") { return { success: false, error: `unknown query param "${key}"` }; } + if (line !== undefined) { + return { success: false, error: "duplicate query param \"line\"" }; + } + if (!/^\d+$/.test(value) || Number(value) < 1) {internal-packages/dashboard-agent/src/watch-tick.ts (1)
212-224: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
wakeActioninfers the action type from "not fired".If
isTerminalWatchStatusever admits a third terminal status (e.g.cancelled, which the contract'swatchStatusSchemaincludes), the delivery-only path producestype: "watch.expired"withid: watch:<id>:cancelled— a type/id pair that doesn't describe what happened. Switching on the status explicitly keeps that from slipping through silently.♻️ Switch on the status
function wakeAction(watch: Watch, facts: Record<string, unknown>): WatchWakeAction { const spec = watch.spec as PersistedWatchSpec; + if (watch.status !== "fired" && watch.status !== "expired") { + throw new Error(`cannot build a wake for a ${watch.status} watch`); + } return { - type: watch.status === "fired" ? "watch.fired" : "watch.expired", + type: watch.status === "fired" ? "watch.fired" : "watch.expired",internal-packages/dashboard-agent/src/dashboard-agent.eval.ts (1)
582-585: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
APICallError.isInstance(error)for provider error detection.
error.name.includes("APICallError")depends on the error name surviving any wrapping or renaming; the SDK’s provided type guard is more reliable.♻️ Use the SDK's type guard
- const infra = error instanceof Error && error.name.includes("APICallError"); + const infra = APICallError.isInstance(error);plus
import { APICallError } from "ai";internal-packages/dashboard-agent/src/dashboard-agent.test.ts (1)
429-432: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPoll the eval-enqueue side effect instead of relying on a fixed sleep.
turnAtRatewaits only 30 ms before returning calls, which can still fail when the runner is loaded. Move the assertion out of the helper and make it wait for the expected call count, e.g.vi.waitFor(() => expect(calls).toHaveLength(1), { timeout: 2000 }); for the rate-0 path keep a bounded wait on “still empty” if needed.internal-packages/dashboard-agent-contracts/src/watch.ts (1)
38-61: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider
z.discriminatedUnion("kind", [...])instead ofz.union.All five branches share a literal
kinddiscriminator, so this is a textbook case forz.discriminatedUnion. With plainz.union, an invalid payload (e.g., wrongkindor a badrunId) produces a combinedinvalid_unionerror listing every failed branch, which is noisier to surface back to the agent/tool-caller than the targeted errordiscriminatedUniongives.♻️ Proposed refactor
-export const watchSpecSchema = z.union([ +export const watchSpecSchema = z.discriminatedUnion("kind", [ watchCommonSchema .extend({ kind: z.literal("run_start"), runId: z.string() }) .merge(runStateCadenceSchema),internal-packages/dashboard-agent-db/src/queries.ts (1)
684-698: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the shared unread-wake predicate.
The same
(last_read_at is null or coalesce(fired_at, last_checked_at) > last_read_at)clause plus thestatus in ('fired','expired')+ tenancy join is repeated verbatim incountUnreadWatchWakes,listUnreadWatchWakes(Line 744), andlistChatIdsWithUnreadWakes(Line 783). One helper returning theand(...)condition keeps the wake definition single-sourced — the doc comments already assert all three share it.♻️ Sketch
+function unreadWakeCondition(params: { organizationId: string; userId: string }) { + return and( + inArray(watches.status, ["fired", "expired"]), + eq(chats.organizationId, params.organizationId), + eq(chats.userId, params.userId), + isNull(chats.deletedAt), + sql`(${chats.lastReadAt} is null or coalesce(${watches.firedAt}, ${watches.lastCheckedAt}) > ${chats.lastReadAt})` + ); +}internal-packages/dashboard-agent/VERDICTS.md (1)
104-108: 📐 Maintainability & Code Quality | 🔵 TrivialTrack the documented
queuedDurationbug.
RunPresenter.server.tscomputingqueuedDurationasstartedAt − createdAtis recorded here as knowingly unfixed, which over-reports for delayed/scheduled runs in the dashboard. Want me to open an issue so it doesn't only live in this markdown file?internal-packages/dashboard-agent/src/dashboard-agent.ts (1)
622-626: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the same non-null assertion as
withCacheBreakpointOnLast.
sanitized[sanitized.length - 1]is typedModelMessage | undefinedundernoUncheckedIndexedAccess, and it's then spread at Line 628. The helper at Line 378 already handles this with!; mirror it here so the two paths type-check identically.♻️ Proposed tweak
- const last = sanitized[sanitized.length - 1]; + const last = sanitized[sanitized.length - 1]!;internal-packages/dashboard-agent/src/tool-schemas.ts (1)
398-403: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winValidate the alert email shape in the schema.
z.string().email()makes the model's mistake a tool-validation error it can correct in-turn.♻️ Proposed change
email: z - .string() + .string() + .email() .optional() .describe("Email to alert. Omit to use the user's own account email."),apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx (1)
92-97: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
unknown[]+as neverthrows away the block contract.
blocksForreturnsunknown[], forcingblocks as neverat theViewBlockscall site, so a block-shape change in@internal/dashboard-agent-contractswon't surface at compile time here. Typing the return as the catalog's block union would keep the boundary checked.Also applies to: 222-228
apps/webapp/app/components/dashboard-agent/DashboardAgentPanel.tsx (1)
471-476: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value
?? []hands a new array down on every render.
chatWatchesgets a fresh identity each render, which flows intoDashboardAgentChat→DashboardAgentMessagesand defeats thememoonDashboardAgentTurn(itswatchesprop always compares unequal). A module-levelconst NO_WATCHES: WatchChip[] = []fallback keeps the reference stable.apps/webapp/app/components/dashboard-agent/DashboardAgentSuggestedPrompts.tsx (1)
58-65: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueName the "no page context" fallback.
The inline
{ page: { kind: "other", path: "" }, signals: [] }is a placeholder context built at the call site; a shared named constant (e.g.UNKNOWN_PAGE_CONTEXTinsuggested-prompts/registry.ts) keeps the meaning of the emptypathexplicit and reusable.As per coding guidelines: "Use named constants for sentinel or placeholder values instead of scattering raw string literals across comparisons."
Source: Coding guidelines
apps/webapp/app/components/dashboard-agent/suggested-prompts/registry.ts (1)
217-222: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
SIGNAL_PRIORITYisn't exhaustiveness-checked, and the two iterators duplicate one loop.
SIGNAL_SLOTis aRecord<AgentPageSignalKind, …>, so a new signal kind fails to compile there — butSIGNAL_PRIORITYis a bare array, and since both iterators drive off it, a kind missing from the array silently never produces a chip.contextualPromptsis alsocontextualPromptsBySlotflattened in slot order.♻️ Make the priority list exhaustive and derive the flat list
-export const SIGNAL_PRIORITY: AgentPageSignalKind[] = [ +// A tuple typed against the kind union: omitting a new kind is a compile error. +export const SIGNAL_PRIORITY = [ "fresh_failure", "waiting_run", "slow_run", "concurrency_saturation", -]; +] as const satisfies readonly AgentPageSignalKind[];export function contextualPrompts(context: AgentPageContext, now: number): SuggestedPrompt[] { - const prompts: SuggestedPrompt[] = []; - for (const kind of SIGNAL_PRIORITY) { - for (const signal of context.signals) { - if (signal.kind !== kind) continue; - const prompt = promptForSignal(signal, now); - if (prompt) prompts.push(prompt); - } - } - return prompts; + const bySlot = contextualPromptsBySlot(context, now); + return PROMPT_SLOTS.flatMap((slot) => bySlot[slot]); }Note: this changes
contextualPromptsordering from signal-priority to slot order — keep the current loop if callers depend on the former.Also applies to: 284-320
apps/webapp/app/components/dashboard-agent/ReportView.tsx (1)
37-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueComment describes a registration side effect that doesn't exist.
healthMessagesis used purely as a value in the staticCATALOGSmap on Line 89 — nothing self-registers on import. Worth correcting so a future reader doesn't assume adding an import is enough to register a new report's catalog.apps/webapp/app/components/dashboard-agent/agent-badges.tsx (1)
46-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winHand-rolled icon component signature duplicated across two files. Both files type heroicons components as a bare call signature returning
JSX.Element, which is version-sensitive (ForwardRefExoticComponent's call signature returnsReactNode) and duplicated rather than shared.
apps/webapp/app/components/dashboard-agent/agent-badges.tsx#L46-L46: change the exportedIconComponentalias toReact.ComponentType<{ className?: string }>.apps/webapp/app/components/dashboard-agent/WakeBanner.tsx#L77-L82: importIconComponentfrom./agent-badgesand typeTONE_ICONasRecord<AgentTone, IconComponent>instead of restating the signature inline.apps/webapp/app/components/dashboard-agent/suggested-prompts/dismissal.ts (1)
28-35: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDismissals are permanent and the key set is never pruned.
Every dismissed id leaves a key behind forever, including operator-controlled promoted-prompt ids that rotate. Consider storing a timestamp instead of
"1"so stale entries can expire (and a chip can come back after a while), or prune on read.apps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.test.ts (1)
192-195: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueTest name contradicts its fixture.
running: 10against aconcurrencyLimitof 10 is at the limit, not "idle under its limit" — the case being covered is "at capacity with an empty queue". Renaming keeps the boundary this test pins obvious.apps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.test.ts (1)
164-172: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
toContain("")passes vacuously if the fixture changes kind.Line 223 in this same file already uses the stronger pattern (
throw new Error("fixture changed")); the ternary here silently degrades to an assertion that can never fail. Prefer the narrowing guard for consistency.♻️ Proposed change
it("sends the full prompt text, not the short label", () => { const [failure] = resolveSuggestedPrompts(demoPageContexts.failedRun, { now: NOW }); + const page = demoPageContexts.failedRun.page; + if (page.kind !== "run") throw new Error("fixture changed"); expect(failure?.label).toBe("Why did this run fail?"); - expect(failure?.prompt).toContain( - demoPageContexts.failedRun.page.kind === "run" ? demoPageContexts.failedRun.page.runId : "" - ); + expect(failure?.prompt).toContain(page.runId); expect(failure?.prompt).toContain("12m ago"); });internal-packages/dashboard-agent/src/tools.ts (3)
596-624: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMisplaced doc block: the
renderInvestigationsdocs sit oncanonicalizeEvidence.Two doc comments are stacked here; the first (Lines 596-613, describing block stamping and
continueId) documentsrenderInvestigations, which is declared at Line 706. Move it there so tooling and readers attach it correctly.
722-779: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valueTwo
investigationblocks in one view collapse into one row.
currentInvestigationIdis assigned from the first block's upsert, so a secondinvestigationblock in the samerender_viewcall revises the first rather than creating a second investigation — both blocks then carry the same id with different revisions. If the schema permits multiple investigation blocks per view, consider rejecting that up front (or scoping the id per block) rather than silently merging.
1078-1089: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueComment says "double-encode" but the code encodes once.
Line 1081 applies
encodeURIComponenta single time (task/my-task→task%2Fmy-task), which is what the route's un-escaping expects. Reword the comment. Also worth noting: unlike the neighbouring tools, this returnsresult.dataverbatim, so any series/histogram fields in the metrics payload land straight in the model's context — consider acurateQueuein line withcurateReport.apps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.commit.ts (1)
27-37: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winParse the
gitJSON blob with zod instead of a bare cast.
deployment.gitis untyped Prisma JSON; the cast asserts a shape that is never checked, so a legacy/oddly-shaped blob would flow straight into the API response (e.g.pullRequestNumberas a string). A smallz.object({...}).partial().safeParse()keeps the response contract honest.As per coding guidelines: "Use zod for validation in packages/core and apps/webapp".
♻️ Proposed refactor
-type GitMetaBlob = { - source?: string; - commitAuthorName?: string; - commitMessage?: string; - commitRef?: string; - remoteUrl?: string; - ghUsername?: string; - pullRequestNumber?: number; - pullRequestTitle?: string; - pullRequestState?: string; -}; +const GitMetaBlob = z + .object({ + source: z.string(), + commitAuthorName: z.string(), + commitMessage: z.string(), + commitRef: z.string(), + remoteUrl: z.string(), + ghUsername: z.string(), + pullRequestNumber: z.number(), + pullRequestTitle: z.string(), + pullRequestState: z.string(), + }) + .partial();- const git = (deployment?.git ?? undefined) as GitMetaBlob | undefined; + const parsedGit = deployment?.git ? GitMetaBlob.safeParse(deployment.git) : undefined; + const git = parsedGit?.success ? parsedGit.data : undefined;Also applies to: 73-73
Source: Coding guidelines
apps/webapp/app/routes/api.v1.dashboard-agent.alerts.ts (1)
156-159: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winMap
ServiceValidationErrorfromCreateAlertChannelService.callto a 4xx response.The catch block currently treats all
CreateAlertChannelService.callfailures as 500, including user-input validation failures such as alert-channel limits. DistinguishServiceValidationErrorhere and return a 4xx, so the agent can explain the fixable failure instead of seeing an internal error.apps/webapp/test/dashboardAgentRoutes.test.ts (1)
26-29: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDead mock.
vi.mock("~/env.server")just re-exports the original module, so it has no effect — either drop it or note why the module factory is needed (e.g. to force ESM interop ordering).apps/webapp/test/dashboardAgentWatchToken.test.ts (1)
15-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueHardcoded UAT prefix can drift.
WATCH_TOKEN_PREFIXis imported buttr_uat_is literal; if the rbac package ever changes its prefix, the "disguised" tokens in the cross-rejection tests stop testing what they claim while still passing. Export/import the constant from@trigger.dev/rbacif available.apps/webapp/test/dashboardAgentWatches.test.ts (1)
371-375: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConditional assertion can pass vacuously. If
second.okwere unexpectedly true theexistingIdcheck is skipped silently. Narrow with an earlyif (second.ok || !first.ok) throw new Error(...)(orexpect.fail) before asserting.apps/webapp/app/v3/services/alerts/deliverDashboardAgentWatchAlert.server.ts (1)
411-417: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valueGuard the cast before reading
.code. Both predicates dereference anunknownvalue; a thrownnull/undefined(or a primitive) turns thecatchblock itself into aTypeError, losing the original failure. Atypeof error === "object" && error !== nullprefix makes them safe.🛡️ Proposed guard
function isWebAPIPlatformError(error: unknown): error is WebAPIPlatformError { - return (error as WebAPIPlatformError).code === ErrorCode.PlatformError; + return ( + typeof error === "object" && + error !== null && + (error as WebAPIPlatformError).code === ErrorCode.PlatformError + ); } function isWebAPIRateLimitedError(error: unknown): error is WebAPIRateLimitedError { - return (error as WebAPIRateLimitedError).code === ErrorCode.RateLimitedError; + return ( + typeof error === "object" && + error !== null && + (error as WebAPIRateLimitedError).code === ErrorCode.RateLimitedError + ); }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 32f81d27-7b23-4a54-8b29-c8916991756f
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (209)
.server-changes/dashboard-agent-first-turn-error.md.server-changes/dashboard-agent-investigate.md.server-changes/dashboard-agent-watch-alerts.md.server-changes/dashboard-agent-watches.md.server-changes/queue-metrics-api.md.server-changes/remove-header-docs-buttons.mdapps/webapp/.gitignoreapps/webapp/app/components/dashboard-agent/AgentChart.tsxapps/webapp/app/components/dashboard-agent/DashboardAgent.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentChat.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentComposer.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentContextBanner.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentDraft.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentHeader.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentHistory.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentPanel.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentSuggestedPrompts.tsxapps/webapp/app/components/dashboard-agent/InvestigateButton.tsxapps/webapp/app/components/dashboard-agent/InvestigationCard.test.tsapps/webapp/app/components/dashboard-agent/InvestigationCard.tsxapps/webapp/app/components/dashboard-agent/ReportView.test.tsapps/webapp/app/components/dashboard-agent/ReportView.tsxapps/webapp/app/components/dashboard-agent/RunDiagnosisCard.tsxapps/webapp/app/components/dashboard-agent/WakeBanner.tsxapps/webapp/app/components/dashboard-agent/WatchChips.tsxapps/webapp/app/components/dashboard-agent/WatchWakeToast.tsxapps/webapp/app/components/dashboard-agent/agent-badges.tsxapps/webapp/app/components/dashboard-agent/chat-layout.test.tsapps/webapp/app/components/dashboard-agent/chat-layout.tsxapps/webapp/app/components/dashboard-agent/dashboardAgentLauncher.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoChartCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoIntentBubble.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoInvestigationCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoReportCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoSuggestedPromptsRow.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoWatchChips.tsxapps/webapp/app/components/dashboard-agent/demo/demo-chats.tsapps/webapp/app/components/dashboard-agent/demo/demo.test.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/blocks.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/chart.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/index.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/intents.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/investigation.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/messages.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/page-context.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/reports.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/watches.tsapps/webapp/app/components/dashboard-agent/demo/ids.tsapps/webapp/app/components/dashboard-agent/demo/index.tsapps/webapp/app/components/dashboard-agent/investigate-prompts.test.tsapps/webapp/app/components/dashboard-agent/investigate-prompts.tsapps/webapp/app/components/dashboard-agent/list-row.tsxapps/webapp/app/components/dashboard-agent/message-order.test.tsapps/webapp/app/components/dashboard-agent/message-order.tsapps/webapp/app/components/dashboard-agent/navigate-target.test.tsapps/webapp/app/components/dashboard-agent/navigate-target.tsapps/webapp/app/components/dashboard-agent/page-context-types.tsapps/webapp/app/components/dashboard-agent/page-label.test.tsapps/webapp/app/components/dashboard-agent/page-label.tsapps/webapp/app/components/dashboard-agent/progress-line.test.tsapps/webapp/app/components/dashboard-agent/progress-line.tsapps/webapp/app/components/dashboard-agent/report-block-adapter.test.tsapps/webapp/app/components/dashboard-agent/report-block-adapter.tsapps/webapp/app/components/dashboard-agent/report-sparkline.tsxapps/webapp/app/components/dashboard-agent/run-id.test.tsapps/webapp/app/components/dashboard-agent/run-id.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/dismissal.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/index.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promoted.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promoted.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promotedPrompt.server.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/registry.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.tsapps/webapp/app/components/dashboard-agent/tool-labels.test.tsapps/webapp/app/components/dashboard-agent/tool-labels.tsapps/webapp/app/components/dashboard-agent/useTranscriptAutoScroll.tsapps/webapp/app/components/dashboard-agent/view-blocks.test.tsapps/webapp/app/components/dashboard-agent/view-blocks.tsapps/webapp/app/components/dashboard-agent/view-catalog.tsxapps/webapp/app/components/dashboard-agent/watch-chips.test.tsapps/webapp/app/components/dashboard-agent/watch-chips.tsapps/webapp/app/components/metrics/MiniLineChart.tsxapps/webapp/app/components/primitives/Callout.tsxapps/webapp/app/components/runs/v3/agent/AgentMessageView.tsxapps/webapp/app/hooks/useAgentPageContext.tsapps/webapp/app/presenters/v3/ApiAlertChannelPresenter.server.tsapps/webapp/app/presenters/v3/reports/health/health-messages.tsapps/webapp/app/presenters/v3/reports/health/health.tsapps/webapp/app/presenters/v3/waitingRun/waitingRunDiagnosis.server.tsapps/webapp/app/presenters/v3/waitingRun/waitingRunDiagnosis.tsapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.agents.$agentParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.apikeys/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.batches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dev-branches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors.$fingerprint/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.limits/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.prompts._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions.$sessionParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.waitpoints.tokens/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections.new/route.tsxapps/webapp/app/routes/account.tokens/route.tsxapps/webapp/app/routes/api.v1.dashboard-agent.alerts.$channelId.tsapps/webapp/app/routes/api.v1.dashboard-agent.alerts.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.$watchId.check.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.$watchId.fired.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.jwt.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.repo.snapshot.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.commit.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.waiting.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.workers.$tagName.tsapps/webapp/app/routes/api.v1.queues.$queueParam.metrics.tsapps/webapp/app/routes/resources.dashboard-agent.alerts.$channelId.unsubscribe.tsxapps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboard-agent.in.$.tsapps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboard-agent.tsapps/webapp/app/routes/storybook.agent-ui/manifest.tsapps/webapp/app/routes/storybook.agent-ui/route.tsxapps/webapp/app/routes/storybook.callout/route.tsxapps/webapp/app/services/dashboardAgentAlertContext.server.tsapps/webapp/app/services/dashboardAgentAlertUnsubscribeToken.server.tsapps/webapp/app/services/dashboardAgentHeadStart.server.tsapps/webapp/app/services/dashboardAgentWatchAlerts.server.tsapps/webapp/app/services/dashboardAgentWatchChecks.server.tsapps/webapp/app/services/dashboardAgentWatchChecks.tsapps/webapp/app/services/dashboardAgentWatchToken.server.tsapps/webapp/app/services/dashboardAgentWatches.server.tsapps/webapp/app/services/resolveTriggerUri.server.tsapps/webapp/app/services/uatRoutePreamble.server.tsapps/webapp/app/utils/handle.tsapps/webapp/app/v3/alertsWorker.server.tsapps/webapp/app/v3/featureFlags.tsapps/webapp/app/v3/services/alerts/deliverAlert.server.tsapps/webapp/app/v3/services/alerts/deliverDashboardAgentWatchAlert.server.tsapps/webapp/package.jsonapps/webapp/scripts/agent-ui-screenshots.tsapps/webapp/seed-agent-examples-chats.mtsapps/webapp/seed-agent-examples.mtsapps/webapp/seed-queue-metrics.mtsapps/webapp/test/dashboardAgentHeadStart.test.tsapps/webapp/test/dashboardAgentRoutes.test.tsapps/webapp/test/dashboardAgentWatchChecks.test.tsapps/webapp/test/dashboardAgentWatchToken.test.tsapps/webapp/test/dashboardAgentWatches.test.tsapps/webapp/test/reportHealth.test.tsapps/webapp/test/resolveTriggerUri.test.tsapps/webapp/test/seedAgentExamplesChats.test.tsapps/webapp/test/waitingRunDiagnosis.test.tsapps/webapp/vitest.config.tsinternal-packages/dashboard-agent-contracts/package.jsoninternal-packages/dashboard-agent-contracts/src/blocks.test.tsinternal-packages/dashboard-agent-contracts/src/blocks.tsinternal-packages/dashboard-agent-contracts/src/contracts.test.tsinternal-packages/dashboard-agent-contracts/src/evidence.tsinternal-packages/dashboard-agent-contracts/src/index.tsinternal-packages/dashboard-agent-contracts/src/intent.tsinternal-packages/dashboard-agent-contracts/src/page-context.tsinternal-packages/dashboard-agent-contracts/src/run-filters.tsinternal-packages/dashboard-agent-contracts/src/suggested-prompts.tsinternal-packages/dashboard-agent-contracts/src/trigger-uri.test.tsinternal-packages/dashboard-agent-contracts/src/trigger-uri.tsinternal-packages/dashboard-agent-contracts/src/watch.test.tsinternal-packages/dashboard-agent-contracts/src/watch.tsinternal-packages/dashboard-agent-contracts/tsconfig.jsoninternal-packages/dashboard-agent-contracts/vitest.config.tsinternal-packages/dashboard-agent-db/README.mdinternal-packages/dashboard-agent-db/drizzle/0002_luxuriant_king_cobra.sqlinternal-packages/dashboard-agent-db/drizzle/0003_famous_champions.sqlinternal-packages/dashboard-agent-db/drizzle/meta/0002_snapshot.jsoninternal-packages/dashboard-agent-db/drizzle/meta/0003_snapshot.jsoninternal-packages/dashboard-agent-db/drizzle/meta/_journal.jsoninternal-packages/dashboard-agent-db/package.jsoninternal-packages/dashboard-agent-db/src/ids.tsinternal-packages/dashboard-agent-db/src/index.tsinternal-packages/dashboard-agent-db/src/queries.tsinternal-packages/dashboard-agent-db/src/schema.tsinternal-packages/dashboard-agent/GUIDEBOOK.mdinternal-packages/dashboard-agent/PLAYBOOK.mdinternal-packages/dashboard-agent/VERDICTS.mdinternal-packages/dashboard-agent/package.jsoninternal-packages/dashboard-agent/src/dashboard-agent.eval.tsinternal-packages/dashboard-agent/src/dashboard-agent.test.tsinternal-packages/dashboard-agent/src/dashboard-agent.tsinternal-packages/dashboard-agent/src/index.tsinternal-packages/dashboard-agent/src/tool-schemas.tsinternal-packages/dashboard-agent/src/tools.tsinternal-packages/dashboard-agent/src/watch-tick.test.tsinternal-packages/dashboard-agent/src/watch-tick.tsinternal-packages/dashboard-agent/vitest.eval.config.tsinternal-packages/database/prisma/migrations/20260729120000_add_dashboard_agent_watch_alert_type/migration.sqlinternal-packages/database/prisma/schema.prismainternal-packages/emails/emails/alert-dashboard-agent-watch.tsxinternal-packages/emails/src/index.tsx
💤 Files with no reviewable changes (1)
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsx
There was a problem hiding this comment.
Actionable comments posted: 8
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/webapp/app/presenters/v3/ApiAlertChannelPresenter.server.ts (1)
15-22: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winGate
dashboard_agent_watchfrom API alert-channel creation.
api.v1.projects.<projectRef>.alertChannelsparsesdashboard_agent_watchviaApiCreateAlertChannel, maps it toDASHBOARD_AGENT_WATCH, and persists it in the enabled alert channel. Add the samecanAccessDashboardAgentcheck used by the web app/agent alert path before saving that type, since PAT/API users can otherwise subscribe an enabled channel to watch alerts without dashboard-agent access.
🟡 Minor comments (14)
apps/webapp/app/services/uatRoutePreamble.server.ts-31-34 (1)
31-34: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAccept case-insensitive Bearer schemes.
/^Bearer /rejects valid lowercasebearerauthorization schemes, causing UAT requests to fall through and be rejected. Match the scheme case-insensitively.Proposed fix
- ?.replace(/^Bearer /, "") + ?.replace(/^Bearer\s+/i, "")internal-packages/dashboard-agent-contracts/src/blocks.ts-470-525 (1)
470-525: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winTwo prose invariants aren't enforced alongside the two that are.
The
superRefineenforces "remediation ⇒ concluded" and "checkNext ⇒ inconclusive", but:
checkNextis guarded bylength > 0whileremediationis guarded only by!== undefined, socheckNext: []passes on aconcludedinvestigation whereasremediation: ""is rejected on an inconclusive one. The asymmetry lets a model send an emptycheckNexton any outcome.progress's description says "Only while in_progress" (Line 486) but nothing rejects it on a terminal outcome, so aconcludedcard can still carry a live-progress string that the renderer may show.Both are model-supplied fields, so the schema is the only gate.
🛠️ Proposed tightening
- if (investigation.remediation !== undefined && investigation.outcome !== "concluded") { + if (investigation.remediation?.trim() && investigation.outcome !== "concluded") { ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["remediation"], message: "Only a concluded investigation can offer a fix.", }); } - if ( - investigation.checkNext !== undefined && - investigation.checkNext.length > 0 && - investigation.outcome !== "inconclusive" - ) { + if (investigation.checkNext?.length && investigation.outcome !== "inconclusive") { ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["checkNext"], message: "`checkNext` belongs to an inconclusive investigation.", }); } + if (investigation.progress?.trim() && investigation.outcome !== "in_progress") { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + path: ["progress"], + message: "`progress` only belongs to an in_progress investigation.", + }); + }internal-packages/dashboard-agent-contracts/src/watch.ts-29-34 (1)
29-34: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
maxHoursaccepts fractional values below one cadence interval.
z.number().positive().max(24)admits e.g.0.01, which yields anexpiresAtearlier than the minimum 1-minute cadence — the first tick is then alreadyfinaland the watch immediately expires as "not met by expiry". Since this value comes from the model, an integer floor of 1 keeps the lifecycle sane.🛡️ Proposed fix
- maxHours: z.number().positive().max(WATCH_MAX_HOURS), + maxHours: z.number().int().min(1).max(WATCH_MAX_HOURS),apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsx-460-471 (1)
460-471: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winThe "Dashboard agent watches" checkbox isn't feature-gated. Every project sees this option, including orgs without dashboard-agent access, where the alert type can never fire. Consider gating it on the same access check the rest of the feature uses (surface a flag from the loader).
apps/webapp/app/v3/services/alerts/deliverDashboardAgentWatchAlert.server.ts-396-404 (1)
396-404: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winScalar fact values are never length-capped.
The doc comment promises "a cap so a big bag can't blow up an email or a Slack block", but only object values are truncated —
String(value)for a long string passes through unbounded. An oversized fact produces an invalid Slack block, which#postSlackMessagemaps toinvalid_blocks→SkipRetryError, silently dropping the notification.🐛 Proposed fix
.map(([key, value]) => ({ label: humanizeFactKey(key), - value: typeof value === "object" ? JSON.stringify(value).slice(0, 200) : String(value), + value: (typeof value === "object" ? JSON.stringify(value) : String(value)).slice(0, 200), }));apps/webapp/app/components/dashboard-agent/demo/demo-chats.ts-527-573 (1)
527-573: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
watchCreatedAndWakemixes two unrelated watch scenarios.The title ("Tell me when the backlog drains"), the intent object (
demoIntents.watch, which wrapsdemoBacklogDrainWatch.spec— 5 min checks for up to 6h, queuedemo-backlog-drain), and theheaderWatches/{kind:"watches"}items (demoWatches.activeRow, which includesdemoBacklogDrainWatch) all describe the backlog-drain watch. But the actual user message ("Tell me when the retry finishes"), assistant confirmation ("I'll check every minute for up to 2 hours"), and wake narration are all aboutdemoRunFinishedWatch(the run-retry watch) instead. The cadence numbers in the intent'soutcometext (5 min/6h) directly contradict the assistant's own text (1 min/2h) a few lines later.This reads as if the chat was repurposed from a backlog-drain story to a run-retry story without updating the title/intent/watches references.
apps/webapp/app/components/dashboard-agent/demo/demo-chats.ts-726-762 (1)
726-762: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
docsAnswertitle doesn't match its content.Title is "How do I use batchTrigger?" but the user question, the
search_docstool call, and the entire answer are about retry/exponential-backoff behavior —batchTriggeris never mentioned.🐛 Suggested fix
- title: "How do I use batchTrigger?", + title: "How do retries actually work?",apps/webapp/app/components/dashboard-agent/demo/demo-chats.ts-478-500 (1)
478-500: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
navigateRejectedIntenttitle doesn't match its content.Title is "Take me to my deployments" (a navigation request), but the actual turn is "Just fix it for me" being rejected via
demoIntents.proposeFix— unrelated to deployments or navigation. This is thehistory-list title, so it will mislead anyone browsing the demo chat registry in Storybook.🐛 Suggested fix
- title: "Take me to my deployments", + title: "Just fix it for me",apps/webapp/app/components/dashboard-agent/demo/demo-chats.ts-180-230 (1)
180-230: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
investigateConcludednarration undercounts the hypotheses it actually tested.The summary ("four tested hypotheses," line 185), the reasoning part ("Four candidates... run all four," lines 197-199), and the closing text ("Two of the four hold up," line 224) all describe a 4-hypothesis investigation. But
demoInvestigationConcludedinfixtures/investigation.ts(lines 245-286) actually has 5 hypotheses — it also includeshyp-queue-burst(validated), so 3 of 5 hold up, not 2 of 4. The remediation text (line 244, "cap the queue's concurrency...") relies on that 5th hypothesis, so the data looks like the intended/complete version and the narration is stale.For contrast, the sibling
investigateInconclusivechat correctly matches its narration to its 3-hypothesis fixture, so this looks like an oversight specific to this chat rather than an intentional simplification.🐛 Suggested fix
- reasoningPart( - "Four candidates: the provider's rate limit, a bad payload, the retry schedule, and yesterday's deploy. Each one has a check that can rule it out, so run all four before writing a conclusion." - ), + reasoningPart( + "Five candidates: the provider's rate limit, a bad payload, the retry schedule, yesterday's deploy, and the queue bursting into the provider. Each one has a check that can rule it out, so run all five before writing a conclusion." + ),and update the closing text/summary counts ("three of the five hold up") to match.
apps/webapp/app/components/dashboard-agent/demo/demo-chats.ts-575-617 (1)
575-617: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
watchExpiryAndCancelnarration miscounts the watches shown.The opening narration says: "Four watches from this conversation... One is still live... the rest have finished." But
demoWatches.row(used for bothheaderWatchesand the{kind:"watches"}item) has 5 entries, and 2 of them (demoRunFinishedWatchanddemoBacklogDrainWatch) areactive, not 1. So the actual chip row a reviewer sees will show 5 chips with 2 active ones, contradicting the "four... one still live" framing.🐛 Suggested fix
Either narrate 5 watches with 2 still live, or scope the displayed row to the 4 the story actually describes (excluding `demoBacklogDrainWatch`, which belongs to a different scenario):-{ kind: "watches", watches: demoWatches.row }, +{ kind: "watches", watches: [demoRunFinishedWatch, demoErrorRecurrenceWatch, demoHealthRecoveryWatch, demoCancelledWatch] },internal-packages/dashboard-agent/src/tools.ts-429-448 (1)
429-448: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
await res.text()can throw past the{ error }contract.The
fetchis guarded, but body reading isn't. On an abort (the 30s timeout at Line 1177) or a mid-stream socket reset,res.text()rejects and the exception escapessearchTriggerDocs, sosearch_docsthrows instead of returning{ error }— the convention this file states explicitly elsewhere ("Tools return {error}, never throw").🛡️ Proposed fix
if (!res.ok) return { error: `The docs search failed (status ${res.status}).` }; - const body = await res.text(); + let body: string; + try { + body = await res.text(); + } catch (error) { + return { error: `Couldn't read the docs response: ${(error as Error).message}` }; + } let payload: any;apps/webapp/app/components/dashboard-agent/agent-badges.tsx-46-46 (1)
46-46: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUse React’s component prop typing for the badge icon map.
@heroicons/reactexportsForwardRefExoticComponent, not a function returningJSX.Element, so the direct assignments at lines 99, 127, and 155 may failtypecheck. Type this asReact.ComponentType<{ className?: string }>instead.apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx-163-180 (1)
163-180: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winRender citation same-origin paths in a client-only SSR-safe way.
sameOriginPath(...)cannot work during SSR becauselocationis browser-only, whilewindowis falsy in the server pass. For same-origin citations, wrap this inClientOnly/SSR-safe rendering so SSR passes the browser-readyButtonbranch and avoids a new-tabLinkButtonvs clientButtonmismatch.apps/webapp/app/components/dashboard-agent/suggested-prompts/promotedPrompt.server.ts-26-36 (1)
26-36: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winIsolate the decorated flag read so the promoted chip can’t fail the environment layout.
makeFlag()readsprisma.featureFlag.findFirst()without catching Prisma failures, and this helper is awaited directly from the environment page loader. A flag-store hiccup on this optional, unsupported chip can turn the whole page into a 500, so catch and returnundefinedinstead.🛡️ Proposed fix
- const flag = makeFlag(); - const value = await flag({ - key: FEATURE_FLAG.promotedDashboardAgentPrompt, - overrides: options?.orgFeatureFlags ?? {}, - }); - - return parsePromotedPrompt(value); + try { + const flag = makeFlag(); + const value = await flag({ + key: FEATURE_FLAG.promotedDashboardAgentPrompt, + overrides: options?.orgFeatureFlags ?? {}, + }); + + return parsePromotedPrompt(value); + } catch { + // A missing promoted chip is a supported state; a flag-store hiccup must not + // fail the layout loader. + return undefined; + }
🧹 Nitpick comments (26)
apps/webapp/seed-agent-examples.mts (1)
2267-2296: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winWrap the tick in a try/catch so one transient failure doesn't end the heartbeat.
The loop awaits
heartbeatTickwith no error handling, andheartbeatTickitself has failure modes that are likely over a multi-hour run:prisma.taskRun.updateonexecutingRunId(Lines 2145-2150) throwsP2025once that row is gone (e.g. a re-seed or manual delete), and the ClickHouse insert helpers callprocess.exit(1). Net effect: the stand silently stops being refreshed and the report ages into "stale telemetry" — exactly what heartbeat mode exists to prevent.♻️ Suggested resilience for the tick loop
const counts: string[] = []; for (const env of envs) { - const result = await heartbeatTick(ch, env, started, rng, nonce, tick, mode); - counts.push( - `${env.environment.slug} +${result.runs} runs +${result.metricRows} metric rows` + - (result.pruned > 0 ? ` -${result.pruned} pruned` : "") - ); + try { + const result = await heartbeatTick(ch, env, started, rng, nonce, tick, mode); + counts.push( + `${env.environment.slug} +${result.runs} runs +${result.metricRows} metric rows` + + (result.pruned > 0 ? ` -${result.pruned} pruned` : "") + ); + } catch (error) { + counts.push( + `${env.environment.slug} tick failed: ${error instanceof Error ? error.message : error}` + ); + } }And make the executing-run touch tolerant of a missing row:
if (env.executingRunId) { - await prisma.taskRun.update({ - where: { id: env.executingRunId }, - data: { updatedAt: new Date(now) }, - }); + const { count } = await prisma.taskRun.updateMany({ + where: { id: env.executingRunId }, + data: { updatedAt: new Date(now) }, + }); + if (count === 0) env.executingRunId = null; }internal-packages/dashboard-agent/src/watch-tick.ts (1)
139-155: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winValidate
body.resultagainstwatchCheckResultSchemainstead of casting.
body.resultis cast toWatchCheckResultwith no runtime check, and only three of the four values are matched explicitly inrunWatchTick. Any unexpected string falls into thependingbranch and the watch keeps ticking until expiry. The contracts package already exports the enum schema.♻️ Proposed change
-import type { WatchCheckResult } from "`@internal/dashboard-agent-contracts`"; +import { watchCheckResultSchema } from "`@internal/dashboard-agent-contracts`"; +import type { WatchCheckResult } from "`@internal/dashboard-agent-contracts`";- if (!body?.result) return { kind: "unavailable", detail: "the check returned no result" }; - if (body.result === "unavailable") return { kind: "unavailable", detail: body.error }; - return { kind: "result", result: body.result, facts: body.facts }; + const result = watchCheckResultSchema.safeParse(body?.result); + if (!result.success) { + return { kind: "unavailable", detail: "the check returned no usable result" }; + } + if (result.data === "unavailable") return { kind: "unavailable", detail: body?.error }; + return { kind: "result", result: result.data, facts: body?.facts };internal-packages/dashboard-agent-contracts/src/watch.ts (1)
38-61: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
z.discriminatedUnion("kind", …)forwatchSpecSchema.Each variant already has a
kinddiscriminator, and this is the validated model input, so the targeted faster parsing and branch-specific validation error are worthwhile.♻️ Proposed change
-export const watchSpecSchema = z.union([ +export const watchSpecSchema = z.discriminatedUnion("kind", [internal-packages/dashboard-agent-db/src/queries.ts (1)
600-609: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
typealiases for these data shapes.
ActiveWatchSummary,UnreadWatchWake, andChatWatchContextare plain data shapes, not behavioral contracts.As per coding guidelines: "Use types over interfaces for TypeScript".
♻️ Proposed change
-export interface ActiveWatchSummary { +export type ActiveWatchSummary = {(and likewise for
UnreadWatchWake/ChatWatchContext)Also applies to: 701-709, 790-794
Source: Coding guidelines
internal-packages/dashboard-agent/VERDICTS.md (1)
70-71: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePoint the
{env}citation attrigger-uri.ts.
trigger-uri.tsis where thetrigger://URI grammar is defined and documents{env}as the RuntimeEnvironment id;page-context.tsonly defines the page-context schema.internal-packages/dashboard-agent/src/dashboard-agent.test.ts (1)
414-433: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFixed 30 ms sleep can flake on loaded CI.
onTurnCompleteenqueues asynchronously; a hard-coded delay is the only thing keeping these three assertions honest. Consider polling with a short deadline instead.♻️ Poll instead of sleeping
- await harness.sendMessage(userMessage("hi")); - // onTurnComplete enqueues after the turn-complete chunk; give it a tick. - await new Promise((r) => setTimeout(r, 30)); - return calls; + await harness.sendMessage(userMessage("hi")); + // onTurnComplete enqueues after the turn-complete chunk; wait for it (or + // settle) rather than betting on a fixed delay. + const deadline = Date.now() + 2000; + while (calls.length === 0 && Date.now() < deadline) { + await new Promise((r) => setTimeout(r, 10)); + } + return calls;Note the rate-0 case still needs a short settle window, so keep a small final tick for it.
apps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.commit.ts (1)
66-73: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winSecond deployment lookup is redundant and replica-lag prone.
resolveRunCommitalready reads the deployment row withgitselected on the primary (apps/webapp/app/services/dashboardAgent.server.tsLines 224–229), then this route re-reads the same row from$replicakeyed by version. Besides the extra query, a freshly created deployment that resolved on the primary may not be visible on the replica yet, silently droppingshortCode/deployedAt/gitfrom the response. Consider havingresolveRunCommitreturn the git metadata (andshortCode/deployedAt) it already has.apps/webapp/test/dashboardAgentRoutes.test.ts (1)
26-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThis
env.servermock is a no-op that still loads the real module.
importOriginal()evaluates~/env.server, so its env-var validation runs and the suite depends on the ambient environment — while the mock itself changes nothing. Either drop thevi.mockentirely or return explicit stub values for the keys the routes read.As per path instructions: "Do not import
env.server.tsdirectly or indirectly into test files; instead pass environment-dependent values through options/parameters to make code testable".Source: Path instructions
apps/webapp/test/dashboardAgentWatches.test.ts (2)
83-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDon't import
env.serverin the test; pass the signing secret in.
envis only used at Line 676 to readSESSION_SECRETforsignDashboardAgentWatchToken. Use a literal test secret so the suite doesn't depend on the real env module loading and validating.As per coding guidelines: "Test files must not import
app/env.server.ts; pass configuration as options instead."♻️ Proposed change
-const { env } = await import("~/env.server"); +const TEST_SESSION_SECRET = "test-session-secret";function tokenFor(watchId: string, expiresAt: Date) { - return signDashboardAgentWatchToken(env.SESSION_SECRET, { watchId, expiresAt }); + return signDashboardAgentWatchToken(TEST_SESSION_SECRET, { watchId, expiresAt }); }Note: the route verifies with the real
env.SESSION_SECRET, so this only works if the route's secret is also injected or the test setsprocess.env.SESSION_SECRETbefore import — worth confirming which seam you prefer.Source: Coding guidelines
92-104: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueLexicographic migration ordering is fragile.
readdirSync().sort()matches the journal order only while every filename keeps a zero-padded numeric prefix.drizzle/meta/_journal.jsonis the authoritative order — readingidx/tagfrom it would make this replay correct by construction rather than by convention.apps/webapp/app/services/dashboardAgentWatchChecks.ts (1)
102-122: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the shared
FINAL_RUN_STATUSESset for run terminality.
FINAL_STATUSESduplicatesapps/webapp/app/v3/taskStatus.FINAL_RUN_STATUSESand can silently drift if a terminal status changes. Since this file only imports isomorphic utilities forErrorIdand durations, avoid importing the mostly server-side~/v3/taskStatusmodule here; instead split the shared status constants/constants into an isomorphic helper and import it from this module.apps/webapp/app/routes/api.v1.queues.$queueParam.metrics.ts (1)
23-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNarrow
UNIT_MSso period multiplications stay type-exact.
UNIT_MSis annotated asRecord<string, number>, and these app configs enablestrictmode but notnoUncheckedIndexedAccess, so the*inUNIT_MS[p.slice(-1)]andUNIT_MS.dis typed asnumberregardless of the actual key set. Use a keyedPeriodUnitvalue and narrow the index so the compiler rejects invalid suffixes before they can affect the refiner orperiodMs().Also applies to: 42-44
apps/webapp/app/routes/storybook.agent-ui/route.tsx (1)
437-459: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winOrphaned doc comment: the URI-resolver doc is attached to
investigationBlock.The block at Lines 437-441 documents
fixtureResolveUri, but that function is defined at Line 518; here it sits immediately above a second JSDoc forinvestigationBlock, leaving two stacked comments and the resolver undocumented at its definition.♻️ Move the resolver doc to its definition
-/** - * The gallery's stand-in for the panel's URI resolver. In the app the host - * resolves against the real environment (`resolveTriggerUri.server.ts`); here a - * fixture resolver proves the seam exists without a project route. - */ /** * The demo investigation fixtures, as the real `investigation` block: the demoAnd at Line 518:
+/** + * The gallery's stand-in for the panel's URI resolver. In the app the host + * resolves against the real environment (`resolveTriggerUri.server.ts`); here a + * fixture resolver proves the seam exists without a project route. + */ function fixtureResolveUri(uri: string): { label: string; url: string } | null {apps/webapp/scripts/agent-ui-screenshots.ts (1)
220-243: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low valuePanel presence check may short-circuit when the panel is in the DOM but hidden.
openPanelreturns early oncount() > 0, so if the panel element persists while closed (e.g. mounted but translated/hidden), the launcher is never clicked and the subsequentcapture(panel)screenshots a collapsed element. Gating on visibility instead is more robust for the chat walk.🛠️ Gate on visibility
- const panel = page.locator(PANEL_SELECTOR); - if (!(await panel.count())) { + const panel = page.locator(PANEL_SELECTOR); + if (!(await panel.isVisible().catch(() => false))) {apps/webapp/app/components/dashboard-agent/demo/fixtures/intents.ts (1)
71-74: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid duplicating the investigation id as a string literal.
investigationId: "demo:investigation-order-receipt"duplicates whatfixtures/investigation.tsalready computes asdemoId("investigation-order-receipt")fordemoInvestigationConcluded. Importing that value avoids silent drift if the investigation fixture's id is ever renamed.♻️ Suggested fix
-import { isExecutableIntent, type AgentIntent } from "`@internal/dashboard-agent-contracts`"; +import { isExecutableIntent, type AgentIntent } from "`@internal/dashboard-agent-contracts`"; +import { demoInvestigationConcluded } from "./investigation"; import { DEMO_WORLD, demoRunUri } from "../ids"; ... export const demoProposeFixIntent = demoIntent( - { kind: "propose_fix", investigationId: "demo:investigation-order-receipt" }, + { kind: "propose_fix", investigationId: demoInvestigationConcluded.investigationId }, "Rejected: proposing a fix isn't available yet" );apps/webapp/app/components/dashboard-agent/RunDiagnosisCard.tsx (1)
79-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRaw indigo palette classes bypass the theme-remapping layer. Both new styles hardcode Tailwind palette classes, while
agent-badges.tsx(lines 30-31) andreport-sparkline.tsx(lines 39-40) added in this same PR explicitly state that palette classes are tuned for the dark theme only and that semantic tokens are what the theme layer remaps.
apps/webapp/app/components/dashboard-agent/RunDiagnosisCard.tsx#L79-L81: replaceLINK_STYLE'stext-indigo-500 hover:text-indigo-400with thetext-text-linktoken already used byInvestigationCard.tsx(line 89) andReportFooterLink.apps/webapp/app/components/primitives/Callout.tsx#L63-L70: give theagentvariant a semantic token (e.g. acallout-agenttoken alongside the existingcallout-docs/callout-pricingtokens) instead ofborder-indigo-500/20,bg-indigo-500/10andtext-indigo-500.apps/webapp/app/components/primitives/Callout.tsx (1)
63-70: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRaw indigo palette classes won't be remapped by the theme layer.
Every other variant in this map uses semantic tokens (
callout-docs,success,warning,error); theagentframe and icon hardcodeindigo-500. See the consolidated note withRunDiagnosisCard.tsxfor the shared fix.apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx (1)
117-140: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRaw
"output-error"string literal comparison.
p.state === "output-error"is compared as a raw literal here; the same literal is duplicated inreport-block-adapter.tsandAgentMessageView.tsx. See consolidated comment for a shared-constant suggestion.Source: Coding guidelines
apps/webapp/app/components/dashboard-agent/chat-layout.tsx (1)
236-284: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
ChatToolRow/ChatStatusLinedon't self-apply the transcript inset when mounted loose.Per rule 2 in this file's own docstring, a micro-layout mounted outside a
ChatTurnmust apply the inset itself (ChatProgress,ChatPendingTool,ChatNoteall do this viauseInsetClass()).ChatToolRowandChatStatusLinedon't calluseInsetClass(), so if either is ever mounted loose (e.g. a tool row under a card), it will render without the horizontal inset, breaking alignment with the rest of the transcript. Neither is exercised in this diff yet, so confirm whether they're intentionally turn-only.apps/webapp/app/components/dashboard-agent/report-block-adapter.ts (1)
50-56: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRaw
"output-available"string literal comparison.Same sentinel-value pattern as in
DashboardAgentMessages.tsxandAgentMessageView.tsx— see consolidated comment.Source: Coding guidelines
apps/webapp/app/components/runs/v3/agent/AgentMessageView.tsx (2)
164-188: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRaw tool-part state string literals.
This function is the biggest concentration of raw AI-SDK tool-part state comparisons (
"output-error","input-streaming","input-available","approval-requested","approval-responded","output-denied") in the reviewed diff. See consolidated comment for a shared-constant suggestion.Source: Coding guidelines
1-1: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winExtract shared named constants for AI-SDK tool-part state strings.
AgentMessageView.tsx,DashboardAgentMessages.tsx, andreport-block-adapter.tseach independently comparep.stateagainst raw literals ("output-error","output-available","input-streaming","input-available","approval-requested","approval-responded","output-denied").progress-line.ts'sIN_FLIGHT_TOOL_STATESalready shows the right pattern for two of these; extending it (or a sibling constants module) to cover the rest would remove the duplication and the risk of a typo silently breaking one of these comparisons in a state machine that several files rely on independently.
apps/webapp/app/components/runs/v3/agent/AgentMessageView.tsx#L164-188: replace the raw"output-error","input-streaming","input-available","approval-requested","approval-responded","output-denied"literals with shared named constants.apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx#L117-140: replace the raw"output-error"literal inrenderDashboardPartwith the same shared constant.apps/webapp/app/components/dashboard-agent/report-block-adapter.ts#L50-56: replace the raw"output-available"literal with the same shared constant.Source: Coding guidelines
apps/webapp/app/presenters/v3/waitingRun/waitingRunDiagnosis.server.ts (1)
153-161: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueCarry-forward seed of
0can understate early buckets.Buckets before the first emission are filled with
0rather than left unknown, so a queue whose first metric row lands mid-window renders a fake "empty then spike" shape in the sparkline.sampleBucketsprotects the ETA, but the series itself is user-visible. Consider starting from the first observed bucket (e.g. skip leading positions untilbyIndexhas a value, or backfill with the first known depth).apps/webapp/app/components/dashboard-agent/suggested-prompts/registry.ts (1)
217-222: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
SIGNAL_PRIORITYis not exhaustiveness-checked, unlikeSIGNAL_SLOT.Both
contextualPromptsandcontextualPromptsBySlotiterateSIGNAL_PRIORITY, so a signal kind added to the contract but omitted here produces no chip at all — silently, sinceAgentPageSignalKind[]accepts a partial list.SIGNAL_SLOT(aRecord) would fail to compile in the same situation; make the priority list fail the same way.♻️ Force a compile error on a missing kind
-export const SIGNAL_PRIORITY: AgentPageSignalKind[] = [ +export const SIGNAL_PRIORITY = [ "fresh_failure", "waiting_run", "slow_run", "concurrency_saturation", -]; +] as const satisfies readonly AgentPageSignalKind[] & + Record<0 | 1 | 2 | 3, AgentPageSignalKind>;Simpler alternative: derive it from the
SIGNAL_SLOTkeys and sort, or add a type-level assertion that the union ofSIGNAL_PRIORITY[number]equalsAgentPageSignalKind.apps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.test.ts (1)
164-172: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThis assertion becomes a tautology if the fixture's page kind changes.
toContain("")always passes, so the branch is silently self-disabling — exactly the case thethrow new Error("fixture changed")guards elsewhere in this file (lines 223, 228) exist to prevent. Narrow first instead.💚 Proposed fix
- const [failure] = resolveSuggestedPrompts(demoPageContexts.failedRun, { now: NOW }); - - expect(failure?.label).toBe("Why did this run fail?"); - expect(failure?.prompt).toContain( - demoPageContexts.failedRun.page.kind === "run" ? demoPageContexts.failedRun.page.runId : "" - ); - expect(failure?.prompt).toContain("12m ago"); + const page = demoPageContexts.failedRun.page; + if (page.kind !== "run") throw new Error("fixture changed"); + const [failure] = resolveSuggestedPrompts(demoPageContexts.failedRun, { now: NOW }); + + expect(failure?.label).toBe("Why did this run fail?"); + expect(failure?.prompt).toContain(page.runId); + expect(failure?.prompt).toContain("12m ago");apps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.ts (1)
67-67: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueTruncation drops the docs chip, contradicting the "always last, always present" invariant.
slice(0, CAP)cuts from the tail, and docs is the last slot. Today the cap presumably equals the slot count, so nothing is dropped — but ifSUGGESTED_PROMPT_CAPis ever lowered, the documented guarantee (this file's header, andregistry.tsline 14) silently breaks in favour of a lower-priority chip. Reserving the docs slot before the cap, or assertingCAP >= PROMPT_SLOTS.length + 1at module load, keeps the invariant honest.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1060fc18-ba04-495e-8289-4498890ecfe7
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (209)
.server-changes/dashboard-agent-first-turn-error.md.server-changes/dashboard-agent-investigate.md.server-changes/dashboard-agent-watch-alerts.md.server-changes/dashboard-agent-watches.md.server-changes/queue-metrics-api.md.server-changes/remove-header-docs-buttons.mdapps/webapp/.gitignoreapps/webapp/app/components/dashboard-agent/AgentChart.tsxapps/webapp/app/components/dashboard-agent/DashboardAgent.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentChat.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentComposer.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentContextBanner.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentDraft.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentHeader.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentHistory.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentPanel.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentSuggestedPrompts.tsxapps/webapp/app/components/dashboard-agent/InvestigateButton.tsxapps/webapp/app/components/dashboard-agent/InvestigationCard.test.tsapps/webapp/app/components/dashboard-agent/InvestigationCard.tsxapps/webapp/app/components/dashboard-agent/ReportView.test.tsapps/webapp/app/components/dashboard-agent/ReportView.tsxapps/webapp/app/components/dashboard-agent/RunDiagnosisCard.tsxapps/webapp/app/components/dashboard-agent/WakeBanner.tsxapps/webapp/app/components/dashboard-agent/WatchChips.tsxapps/webapp/app/components/dashboard-agent/WatchWakeToast.tsxapps/webapp/app/components/dashboard-agent/agent-badges.tsxapps/webapp/app/components/dashboard-agent/chat-layout.test.tsapps/webapp/app/components/dashboard-agent/chat-layout.tsxapps/webapp/app/components/dashboard-agent/dashboardAgentLauncher.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoChartCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoIntentBubble.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoInvestigationCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoReportCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoSuggestedPromptsRow.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoWatchChips.tsxapps/webapp/app/components/dashboard-agent/demo/demo-chats.tsapps/webapp/app/components/dashboard-agent/demo/demo.test.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/blocks.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/chart.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/index.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/intents.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/investigation.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/messages.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/page-context.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/reports.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/watches.tsapps/webapp/app/components/dashboard-agent/demo/ids.tsapps/webapp/app/components/dashboard-agent/demo/index.tsapps/webapp/app/components/dashboard-agent/investigate-prompts.test.tsapps/webapp/app/components/dashboard-agent/investigate-prompts.tsapps/webapp/app/components/dashboard-agent/list-row.tsxapps/webapp/app/components/dashboard-agent/message-order.test.tsapps/webapp/app/components/dashboard-agent/message-order.tsapps/webapp/app/components/dashboard-agent/navigate-target.test.tsapps/webapp/app/components/dashboard-agent/navigate-target.tsapps/webapp/app/components/dashboard-agent/page-context-types.tsapps/webapp/app/components/dashboard-agent/page-label.test.tsapps/webapp/app/components/dashboard-agent/page-label.tsapps/webapp/app/components/dashboard-agent/progress-line.test.tsapps/webapp/app/components/dashboard-agent/progress-line.tsapps/webapp/app/components/dashboard-agent/report-block-adapter.test.tsapps/webapp/app/components/dashboard-agent/report-block-adapter.tsapps/webapp/app/components/dashboard-agent/report-sparkline.tsxapps/webapp/app/components/dashboard-agent/run-id.test.tsapps/webapp/app/components/dashboard-agent/run-id.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/dismissal.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/index.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promoted.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promoted.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promotedPrompt.server.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/registry.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.tsapps/webapp/app/components/dashboard-agent/tool-labels.test.tsapps/webapp/app/components/dashboard-agent/tool-labels.tsapps/webapp/app/components/dashboard-agent/useTranscriptAutoScroll.tsapps/webapp/app/components/dashboard-agent/view-blocks.test.tsapps/webapp/app/components/dashboard-agent/view-blocks.tsapps/webapp/app/components/dashboard-agent/view-catalog.tsxapps/webapp/app/components/dashboard-agent/watch-chips.test.tsapps/webapp/app/components/dashboard-agent/watch-chips.tsapps/webapp/app/components/metrics/MiniLineChart.tsxapps/webapp/app/components/primitives/Callout.tsxapps/webapp/app/components/runs/v3/agent/AgentMessageView.tsxapps/webapp/app/hooks/useAgentPageContext.tsapps/webapp/app/presenters/v3/ApiAlertChannelPresenter.server.tsapps/webapp/app/presenters/v3/reports/health/health-messages.tsapps/webapp/app/presenters/v3/reports/health/health.tsapps/webapp/app/presenters/v3/waitingRun/waitingRunDiagnosis.server.tsapps/webapp/app/presenters/v3/waitingRun/waitingRunDiagnosis.tsapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.agents.$agentParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.apikeys/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.batches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dev-branches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors.$fingerprint/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.limits/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.prompts._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions.$sessionParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.waitpoints.tokens/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections.new/route.tsxapps/webapp/app/routes/account.tokens/route.tsxapps/webapp/app/routes/api.v1.dashboard-agent.alerts.$channelId.tsapps/webapp/app/routes/api.v1.dashboard-agent.alerts.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.$watchId.check.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.$watchId.fired.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.jwt.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.repo.snapshot.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.commit.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.waiting.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.workers.$tagName.tsapps/webapp/app/routes/api.v1.queues.$queueParam.metrics.tsapps/webapp/app/routes/resources.dashboard-agent.alerts.$channelId.unsubscribe.tsxapps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboard-agent.in.$.tsapps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboard-agent.tsapps/webapp/app/routes/storybook.agent-ui/manifest.tsapps/webapp/app/routes/storybook.agent-ui/route.tsxapps/webapp/app/routes/storybook.callout/route.tsxapps/webapp/app/services/dashboardAgentAlertContext.server.tsapps/webapp/app/services/dashboardAgentAlertUnsubscribeToken.server.tsapps/webapp/app/services/dashboardAgentHeadStart.server.tsapps/webapp/app/services/dashboardAgentWatchAlerts.server.tsapps/webapp/app/services/dashboardAgentWatchChecks.server.tsapps/webapp/app/services/dashboardAgentWatchChecks.tsapps/webapp/app/services/dashboardAgentWatchToken.server.tsapps/webapp/app/services/dashboardAgentWatches.server.tsapps/webapp/app/services/resolveTriggerUri.server.tsapps/webapp/app/services/uatRoutePreamble.server.tsapps/webapp/app/utils/handle.tsapps/webapp/app/v3/alertsWorker.server.tsapps/webapp/app/v3/featureFlags.tsapps/webapp/app/v3/services/alerts/deliverAlert.server.tsapps/webapp/app/v3/services/alerts/deliverDashboardAgentWatchAlert.server.tsapps/webapp/package.jsonapps/webapp/scripts/agent-ui-screenshots.tsapps/webapp/seed-agent-examples-chats.mtsapps/webapp/seed-agent-examples.mtsapps/webapp/seed-queue-metrics.mtsapps/webapp/test/dashboardAgentHeadStart.test.tsapps/webapp/test/dashboardAgentRoutes.test.tsapps/webapp/test/dashboardAgentWatchChecks.test.tsapps/webapp/test/dashboardAgentWatchToken.test.tsapps/webapp/test/dashboardAgentWatches.test.tsapps/webapp/test/reportHealth.test.tsapps/webapp/test/resolveTriggerUri.test.tsapps/webapp/test/seedAgentExamplesChats.test.tsapps/webapp/test/waitingRunDiagnosis.test.tsapps/webapp/vitest.config.tsinternal-packages/dashboard-agent-contracts/package.jsoninternal-packages/dashboard-agent-contracts/src/blocks.test.tsinternal-packages/dashboard-agent-contracts/src/blocks.tsinternal-packages/dashboard-agent-contracts/src/contracts.test.tsinternal-packages/dashboard-agent-contracts/src/evidence.tsinternal-packages/dashboard-agent-contracts/src/index.tsinternal-packages/dashboard-agent-contracts/src/intent.tsinternal-packages/dashboard-agent-contracts/src/page-context.tsinternal-packages/dashboard-agent-contracts/src/run-filters.tsinternal-packages/dashboard-agent-contracts/src/suggested-prompts.tsinternal-packages/dashboard-agent-contracts/src/trigger-uri.test.tsinternal-packages/dashboard-agent-contracts/src/trigger-uri.tsinternal-packages/dashboard-agent-contracts/src/watch.test.tsinternal-packages/dashboard-agent-contracts/src/watch.tsinternal-packages/dashboard-agent-contracts/tsconfig.jsoninternal-packages/dashboard-agent-contracts/vitest.config.tsinternal-packages/dashboard-agent-db/README.mdinternal-packages/dashboard-agent-db/drizzle/0002_luxuriant_king_cobra.sqlinternal-packages/dashboard-agent-db/drizzle/0003_famous_champions.sqlinternal-packages/dashboard-agent-db/drizzle/meta/0002_snapshot.jsoninternal-packages/dashboard-agent-db/drizzle/meta/0003_snapshot.jsoninternal-packages/dashboard-agent-db/drizzle/meta/_journal.jsoninternal-packages/dashboard-agent-db/package.jsoninternal-packages/dashboard-agent-db/src/ids.tsinternal-packages/dashboard-agent-db/src/index.tsinternal-packages/dashboard-agent-db/src/queries.tsinternal-packages/dashboard-agent-db/src/schema.tsinternal-packages/dashboard-agent/GUIDEBOOK.mdinternal-packages/dashboard-agent/PLAYBOOK.mdinternal-packages/dashboard-agent/VERDICTS.mdinternal-packages/dashboard-agent/package.jsoninternal-packages/dashboard-agent/src/dashboard-agent.eval.tsinternal-packages/dashboard-agent/src/dashboard-agent.test.tsinternal-packages/dashboard-agent/src/dashboard-agent.tsinternal-packages/dashboard-agent/src/index.tsinternal-packages/dashboard-agent/src/tool-schemas.tsinternal-packages/dashboard-agent/src/tools.tsinternal-packages/dashboard-agent/src/watch-tick.test.tsinternal-packages/dashboard-agent/src/watch-tick.tsinternal-packages/dashboard-agent/vitest.eval.config.tsinternal-packages/database/prisma/migrations/20260729120000_add_dashboard_agent_watch_alert_type/migration.sqlinternal-packages/database/prisma/schema.prismainternal-packages/emails/emails/alert-dashboard-agent-watch.tsxinternal-packages/emails/src/index.tsx
💤 Files with no reviewable changes (1)
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1060fc18-ba04-495e-8289-4498890ecfe7
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (210)
.server-changes/dashboard-agent-first-turn-error.md.server-changes/dashboard-agent-investigate.md.server-changes/dashboard-agent-watch-alerts.md.server-changes/dashboard-agent-watches.md.server-changes/queue-metrics-api.md.server-changes/remove-header-docs-buttons.mdapps/webapp/.gitignoreapps/webapp/app/components/dashboard-agent/AgentChart.tsxapps/webapp/app/components/dashboard-agent/DashboardAgent.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentChat.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentComposer.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentContextBanner.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentDraft.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentHeader.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentHistory.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentPanel.tsxapps/webapp/app/components/dashboard-agent/DashboardAgentSuggestedPrompts.tsxapps/webapp/app/components/dashboard-agent/InvestigateButton.tsxapps/webapp/app/components/dashboard-agent/InvestigationCard.test.tsapps/webapp/app/components/dashboard-agent/InvestigationCard.tsxapps/webapp/app/components/dashboard-agent/ReportView.test.tsapps/webapp/app/components/dashboard-agent/ReportView.tsxapps/webapp/app/components/dashboard-agent/RunDiagnosisCard.tsxapps/webapp/app/components/dashboard-agent/WakeBanner.tsxapps/webapp/app/components/dashboard-agent/WatchChips.tsxapps/webapp/app/components/dashboard-agent/WatchWakeToast.tsxapps/webapp/app/components/dashboard-agent/agent-badges.tsxapps/webapp/app/components/dashboard-agent/chat-layout.test.tsapps/webapp/app/components/dashboard-agent/chat-layout.tsxapps/webapp/app/components/dashboard-agent/dashboardAgentLauncher.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoChartCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoIntentBubble.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoInvestigationCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoReportCard.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoSuggestedPromptsRow.tsxapps/webapp/app/components/dashboard-agent/demo/components/DemoWatchChips.tsxapps/webapp/app/components/dashboard-agent/demo/demo-chats.tsapps/webapp/app/components/dashboard-agent/demo/demo.test.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/blocks.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/chart.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/index.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/intents.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/investigation.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/messages.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/page-context.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/reports.tsapps/webapp/app/components/dashboard-agent/demo/fixtures/watches.tsapps/webapp/app/components/dashboard-agent/demo/ids.tsapps/webapp/app/components/dashboard-agent/demo/index.tsapps/webapp/app/components/dashboard-agent/investigate-prompts.test.tsapps/webapp/app/components/dashboard-agent/investigate-prompts.tsapps/webapp/app/components/dashboard-agent/list-row.tsxapps/webapp/app/components/dashboard-agent/message-order.test.tsapps/webapp/app/components/dashboard-agent/message-order.tsapps/webapp/app/components/dashboard-agent/navigate-target.test.tsapps/webapp/app/components/dashboard-agent/navigate-target.tsapps/webapp/app/components/dashboard-agent/page-context-types.tsapps/webapp/app/components/dashboard-agent/page-label.test.tsapps/webapp/app/components/dashboard-agent/page-label.tsapps/webapp/app/components/dashboard-agent/progress-line.test.tsapps/webapp/app/components/dashboard-agent/progress-line.tsapps/webapp/app/components/dashboard-agent/report-block-adapter.test.tsapps/webapp/app/components/dashboard-agent/report-block-adapter.tsapps/webapp/app/components/dashboard-agent/report-sparkline.tsxapps/webapp/app/components/dashboard-agent/run-id.test.tsapps/webapp/app/components/dashboard-agent/run-id.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/dismissal.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/index.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promoted.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promoted.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/promotedPrompt.server.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/registry.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.test.tsapps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.tsapps/webapp/app/components/dashboard-agent/tool-labels.test.tsapps/webapp/app/components/dashboard-agent/tool-labels.tsapps/webapp/app/components/dashboard-agent/useTranscriptAutoScroll.tsapps/webapp/app/components/dashboard-agent/view-blocks.test.tsapps/webapp/app/components/dashboard-agent/view-blocks.tsapps/webapp/app/components/dashboard-agent/view-catalog.tsxapps/webapp/app/components/dashboard-agent/watch-chips.test.tsapps/webapp/app/components/dashboard-agent/watch-chips.tsapps/webapp/app/components/metrics/MiniLineChart.tsxapps/webapp/app/components/primitives/Callout.tsxapps/webapp/app/components/runs/v3/agent/AgentMessageView.tsxapps/webapp/app/hooks/useAgentPageContext.tsapps/webapp/app/presenters/v3/ApiAlertChannelPresenter.server.tsapps/webapp/app/presenters/v3/reports/health/health-messages.tsapps/webapp/app/presenters/v3/reports/health/health.tsapps/webapp/app/presenters/v3/waitingRun/waitingRunDiagnosis.server.tsapps/webapp/app/presenters/v3/waitingRun/waitingRunDiagnosis.tsapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.agents.$agentParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.apikeys/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.batches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dev-branches/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors.$fingerprint/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.limits/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.prompts._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions.$sessionParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.waitpoints.tokens/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections._index/route.tsxapps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections.new/route.tsxapps/webapp/app/routes/account.tokens/route.tsxapps/webapp/app/routes/api.v1.dashboard-agent.alerts.$channelId.tsapps/webapp/app/routes/api.v1.dashboard-agent.alerts.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.$watchId.check.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.$watchId.fired.tsapps/webapp/app/routes/api.v1.dashboard-agent.watches.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.jwt.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.repo.snapshot.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.commit.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.waiting.tsapps/webapp/app/routes/api.v1.projects.$projectRef.$env.workers.$tagName.tsapps/webapp/app/routes/api.v1.queues.$queueParam.metrics.tsapps/webapp/app/routes/resources.dashboard-agent.alerts.$channelId.unsubscribe.tsxapps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboard-agent.in.$.tsapps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboard-agent.tsapps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsxapps/webapp/app/routes/storybook.agent-ui/manifest.tsapps/webapp/app/routes/storybook.agent-ui/route.tsxapps/webapp/app/routes/storybook.callout/route.tsxapps/webapp/app/services/dashboardAgentAlertContext.server.tsapps/webapp/app/services/dashboardAgentAlertUnsubscribeToken.server.tsapps/webapp/app/services/dashboardAgentHeadStart.server.tsapps/webapp/app/services/dashboardAgentWatchAlerts.server.tsapps/webapp/app/services/dashboardAgentWatchChecks.server.tsapps/webapp/app/services/dashboardAgentWatchChecks.tsapps/webapp/app/services/dashboardAgentWatchToken.server.tsapps/webapp/app/services/dashboardAgentWatches.server.tsapps/webapp/app/services/resolveTriggerUri.server.tsapps/webapp/app/services/uatRoutePreamble.server.tsapps/webapp/app/utils/handle.tsapps/webapp/app/v3/alertsWorker.server.tsapps/webapp/app/v3/featureFlags.tsapps/webapp/app/v3/services/alerts/deliverAlert.server.tsapps/webapp/app/v3/services/alerts/deliverDashboardAgentWatchAlert.server.tsapps/webapp/package.jsonapps/webapp/scripts/agent-ui-screenshots.tsapps/webapp/seed-agent-examples-chats.mtsapps/webapp/seed-agent-examples.mtsapps/webapp/seed-queue-metrics.mtsapps/webapp/test/dashboardAgentHeadStart.test.tsapps/webapp/test/dashboardAgentRoutes.test.tsapps/webapp/test/dashboardAgentWatchChecks.test.tsapps/webapp/test/dashboardAgentWatchToken.test.tsapps/webapp/test/dashboardAgentWatches.test.tsapps/webapp/test/reportHealth.test.tsapps/webapp/test/resolveTriggerUri.test.tsapps/webapp/test/seedAgentExamplesChats.test.tsapps/webapp/test/waitingRunDiagnosis.test.tsapps/webapp/vitest.config.tsinternal-packages/dashboard-agent-contracts/package.jsoninternal-packages/dashboard-agent-contracts/src/blocks.test.tsinternal-packages/dashboard-agent-contracts/src/blocks.tsinternal-packages/dashboard-agent-contracts/src/contracts.test.tsinternal-packages/dashboard-agent-contracts/src/evidence.tsinternal-packages/dashboard-agent-contracts/src/index.tsinternal-packages/dashboard-agent-contracts/src/intent.tsinternal-packages/dashboard-agent-contracts/src/page-context.tsinternal-packages/dashboard-agent-contracts/src/run-filters.tsinternal-packages/dashboard-agent-contracts/src/suggested-prompts.tsinternal-packages/dashboard-agent-contracts/src/trigger-uri.test.tsinternal-packages/dashboard-agent-contracts/src/trigger-uri.tsinternal-packages/dashboard-agent-contracts/src/watch.test.tsinternal-packages/dashboard-agent-contracts/src/watch.tsinternal-packages/dashboard-agent-contracts/tsconfig.jsoninternal-packages/dashboard-agent-contracts/vitest.config.tsinternal-packages/dashboard-agent-db/README.mdinternal-packages/dashboard-agent-db/drizzle/0002_luxuriant_king_cobra.sqlinternal-packages/dashboard-agent-db/drizzle/0003_famous_champions.sqlinternal-packages/dashboard-agent-db/drizzle/meta/0002_snapshot.jsoninternal-packages/dashboard-agent-db/drizzle/meta/0003_snapshot.jsoninternal-packages/dashboard-agent-db/drizzle/meta/_journal.jsoninternal-packages/dashboard-agent-db/package.jsoninternal-packages/dashboard-agent-db/src/ids.tsinternal-packages/dashboard-agent-db/src/index.tsinternal-packages/dashboard-agent-db/src/queries.tsinternal-packages/dashboard-agent-db/src/schema.tsinternal-packages/dashboard-agent/GUIDEBOOK.mdinternal-packages/dashboard-agent/PLAYBOOK.mdinternal-packages/dashboard-agent/VERDICTS.mdinternal-packages/dashboard-agent/package.jsoninternal-packages/dashboard-agent/src/dashboard-agent.eval.tsinternal-packages/dashboard-agent/src/dashboard-agent.test.tsinternal-packages/dashboard-agent/src/dashboard-agent.tsinternal-packages/dashboard-agent/src/index.tsinternal-packages/dashboard-agent/src/tool-schemas.tsinternal-packages/dashboard-agent/src/tools.tsinternal-packages/dashboard-agent/src/watch-tick.test.tsinternal-packages/dashboard-agent/src/watch-tick.tsinternal-packages/dashboard-agent/vitest.eval.config.tsinternal-packages/database/prisma/migrations/20260729120000_add_dashboard_agent_watch_alert_type/migration.sqlinternal-packages/database/prisma/schema.prismainternal-packages/emails/emails/alert-dashboard-agent-watch.tsxinternal-packages/emails/src/index.tsx
💤 Files with no reviewable changes (1)
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsx
🚧 Files skipped from review as they are similar to previous changes (189)
- .server-changes/dashboard-agent-watches.md
- apps/webapp/app/components/dashboard-agent/investigate-prompts.test.ts
- .server-changes/dashboard-agent-first-turn-error.md
- .server-changes/queue-metrics-api.md
- apps/webapp/app/routes/storybook.callout/route.tsx
- .server-changes/remove-header-docs-buttons.md
- apps/webapp/app/components/dashboard-agent/InvestigationCard.test.ts
- apps/webapp/app/components/dashboard-agent/progress-line.test.ts
- apps/webapp/app/components/dashboard-agent/tool-labels.ts
- internal-packages/dashboard-agent-db/drizzle/0003_famous_champions.sql
- apps/webapp/app/components/dashboard-agent/suggested-prompts/promoted.ts
- apps/webapp/app/components/dashboard-agent/page-context-types.ts
- internal-packages/dashboard-agent-db/src/ids.ts
- apps/webapp/app/components/dashboard-agent/page-label.test.ts
- .server-changes/dashboard-agent-investigate.md
- internal-packages/dashboard-agent-db/src/index.ts
- apps/webapp/app/components/dashboard-agent/demo/components/DemoWatchChips.tsx
- internal-packages/dashboard-agent-db/package.json
- apps/webapp/app/components/dashboard-agent/run-id.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test/route.tsx
- apps/webapp/app/components/dashboard-agent/demo/fixtures/index.ts
- internal-packages/dashboard-agent-db/drizzle/0002_luxuriant_king_cobra.sql
- apps/webapp/vitest.config.ts
- apps/webapp/app/presenters/v3/reports/health/health.ts
- apps/webapp/app/components/dashboard-agent/suggested-prompts/index.ts
- apps/webapp/.gitignore
- apps/webapp/app/components/dashboard-agent/ReportView.test.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.waitpoints.tokens/route.tsx
- apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections._index/route.tsx
- apps/webapp/app/components/dashboard-agent/message-order.test.ts
- internal-packages/dashboard-agent-contracts/src/index.ts
- apps/webapp/app/components/dashboard-agent/InvestigateButton.tsx
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dev-branches/route.tsx
- .server-changes/dashboard-agent-watch-alerts.md
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors.$fingerprint/route.tsx
- internal-packages/dashboard-agent-contracts/package.json
- apps/webapp/app/services/uatRoutePreamble.server.ts
- apps/webapp/app/components/dashboard-agent/demo/fixtures/intents.ts
- internal-packages/dashboard-agent/src/index.ts
- apps/webapp/app/v3/alertsWorker.server.ts
- apps/webapp/app/hooks/useAgentPageContext.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts/route.tsx
- apps/webapp/app/components/dashboard-agent/demo/components/DemoChartCard.tsx
- apps/webapp/app/components/metrics/MiniLineChart.tsx
- internal-packages/dashboard-agent/vitest.eval.config.ts
- apps/webapp/app/components/dashboard-agent/DashboardAgentHeader.tsx
- internal-packages/dashboard-agent-contracts/tsconfig.json
- internal-packages/database/prisma/schema.prisma
- apps/webapp/app/components/dashboard-agent/tool-labels.test.ts
- apps/webapp/app/services/dashboardAgentAlertContext.server.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.apikeys/route.tsx
- apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx
- apps/webapp/app/routes/api.v1.projects.$projectRef.$env.repo.snapshot.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions/route.tsx
- apps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.ts
- apps/webapp/app/components/dashboard-agent/suggested-prompts/dismissal.ts
- apps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.commit.ts
- apps/webapp/package.json
- apps/webapp/app/components/dashboard-agent/navigate-target.test.ts
- apps/webapp/app/routes/api.v1.projects.$projectRef.$env.workers.$tagName.ts
- apps/webapp/app/components/dashboard-agent/demo/index.ts
- internal-packages/dashboard-agent-db/drizzle/meta/_journal.json
- internal-packages/dashboard-agent-contracts/src/evidence.ts
- internal-packages/dashboard-agent-contracts/src/intent.ts
- internal-packages/dashboard-agent-contracts/src/page-context.ts
- apps/webapp/test/dashboardAgentHeadStart.test.ts
- apps/webapp/app/components/dashboard-agent/progress-line.ts
- apps/webapp/app/components/dashboard-agent/view-blocks.ts
- apps/webapp/app/components/dashboard-agent/WakeBanner.tsx
- apps/webapp/app/components/dashboard-agent/demo/components/DemoSuggestedPromptsRow.tsx
- apps/webapp/app/components/dashboard-agent/DashboardAgentDraft.tsx
- apps/webapp/app/components/primitives/Callout.tsx
- apps/webapp/app/routes/account.tokens/route.tsx
- apps/webapp/app/components/dashboard-agent/navigate-target.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions._index/route.tsx
- apps/webapp/app/components/dashboard-agent/investigate-prompts.ts
- apps/webapp/test/dashboardAgentWatchToken.test.ts
- apps/webapp/app/components/dashboard-agent/demo/components/DemoIntentBubble.tsx
- apps/webapp/app/routes/api.v1.dashboard-agent.alerts.$channelId.ts
- apps/webapp/app/utils/handle.ts
- apps/webapp/app/components/dashboard-agent/demo/components/DemoReportCard.tsx
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments/route.tsx
- internal-packages/dashboard-agent-contracts/vitest.config.ts
- apps/webapp/app/components/dashboard-agent/watch-chips.test.ts
- apps/webapp/app/components/dashboard-agent/demo/fixtures/reports.ts
- apps/webapp/app/components/dashboard-agent/demo/demo-chats.ts
- internal-packages/dashboard-agent/package.json
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.batches/route.tsx
- internal-packages/dashboard-agent-db/README.md
- apps/webapp/test/reportHealth.test.ts
- apps/webapp/app/components/dashboard-agent/DashboardAgentComposer.tsx
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions.$sessionParam/route.tsx
- apps/webapp/test/resolveTriggerUri.test.ts
- apps/webapp/app/routes/api.v1.dashboard-agent.watches.ts
- apps/webapp/app/components/dashboard-agent/demo/fixtures/chart.ts
- apps/webapp/app/components/runs/v3/agent/AgentMessageView.tsx
- internal-packages/emails/src/index.tsx
- apps/webapp/app/components/dashboard-agent/dashboardAgentLauncher.tsx
- internal-packages/dashboard-agent-contracts/src/run-filters.ts
- apps/webapp/app/presenters/v3/ApiAlertChannelPresenter.server.ts
- apps/webapp/app/components/dashboard-agent/suggested-prompts/promoted.test.ts
- apps/webapp/app/presenters/v3/reports/health/health-messages.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.alerts.new/route.tsx
- internal-packages/dashboard-agent-contracts/src/trigger-uri.test.ts
- apps/webapp/app/components/dashboard-agent/agent-badges.tsx
- apps/webapp/app/services/dashboardAgentAlertUnsubscribeToken.server.ts
- apps/webapp/app/services/dashboardAgentWatchToken.server.ts
- apps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.prompts._index/route.tsx
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.environment-variables/route.tsx
- internal-packages/dashboard-agent-contracts/src/watch.test.ts
- apps/webapp/app/components/dashboard-agent/WatchChips.tsx
- apps/webapp/app/routes/api.v1.projects.$projectRef.$env.jwt.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/route.tsx
- internal-packages/dashboard-agent-contracts/src/trigger-uri.ts
- internal-packages/dashboard-agent-contracts/src/suggested-prompts.ts
- internal-packages/emails/emails/alert-dashboard-agent-watch.tsx
- apps/webapp/app/components/dashboard-agent/useTranscriptAutoScroll.ts
- apps/webapp/app/components/dashboard-agent/report-block-adapter.test.ts
- apps/webapp/app/components/dashboard-agent/view-catalog.tsx
- apps/webapp/app/components/dashboard-agent/watch-chips.ts
- apps/webapp/app/components/dashboard-agent/view-blocks.test.ts
- apps/webapp/app/components/dashboard-agent/demo/demo.test.ts
- apps/webapp/app/routes/api.v1.dashboard-agent.alerts.ts
- apps/webapp/app/components/dashboard-agent/list-row.tsx
- apps/webapp/app/components/dashboard-agent/suggested-prompts/promotedPrompt.server.ts
- apps/webapp/app/components/dashboard-agent/page-label.ts
- apps/webapp/app/components/dashboard-agent/run-id.test.ts
- apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboard-agent.ts
- apps/webapp/app/services/dashboardAgentWatchChecks.server.ts
- apps/webapp/seed-agent-examples-chats.mts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam._index/route.tsx
- apps/webapp/app/components/dashboard-agent/demo/fixtures/messages.ts
- apps/webapp/app/v3/featureFlags.ts
- internal-packages/dashboard-agent-contracts/src/watch.ts
- apps/webapp/app/services/dashboardAgentWatchAlerts.server.ts
- apps/webapp/app/components/dashboard-agent/suggested-prompts/registry.ts
- apps/webapp/app/routes/api.v1.projects.$projectRef.$env.runs.$runId.waiting.ts
- apps/webapp/app/components/dashboard-agent/chat-layout.test.ts
- apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboard-agent.in.$.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.agents.$agentParam/route.tsx
- apps/webapp/app/components/dashboard-agent/demo/fixtures/watches.ts
- apps/webapp/app/services/dashboardAgentWatches.server.ts
- apps/webapp/app/services/dashboardAgentHeadStart.server.ts
- apps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.test.ts
- apps/webapp/test/dashboardAgentWatchChecks.test.ts
- apps/webapp/scripts/agent-ui-screenshots.ts
- internal-packages/dashboard-agent/src/watch-tick.test.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.limits/route.tsx
- apps/webapp/app/v3/services/alerts/deliverDashboardAgentWatchAlert.server.ts
- apps/webapp/test/dashboardAgentRoutes.test.ts
- apps/webapp/app/components/dashboard-agent/report-block-adapter.ts
- apps/webapp/test/seedAgentExamplesChats.test.ts
- apps/webapp/test/dashboardAgentWatches.test.ts
- apps/webapp/app/components/dashboard-agent/RunDiagnosisCard.tsx
- apps/webapp/app/components/dashboard-agent/WatchWakeToast.tsx
- apps/webapp/app/components/dashboard-agent/message-order.ts
- apps/webapp/app/components/dashboard-agent/demo/fixtures/page-context.ts
- apps/webapp/app/routes/resources.dashboard-agent.alerts.$channelId.unsubscribe.tsx
- apps/webapp/app/components/dashboard-agent/chat-layout.tsx
- apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs._index/route.tsx
- apps/webapp/app/components/dashboard-agent/InvestigationCard.tsx
- internal-packages/dashboard-agent/src/dashboard-agent.ts
- apps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.test.ts
- apps/webapp/app/presenters/v3/waitingRun/waitingRunDiagnosis.server.ts
- apps/webapp/app/components/dashboard-agent/demo/fixtures/investigation.ts
- apps/webapp/seed-agent-examples.mts
- apps/webapp/app/components/dashboard-agent/DashboardAgentChat.tsx
- apps/webapp/app/routes/api.v1.dashboard-agent.watches.$watchId.check.ts
- apps/webapp/app/components/dashboard-agent/demo/fixtures/blocks.ts
- apps/webapp/app/components/dashboard-agent/ReportView.tsx
- apps/webapp/app/routes/api.v1.dashboard-agent.watches.$watchId.fired.ts
- apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.private-connections.new/route.tsx
- apps/webapp/app/components/dashboard-agent/demo/components/DemoInvestigationCard.tsx
- internal-packages/dashboard-agent-db/drizzle/meta/0002_snapshot.json
- apps/webapp/app/services/resolveTriggerUri.server.ts
- internal-packages/dashboard-agent-db/drizzle/meta/0003_snapshot.json
- internal-packages/dashboard-agent/src/dashboard-agent.test.ts
- internal-packages/dashboard-agent/src/dashboard-agent.eval.ts
- apps/webapp/app/components/dashboard-agent/DashboardAgent.tsx
- internal-packages/dashboard-agent/src/watch-tick.ts
- apps/webapp/app/components/dashboard-agent/DashboardAgentHistory.tsx
- apps/webapp/test/waitingRunDiagnosis.test.ts
- apps/webapp/app/routes/storybook.agent-ui/route.tsx
- internal-packages/dashboard-agent/src/tool-schemas.ts
- apps/webapp/app/services/dashboardAgentWatchChecks.ts
- internal-packages/dashboard-agent/src/tools.ts
- internal-packages/dashboard-agent-db/src/queries.ts
- apps/webapp/app/routes/api.v1.queues.$queueParam.metrics.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal-packages/dashboard-agent/src/tool-schemas.ts (1)
547-559: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winAlign the capability instructions with the new mutating tools.
The prompt now exposes
schedule_watch,create_alert, anddelete_alert, but it still describes the toolset as read-only and later says the agent cannot change anything. This contradiction can make the agent refuse supported watch/alert actions or incorrectly direct users to the dashboard. Update the blanket capability text to distinguish read-only data tools from these explicitly authorized mutations.
🧹 Nitpick comments (1)
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx (1)
351-368: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winMemoize the transcript-derived winner map.
Line 357 creates a new
Mapon every render, and Line 368 passes it tomemoized turns; activity-only updates therefore rerender the entire transcript and rescan all parts. Memoizestrippedand its winners frommessages.Proposed change
- const stripped = messages.map(stripStepParts); - - const investigationWinners = winningInvestigationOccurrences(stripped); + const { stripped, investigationWinners } = useMemo(() => { + const stripped = messages.map(stripStepParts); + return { + stripped, + investigationWinners: winningInvestigationOccurrences(stripped), + }; + }, [messages]);As per coding guidelines,
useMemois appropriate for expensive derived data and stable references required by dependency arrays.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ae8860fd-cece-44f8-b032-c969b4234488
📒 Files selected for processing (2)
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (33)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 12)
- GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 12)
- GitHub Check: sdk-compat / Node.js 22.23 (warp-ubuntu-latest-x64-4x)
- GitHub Check: sdk-compat / Node.js 24.18 (warp-ubuntu-latest-x64-4x)
- GitHub Check: sdk-compat / Bun Runtime
- GitHub Check: sdk-compat / Node.js 26.4 (warp-ubuntu-latest-x64-4x)
- GitHub Check: sdk-compat / Node.js 20.20 (warp-ubuntu-latest-x64-4x)
- GitHub Check: e2e / 🧪 CLI v3 tests (warp-ubuntu-latest-x64-4x - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (warp-windows-latest-x64-8x - pnpm)
- GitHub Check: typecheck / typecheck
- GitHub Check: e2e / 🧪 CLI v3 tests (warp-ubuntu-latest-x64-4x - npm)
- GitHub Check: e2e / 🧪 CLI v3 tests (warp-windows-latest-x64-8x - npm)
- GitHub Check: packages / 🧪 Unit Tests: Packages (2, 3)
- GitHub Check: packages / 🧪 Unit Tests: Packages (3, 3)
- GitHub Check: packages / 🧪 Unit Tests: Packages (1, 3)
- GitHub Check: sdk-compat / Cloudflare Workers
- GitHub Check: sdk-compat / Deno Runtime
- GitHub Check: runops-guard / runops-guard
- GitHub Check: internal / 🧪 Unit Tests: Internal
- GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
- GitHub Check: code-quality / code-quality
- GitHub Check: 🛡️ E2E Auth Tests (full)
- GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead
**/*.{ts,tsx}: Prefer static imports over dynamicimport(); use dynamic imports only for unresolvable circular dependencies, genuine performance code splitting, or conditional runtime loading.
Import Trigger.dev tasks from@trigger.dev/sdk; never use@trigger.dev/sdk/v3or deprecatedclient.defineJob.
Add agentcrumbs while writing code using approved namespaces; mark lines with//@Crumbsor blocks with `// `#region` `@crumbs, and strip them before merging.
Files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
{packages/core,apps/webapp}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use zod for validation in packages/core and apps/webapp
Files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use function declarations instead of default exports
Files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
apps/webapp/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
apps/webapp/**/*.{ts,tsx}: Access environment variables through theenvexport ofenv.server.tsinstead of directly accessingprocess.env
Use subpath exports from@trigger.dev/corepackage instead of importing from the root@trigger.dev/corepathDo not reintroduce the removed v1 execution path;
RunEngineVersion.V1branches may only reject or finalize gracefully so v3 clients receive a clean 4xx, never a 5xx.
Files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
apps/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
For apps, use
typecheckfor verification and never usebuildas the correctness check.
Files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
apps/webapp/app/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/webapp/CLAUDE.md)
apps/webapp/app/**/*.{ts,tsx}: For dashboard changes, visually verify the running Remix app with Chrome DevTools MCP, using snapshots, screenshots, interaction, and console-message checks as appropriate.
UseuseCallbackanduseMemoonly for context provider values, expensive derived data used as a dependency, or stable references required by dependency arrays; do not wrap ordinary event handlers or trivial computations.
Use named constants for sentinel or placeholder values instead of scattering raw string literals across comparisons.
Files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries
Files:
internal-packages/dashboard-agent/src/tool-schemas.ts
internal-packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
For internal packages, use
typecheckfor verification and never usebuildas the correctness check.
Files:
internal-packages/dashboard-agent/src/tool-schemas.ts
🧠 Learnings (18)
📚 Learning: 2026-02-11T16:37:32.429Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3019
File: apps/webapp/app/components/primitives/charts/Card.tsx:26-30
Timestamp: 2026-02-11T16:37:32.429Z
Learning: In projects using react-grid-layout, avoid relying on drag-handle class to imply draggability. Ensure drag-handle elements only affect dragging when the parent grid item is configured draggable in the layout; conditionally apply cursor styles based on the draggable prop. This improves correctness and accessibility.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-07-28T21:57:20.061Z
Learnt from: samejr
Repo: triggerdotdev/trigger.dev PR: 4411
File: apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx:818-843
Timestamp: 2026-07-28T21:57:20.061Z
Learning: When using Radix UI `DialogClose` with `asChild` (e.g., Trigger.dev dashboard components), note that it injects `type="button"` into its child via `Slot`. If the child is a local `Button` that forwards its `type` prop to the native `<button>`, then placing it inside a `<form>` will *not* submit unless you explicitly set `type="submit"` (or otherwise override the injected type / wire up submission behavior). Review form actions to ensure the intended submit vs non-submit behavior is preserved.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-03-22T13:26:12.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/code/TextEditor.tsx:81-86
Timestamp: 2026-03-22T13:26:12.060Z
Learning: In the triggerdotdev/trigger.dev codebase, do not flag `navigator.clipboard.writeText(...)` calls for `missing-await`/`unhandled-promise` issues. These clipboard writes are intentionally invoked without `await` and without `catch` handlers across the project; keep that behavior consistent when reviewing TypeScript/TSX files (e.g., usages like in `apps/webapp/app/components/code/TextEditor.tsx`).
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
📚 Learning: 2026-03-22T19:24:14.403Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3187
File: apps/webapp/app/v3/services/alerts/deliverErrorGroupAlert.server.ts:200-204
Timestamp: 2026-03-22T19:24:14.403Z
Learning: In the triggerdotdev/trigger.dev codebase, webhook URLs are not expected to contain embedded credentials/secrets (e.g., fields like `ProjectAlertWebhookProperties` should only hold credential-free webhook endpoints). During code review, if you see logging or inclusion of raw webhook URLs in error messages, do not automatically treat it as a credential-leak/secrets-in-logs issue by default—first verify the URL does not contain embedded credentials (for example, no username/password in the URL, no obvious secret/token query params or fragments). If the URL is credential-free per this project’s conventions, allow the logging.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma error P1001 ("Can't reach database server") in TypeScript, don’t assume a single error shape. Prisma can surface P1001 via two different error classes/fields: `PrismaClientKnownRequestError` exposes it as `err.code === "P1001"` (common during mid-query connection drops), while `PrismaClientInitializationError` exposes it as `err.errorCode === "P1001"` (common on client startup failure). Therefore, predicates should use `err.code === "P1001" || err.errorCode === "P1001"`. Do not flag `err.code === "P1001"` as “unreachable/never matches,” as it is expected in production.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma errors for P1001 ("Can't reach database server"), do not assume it only appears under a single property name. Prisma may surface P1001 via either `PrismaClientKnownRequestError` (`err.code === "P1001"`, e.g., mid-query connection drops) or `PrismaClientInitializationError` (`err.errorCode === "P1001"`, e.g., client startup connection failure). To reliably detect the condition, check `err.code === "P1001" || err.errorCode === "P1001"`, and avoid review rules that would incorrectly flag `err.code === "P1001"` as unreachable/never-matching.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
📚 Learning: 2026-06-13T19:53:13.759Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3937
File: packages/trigger-sdk/skills/realtime-and-frontend/SKILL.md:258-260
Timestamp: 2026-06-13T19:53:13.759Z
Learning: When reviewing code that uses `trigger.dev/react-hooks`’s `useRealtimeRun`, preserve the call signature where the first argument is the full realtime handle object (not `handle.id`). This is intentional to maintain type-safety and is consistent with the official docs; do not suggest changing the first argument from the handle object to `handle.id`.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
📚 Learning: 2026-06-17T17:13:49.929Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3948
File: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions.$bulkActionParam/route.tsx:48-62
Timestamp: 2026-06-17T17:13:49.929Z
Learning: In triggerdotdev/trigger.dev, within `dashboardLoader`/`dashboardAction` (or similar context resolver code) whenever you resolve an organization ID from an organization slug for RBAC/enterprise authorization scope, always read from the primary Prisma client (`prisma`), not `$replica`. Using `$replica` can hit replica-lag and cause the RBAC lookup/authorization to run without the correct org scope (bypassing intended role enforcement). Implement the slug→org lookup with `prisma.organization.findFirst(...)` (or equivalent primary-client query) and add an inline comment documenting why the primary client is required (replica lag could lead to unscoped RBAC checks).
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
📚 Learning: 2026-06-23T13:04:21.413Z
Learnt from: carderne
Repo: triggerdotdev/trigger.dev PR: 4023
File: apps/webapp/app/services/upsertBranch.server.ts:14-18
Timestamp: 2026-06-23T13:04:21.413Z
Learning: In TypeScript, it’s valid to `import { type X }` and then use `typeof X` in a type-only position, e.g. `type Alias = z.infer<typeof X>`. The `type` modifier suppresses the runtime import, but the type checker still has the full exported type so `z.infer<typeof X>` can resolve correctly. In code reviews, don’t flag this as a TypeScript compile error as long as `typeof X` is used in a type context (e.g., with `z.infer`, `type` aliases, generics), not as a runtime value.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsxinternal-packages/dashboard-agent/src/tool-schemas.ts
📚 Learning: 2026-04-16T14:21:15.229Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3368
File: apps/webapp/app/components/logs/LogsTaskFilter.tsx:135-163
Timestamp: 2026-04-16T14:21:15.229Z
Learning: When rendering lists of task registry items in apps/webapp (e.g., <SelectItem /> rows) and using `key={item.slug}`, do not flag it as potentially non-unique. In trigger.dev’s `TaskIdentifier` table, the DB constraint `@unique([runtimeEnvironmentId, slug])` guarantees `slug` is unique within a given runtime environment, so `item.slug` is safe as the React key as long as the list is derived from that registry/constraint (and not from a legacy query that could produce duplicate slugs).
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-05-08T21:00:20.973Z
Learnt from: samejr
Repo: triggerdotdev/trigger.dev PR: 3538
File: apps/webapp/app/components/primitives/Resizable.tsx:60-78
Timestamp: 2026-05-08T21:00:20.973Z
Learning: In the triggerdotdev/trigger.dev codebase, treat Zod as a boundary validation tool (API handlers, request/response validation, and storage/DB read/write validation), not as inline render-time validation inside React components/primitive UI code. For render-time guards, prefer small manual type-narrowing checks (e.g., a short predicate like ~10–20 lines) over importing Zod into UI primitives, to avoid per-render schema-parse overhead and unnecessary abstraction. Use the manual guard approach unless you truly need schema validation at a boundary; only then introduce Zod.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-06-25T18:21:55.847Z
Learnt from: carderne
Repo: triggerdotdev/trigger.dev PR: 4039
File: apps/webapp/app/routes/invite-resend.tsx:0-0
Timestamp: 2026-06-25T18:21:55.847Z
Learning: In the triggerdotdev/trigger.dev Zod 4 migration, avoid importing from the root package `conform-to/zod` in webapp code. It can resolve to the Zod 3 build and may crash at module load under Zod 4. When reviewing TypeScript/TSX files in `apps/webapp`, prefer importing from the Zod 4 subpath `conform-to/zod/v4` for Zod 4-compatible schemas/types.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-05-12T21:04:05.815Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3542
File: apps/webapp/app/components/sessions/v1/SessionStatus.tsx:1-3
Timestamp: 2026-05-12T21:04:05.815Z
Learning: In this Remix + TypeScript codebase, do not flag a server/client boundary violation when a file imports only types from a module matching `*.server`.
Specifically, it’s safe to import types using `import type { Foo } from "*.server"` or `import { type Foo } from "*.server"` because TypeScript erases type-only imports at compile time and they emit no JavaScript, so they won’t cross the Remix server/client bundle boundary.
Only raise the boundary concern for value imports (e.g., `import { Foo }` without `type`, or `import Foo`), since those produce JavaScript output.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-06-25T18:21:51.905Z
Learnt from: carderne
Repo: triggerdotdev/trigger.dev PR: 4039
File: apps/webapp/app/routes/invite-revoke.tsx:0-0
Timestamp: 2026-06-25T18:21:51.905Z
Learning: During the Zod v4 migration in the triggerdotdev/trigger.dev webapp, ensure any imports from `conform-to/zod` use the Zod-4 subpath: `conform-to/zod/v4` (e.g., `import { parseWithZod } from "conform-to/zod/v4"`). Do not import from the package root `conform-to/zod`, because it is the Zod 3 implementation and may load Zod-3-only symbols (e.g., `ZodBranded`, `ZodEffects`), which can throw at module load (notably with `zod4.4.3`). This should be enforced across `apps/webapp/**/*` where helpers like `parseWithZod` and `conformZodMessage` are used.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-07-03T17:10:21.498Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 4148
File: apps/webapp/app/models/orgMember.server.ts:149-168
Timestamp: 2026-07-03T17:10:21.498Z
Learning: In triggerdotdev/trigger.dev, `User.email` (Prisma schema: `internal-packages/database/prisma/schema.prisma`) currently does NOT use `citext` and does NOT have a `lower(email)` functional unique index. Therefore, do not introduce Prisma queries like `where: { email: { equals: <value>, mode: "insensitive" } }` (or any case-insensitive lookup) against `User.email`, because it can force sequential scans of the `users` table under load. During review, ensure email is normalized (e.g., lowercased/trimmed) before both writes and subsequent lookups, and if true case-insensitive behavior/uniqueness is required, implement it via a separate app-wide migration (e.g., switch to `citext` and/or add a functional unique index with backfill) rather than bolting it onto individual feature PRs.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-06-25T18:21:54.729Z
Learnt from: carderne
Repo: triggerdotdev/trigger.dev PR: 4039
File: apps/webapp/app/routes/confirm-basic-details.tsx:0-0
Timestamp: 2026-06-25T18:21:54.729Z
Learning: For Remix + TypeScript files that use Conform v1 (conform-to/react) and its getInputProps helper, when you intend to suppress the helper-provided default value for non-checkbox/non-radio inputs (e.g., hidden inputs managed via an explicit value prop), use the Conform v1 option key `value: false`. Do not recommend `defaultValue: false` here, because `defaultValue` is not a valid option key for these input types in Conform v1 typings.
Applied to files:
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx
📚 Learning: 2026-06-04T18:16:35.386Z
Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3836
File: apps/supervisor/src/backpressure/backpressureMonitor.ts:3-5
Timestamp: 2026-06-04T18:16:35.386Z
Learning: When reviewing TypeScript in this repo, apply the rule “prefer type aliases over interfaces” only to data/object shapes and union/intersection type modeling. If an interface is being used as a behavioral contract for collaborators to implement (e.g., method-shape interfaces that define required behavior, such as `BackpressureLogger` / `BackpressureSignalSource` in `apps/supervisor/src/backpressure/backpressureMonitor.ts`), keep it as an `interface` and do not flag it as a type-alias-vs-interface violation.
Applied to files:
internal-packages/dashboard-agent/src/tool-schemas.ts
📚 Learning: 2026-06-09T17:58:04.699Z
Learnt from: 0ski
Repo: triggerdotdev/trigger.dev PR: 3879
File: apps/webapp/app/models/vercelIntegration.server.ts:619-630
Timestamp: 2026-06-09T17:58:04.699Z
Learning: In this codebase, outbound raw `fetch` calls should typically rely on Node/undici’s default request timeout (about ~300s) rather than adding a per-call `AbortController` + `setTimeout` wrapper inside individual functions (e.g. in files like `apps/webapp/app/models/vercelIntegration.server.ts`). During code review, do not flag the absence of a per-call timeout on a single `fetch` as an issue; if per-call timeouts are needed, they should be implemented via a codebase-wide convention (e.g., a shared fetch wrapper or documented pattern) rather than ad-hoc per-function changes.
Applied to files:
internal-packages/dashboard-agent/src/tool-schemas.ts
🔇 Additional comments (1)
apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx (1)
99-146: LGTM!Also applies to: 245-287
- waiting-run diagnosis: 'unknown' with concurrency evidence in hand no longer claims the evidence is missing; an elapsed delay says 'not yet enqueued' instead of hiding behind time-from-creation - queue metrics route: drop the double decode that 500ed on names with a literal percent sign - evidence schema: kind must match the URI's own kind - seed-queue-metrics: default-binding imports like the other seeders
… runs (TRI-12862) The queue detail page offers Investigate when the queue is at capacity with runs waiting or the head-of-line wait passes the existing warning threshold; the run page's waiting widget offers it whenever it renders. Both post the visible request in the user's own voice through the existing button.
…, gallery matrix (TRI-12862) - a card left in_progress when the turn ends is force-settled to inconclusive (evidence and hypotheses kept, remediation dropped, honest headline note) before the turn persists — a refresh can never read a spinner that never stops - canonicalization throws surface as named tool errors instead of escaping - protocol rule: a cause names a mechanism; a restatement behind 'because' is not a verdict (eval case with tempting mechanism-free evidence) - gallery: in_progress-early, concluded-not-code-grounded, degraded-after- tool-failure fixtures; the two concluded cells contrast server-decided actions
The route's schemas and helpers moved to reportsApi.server.ts — non-loader route exports that reach server-only modules fail the vite build (the e2e jobs' failure), which typecheck doesn't catch.
…cess The env layout loader queried the feature flag unconditionally; without agent access the panel never mounts, so the read was wasted — and main's new environment-ownership test (which stubs a minimal prisma) caught it.
- the empty chat centers a hero: sparkles icon, 'Ask Trigger' at blank-slate title size with the Beta badge, a one-line subtitle, a three-row composer with the send button inside, and the suggested prompts as a wrapping row of buttons colored by meaning (action indigo, status secondary, explain tertiary, docs the docs style) — one slot-to-variant mapping - an Expand button next to Close takes the panel over everything right of the nav bar, like a page: no route, no modal, no remount — the chat keeps its transport and draft text; content stays mounted underneath; the transcript column gets a prose max-width; the preference persists - storybook: hero states at panel and fullscreen widths
…op geometry - the blank state's field shows the top suggested prompt as its placeholder; Tab drops it into the field as editable text, never sending it - the send and stop buttons share identical square geometry
… land - cmd+J is contextual: closed opens the panel, open starts a new chat; closing is Esc or the header's x — the New chat tooltip now shows cmd+J (displayed once, registered once) - in-flight tool work renders as a bare spinner line, not a bordered pill — chips are for artifacts that stay, progress is transient - error evidence and navigate targets normalize the API's friendly id to the raw fingerprint, so View similar failures opens the error page instead of 'Error not found'
The header button is the ask-ai Button variant (dot-matrix logo, 'Ask AI'); the hero title follows suit.
…er the agent works One component in the spinner primitives; chat progress, pending tools, the history thinking/watching markers, panel loading, chart loading and testing hypotheses all use it, so agent activity reads as the agent rather than generic loading.
- AgentSpinner rests on the playlist's first shape, so mounting shows no logo-head flash — a spinner is born spinning - the pending indicator keeps one stable element across tool changes: the label swaps, the animation never restarts
…estarts The pending tool line, the generic activity row and the investigation card's own progress collapse into a single ChatProgress mounted once at the end of the live turn: phases only swap its label (card phrase > tool phrase > activity), decided in the pure progress-line module. ChatPendingTool is gone; the card renders no spinner of its own; AgentSpinner has exactly one live render site.
Only the runs list and run detail described themselves to the dashboard agent, so every other page fell to "other" and offered generic chips. Add handle mappers for the errors list, an error group, the queues list, a queue, the deployments list and a deployment — loader data only, no added queries — plus list page kinds in the contracts and an optional deployment status. Investigate chips now appear for an unhealthy queue and a deploy that didn't land.
Only the runs, errors, queues and deployments pages described themselves to the dashboard agent; everything else fell to "other" and offered the generic chips. Add handle mappers for the remaining 37 env-scoped routes and 24 page kinds in the contracts, so each page offers an explain and a docs question about what it actually shows. Investigate and status chips stay gated on loader data: a scheduled task with no schedule attached, all its schedules disabled, a paused queue, a batch whose runs failed, a wait token past its timeout, a bulk action still running, a spent quota, a prompt pinned to an override, a session whose run failed. Loader data only, no added queries, no new signals.
… row The hand-built row stopped satisfying every column the authenticated-environment mapper reads, so both proxy cases failed. Stubbing the lookup keeps the fixture independent of the row's columns.
| return text | ||
| .replace(MARKDOWN_IMAGE, (_whole, alt: string) => plainAlt(alt)) | ||
| .replace(MARKDOWN_SHORTCUT_IMAGE, (_whole, alt: string) => plainAlt(alt)) | ||
| .replace(FETCHING_TAG, ""); |
| }): string { | ||
| const digest = createHash("sha256") | ||
| .update( | ||
| `${params.organizationId}:${params.userId}:${params.environmentId}:${params.clientRequestId}` |
Route conflicts were the tab-title work meeting the agent page-context handle: both sides kept, duplicate meta exports resolved to pageMeta, duplicate imports merged with unused bindings dropped. Lockfile regenerated from the merged manifests.
…lowlist Replaces https://*.googleusercontent.com (a host with public write access) with CSP_IMG_SRC_ALLOWLIST: exact origins only, https outside development, deduplicated, bad entries warned about instead of failing the boot.
…ts message Classify a failed tool result locally into one of seven categories and send only the label; the message is dropped with every other free-text field. Unrecognised failures are unknown rather than guessed, and a bare string error field is now withheld too.
…the message withheld Also reuse the policy's errored-output check instead of a second copy of it.
…ack to its condition A per-condition fallback identified the condition rather than the submit, so a re-watch could replay a stale terminal outcome from the retention window.
A refusal that won the race kept the reserved watch id, so the user was told nothing was created while that watch stayed active.
…batch order A tick that could read nothing now moves the group's fairness key only, so a watch with a permanently broken reader stops crowding out the rest of an over-cap group. Dueness and the streak facts still follow the last real check.
…t-wide routes The environments and runs listings are project-wide, so an environment-scoped user-actor token could read every environment its user can reach. Both routes now resolve the claim into a mandatory filter, and a conflicting request filter is refused rather than overridden.
…ntity The direct PAT authentication path returned identity only, so a user-actor token reaching it (admin routes and other direct callers) lost its environment scope. The claims now ride on the authentication result itself.
…ed token can do A user-actor token declaring no scope cap could mint an environment JWT with any scopes it asked for. The exchange now clamps the minted scopes to the actor's own ability, so a capless token is read-only, and only mints for its claimed environment.
…ad of re-deciding it replay() re-ran subscribe() for an already-recorded `created` submission. A retry that succeeded could flip the ledger to `enabled`, but the confirmation in the transcript is append-once, so the user kept being told email was unavailable while the system believed it was on. The replay now reads recordedExternalNotification() and takes no external decision. An attempt that dies before subscribing or before its outcome is recorded leaves the row `pending`, and the normal creation path subscribes on the retry.
… a colleague's The create-watch response matched any watch-alert channel in the project, so a second member was told they were subscribed while the mail went to the first. The channel's deduplication key is the only record of whose it is, so state resolution, subscribe and unsubscribe now share one owner lookup.
…n patch A recorded outcome is immutable now, so nothing calls it.
Settling the investigations row was invisible to the user. The panel builds the
winning revision from the transcript's own `tool-render_view` parts and never
reads that table, so a turn that ran out of steps left the card at
`in_progress` forever: the database believed the investigation had finished
while a refresh still showed "Working...".
`settleOpenInvestigations` now returns the revisions it committed, and
`onTurnComplete` appends each as one more card revision — after the transcript
write and id-deduped on `investigation-settlement:{id}:{revision}`, so a failed
append leaves the card visibly unclosed rather than silently lost, and a retry
can't stack a second card.
The card-building and the latest-revision reader move out of the watch lane and
into the runtime both lanes share, so there is one shape, not two. The watch
lane keeps its own message id: it dedupes on the action, not the revision.
…tles
The sweep settled the row and appended nothing, so it visibly fixed nothing: the
chat kept rendering the last card it had, which was still "Working…". The settle
now returns the state and revision it wrote, and the sweep appends that as the
closing card revision on the chat — id-deduped on
`investigation-settlement:{id}:{revision}`, so a retried run can neither stack a
second card nor open a second investigation.
The append is scoped by chat id: a sweep runs off any session and has no user in
context, unlike the turn lane.
An AI assistant in a side panel on every dashboard page, behind the dashboard-agent feature flag. It reads runs, errors, queues, deploys and health through the public API (read-only, delegated user token), answers with rich cards, and can keep watching things after the conversation ends.
What's inside
@internal/dashboard-agent-contracts(trigger:// URI grammar, intents, watch specs, block envelope), investigations + watches tables, head-start reliability fix, eval sample-rate gate.get_reportrenders the deterministic health report as a card (metric grid, sparklines, Next steps button row); stale telemetry is flagged and never trusted for advice.db:seed:agent-examples, with--heartbeat/--degrade/--recoverfor demos).How to review
GUIDEBOOK.md — 10-minute local setup and a hands-on walkthrough of every case.
Notes
canAccessDashboardAgent; no behavior change with the flag off.