Repository navigation
feat(chat): add the run cards and the runs tray - #1787
Merged
Merged
Conversation
Chat P0, D2, from the approved Chat v2 mockups (#s-plan, #s-need,
#s-done, #s-denied, #s-failed and the header's runs pill), on D1's
agent pieces:
- Plan card: the steps with how each runs (Auto, Asks you, Auto ·
logged, Needs your click), what the run uses and connects to, time,
AI usage and outputs; Edit plan moves or removes steps, Start runs
the edited plan. A role that can't start runs gets Ask your Admin.
- Approval card: a WRITE's change as before and after, why, sources,
Skip · Edit · Approve and Save & approve; "Don't ask again" only when
the precedence allows it (canDontAskAgain). An EXECUTE is the one dark
"Needs your click" pill and a button naming the effect, off with its
reason until it can be made. Pending, saving, approved, skipped and
failed states.
- Result card: "Generated …" and "Data as of …" in absolute time with
the GMT offset, the steps folded under "Worked for …", counts, files
whose Open goes only to a path in the app (ChatHref), and the click
card that waits above it.
- Out-of-permission card: what was asked, why not and where it is set,
who can by role, and what next; Ask your Admin goes through
onAskAdmin (B2 wires access.request), then says Sent.
- Failed run: the agent in red, where it stopped and why, and Retry
from the failed step or the whole run.
- Run steps (CHAT-03): "Working on it" with the step count and clock,
"Worked for 1m 12s · 7 steps · 4 sources" once done, a one-step run as
that step's line; each new step said to screen readers (aria-live).
- Every approve, start, retry and request goes through the read-only
gate (useUpgradeGate().guard). Motion stops with reduced motion.
- Runs tray: the runs pill with the amber needs-you count and the
"Your runs" list (Review, progress, Open), read again every few
seconds, not while the tab is hidden. GET /api/chat/runs/tray reads
the person's own Chat runs (steps by CHAT_RUN_STEP_SELECT) and the
brand's Content Agent runs, newest first; 404 while CHAT_AGENTIC is
off; failures come back as { ok: false, failure, error }.
- The preview page (/dashboard/chat/preview) shows every card in every
state, and the tray, also live.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 of 7 tasks
gkhngyk
approved these changes
Oct 29, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good: ec60ab3 merges into main cleanly as it is.
What I checked
- Flag off.
- The tray route answers 404 before any
chat_*read. - The preview page calls
notFound().
- The tray route answers 404 before any
- Who sees what.
- The tray reads as the signed-in person, through RLS: chats are the author's own (there's also an
.eq('user_id')), and runs and steps follow their chats. - The brand id must be a UUID. Content runs are limited by the drafts' organization RLS.
- The tray reads as the signed-in person, through RLS: chats are the author's own (there's also an
- What reaches the browser.
- At most 10 runs.
- No dollar amounts and no tool names. The only ids are in the links.
- Embeds. One,
content_drafts!content_agent_runs_draft_id_fkey!inner(title, brand_id). There is one foreign key between the two tables, and the hint names it. - Client imports. No client component reaches a server module (
plan-row.test.tspasses). - No migration.
Follow-ups (not blocking while the tray is on the preview page only)
- The tray keeps polling every 15 s after a 401 or a 404. It could stop at the first one.
- The
chat_run_stepsread has no.limit. Only the 30 runs bound it.
Tests: cards, runs-tray and the tray route pass. The stack passes as a whole (see #1794).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Chat P0, part D2: the run cards and the runs tray, built from D1's pieces (#1760) and copied from the approved Chat v2 mockup (
#s-plan,#s-need,#s-done,#s-denied,#s-failed). BehindCHAT_AGENTIC. The engine (C3) feeds them.Cards (
web/src/components/agentic/)plan-card.tsx:approval-card.tsx:canDontAskAgain.result-card.tsx:/dashboard/…(A1'sisChatHref).denial-card.tsx:onAskAdminprop, which B2's action fills.error-card.tsx: the red avatar, "Stopped at step 2 of 3", the reason, and Retry step / Retry.run-steps.tsx,step-list.tsx(CHAT-03): "Working on it · N steps · m:ss" while running, then "Worked for 1m 12s · 7 steps · 4 sources". Each new step is announced (aria-live="polite").useUpgradeGate().guard. Motion stops under reduced motion, coloured states have dark pairs, and copy lives inen.json.Runs tray
runs-tray.tsx(data-action="runs.toggleTray"):api/chat/runs/tray/route.ts:chat_runs(steps viaCHAT_RUN_STEP_SELECT, never*ortool) and the brand'scontent_agent_runs(lib/content/agent-runs.ts), newest first.{ ok: false, failure, error }on failure (the fix(prompts): show suggestions' load failures plainly and retry once, instead of React #441 #1777 pattern).Preview (
/dashboard/chat/preview) adds every card in every state and the tray (empty and live), using sample data from the mockup.Notes
answer.toggleSteps, which should be added to CHAT-23.Related issue
None (Chat P0, Drive › Chat).
Type of change
feat— New feature (behindCHAT_AGENTIC)How to test
CHAT_AGENTIC=true, then open/dashboard/chat/preview: every card state, in light and dark mode, with reduced motion on.cd web && yarn vitest run src/components/agentic/ src/lib/chat/runs-tray.test.ts 'src/app/api/chat/runs/tray/'. The 16 files, 345 tests, cover:guard,aria-live, reduced motion and dark mode;*/toolselect; the failure JSON.Checklist
🤖 Generated with Claude Code