Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: surface GitHub inbox alerts in central Actions
[._.]/ Adam Eivye70311d57838
diff --git a/client/src/components/github/GitHubInboxTab.jsx b/client/src/components/github/GitHubInboxTab.jsxindex dd9bc65d17..770d398a1f 100644--- a/client/src/components/github/GitHubInboxTab.jsx+++ b/client/src/components/github/GitHubInboxTab.jsx@@ -1,16 +1,8 @@import { useCallback, useEffect, useRef, useState } from 'react';-import { Link, useParams } from 'react-router';-import {- Bell, BellOff, Bot, Check, CheckCheck, CheckCircle2, CircleDot, CircleX, ExternalLink, GitCommitHorizontal, GitMerge, GitPullRequest, GitPullRequestClosed, GitPullRequestDraft,- Inbox, Layers, ListPlus, Mail, MailX, MessagesSquare, RefreshCw, Rocket, ShieldAlert, Tag,-} from 'lucide-react';-import Pill from '../ui/Pill';-import OverflowMenu from '../ui/OverflowMenu';+import { useParams } from 'react-router';+import { Bot, CheckCheck, CheckCircle2, Inbox, Layers, RefreshCw, ShieldAlert } from 'lucide-react';import GitHubThreadDrawer from './GitHubThreadDrawer';-import GitHubDeploymentReview from './GitHubDeploymentReview';-import GitHubAgentPinForm from './GitHubAgentPinForm';-import GitHubPullRequestActions from './GitHubPullRequestActions';-import { AGENT_REFUSED_LABELS, DECISION_ACTIONS, DECISION_VIEW, REASON_WHY, TONE_EDGE, TRUST_VIEW, subjectStatusChip } from './githubTriageLabels';+import GitHubNotificationCard from './GitHubNotificationCard';import socket from '../../services/socket';import LoadFailedState from '../ui/LoadFailedState';import PageSkeleton from '../ui/PageSkeleton';@@ -21,43 +13,8 @@ import {getGitHubAccounts,getGitHubNotifications,syncGitHubNotifications,- applyGitHubNotificationAction,- resolveGitHubNotificationWithAgent,} from '../../services/api';-// GitHub's `reason` vocabulary, phrased for a glance.-const REASON_LABELS = {- approval_requested: 'Deploy approval',- assign: 'Assigned',- author: 'You opened',- ci_activity: 'CI',- comment: 'Comment',- invitation: 'Invitation',- manual: 'Subscribed',- mention: 'Mention',- review_requested: 'Review requested',- security_alert: 'Security alert',- state_change: 'State change',- subscribed: 'Watching',- team_mention: 'Team mention',-};--const STATE_LABELS = { done: 'Done', muted: 'Muted', unsubscribed: 'Unsubscribed' };--// Undoing Done is local; undoing Mute/Unsubscribe re-subscribes on GitHub.-const UNDO_ACTIONS = {- done: { action: 'reopen', label: 'Back to inbox' },- muted: { action: 'resubscribe', label: 'Unmute' },- unsubscribed: { action: 'resubscribe', label: 'Resubscribe' },-};--const DONE_ACTION = { action: 'done', label: 'Done' };-// Rarer and harder to undo than Done, so they sit in the row's overflow menu.-const MORE_ACTIONS = [- { action: 'mute', label: 'Mute', icon: BellOff },- { action: 'unsubscribe', label: 'Unsubscribe', icon: MailX },-];-// Whether a row still belongs in the view after an action moved it. Mirrors// VIEW_FILTERS in server/services/githubNotifications.js: the inbox holds// unread open threads, whatever their decision.@@ -69,43 +26,6 @@ const VIEW_MATCHERS = {};const belongsInView = (row, view) => VIEW_MATCHERS[view](row);-// The kind of thing a thread is about, as an icon and a word for screen readers.-const KIND_VIEW = {- PullRequest: { icon: GitPullRequest, label: 'Pull request', className: 'text-port-accent' },- Issue: { icon: CircleDot, label: 'Issue', className: 'text-port-success' },- CheckSuite: { icon: CircleX, label: 'CI', className: 'text-port-error' },- Release: { icon: Tag, label: 'Release', className: 'text-gray-300' },- Discussion: { icon: MessagesSquare, label: 'Discussion', className: 'text-gray-300' },- Commit: { icon: GitCommitHorizontal, label: 'Commit', className: 'text-gray-300' },- RepositoryInvitation: { icon: Mail, label: 'Invitation', className: 'text-gray-300' },- WorkflowRun: { icon: Rocket, label: 'Workflow run', className: 'text-port-warning' },-};-const SECURITY_KIND = { icon: ShieldAlert, label: 'Security alert', className: 'text-port-error' };-// A PR or issue's icon and color follow its state, as on GitHub: green open,-// gray draft, purple merged or resolved, red closed.-const STATE_KIND = {- PullRequest: {- merged: { icon: GitMerge, label: 'Merged pull request', className: 'text-purple-400' },- closed: { icon: GitPullRequestClosed, label: 'Closed pull request', className: 'text-port-error' },- draft: { icon: GitPullRequestDraft, label: 'Draft pull request', className: 'text-gray-400' },- open: { icon: GitPullRequest, label: 'Open pull request', className: 'text-port-success' },- },- Issue: {- merged: { icon: CheckCircle2, label: 'Resolved issue', className: 'text-purple-400' },- closed: { icon: CheckCircle2, label: 'Closed issue', className: 'text-purple-400' },- open: { icon: CircleDot, label: 'Open issue', className: 'text-port-success' },- },-};-const kindOf = (notification) => {- if (notification.reason === 'security_alert') return SECURITY_KIND;- const status = notification.subjectStatus;- const byState = STATE_KIND[notification.subjectType];- if (byState && status?.state) {- return byState[status.state === 'open' && status.draft ? 'draft' : status.state] || byState.open;- }- return KIND_VIEW[notification.subjectType] || { icon: Bell, label: notification.subjectType || 'Notification', className: 'text-gray-400' };-};-// Summary tiles double as the view picker. Counts come from the server for// every view at once; tone follows meaning, and every tile also has a label.const TILES = [@@ -171,180 +91,6 @@ function RepoFilter({ repos, repo, onSelect, total }) {);}-// Where an agent run's failure can be read: its agent, else its CoS task.-const agentFailedLink = ({ agentId, taskId }) => (agentId- ? `/cos/agents/${encodeURIComponent(agentId)}`- : `/cos/tasks?task=${encodeURIComponent(taskId)}&source=user`);--const SUGGESTION_ICONS = { agent: Bot, done: Check, mute: BellOff };-// A suggestion button keeps its pill's color, so the row still reads the same.-const SUGGESTION_TONES = {- accent: 'border-port-accent/40 bg-port-accent/10 text-port-accent',- warning: 'border-port-warning/40 bg-port-warning/10 text-port-warning',- muted: 'border-port-border bg-port-bg text-gray-200',-};--// The Automations tab's rule form, prefilled with this thread's kind and repo.-const automationRuleLink = (notification) => {- const params = new URLSearchParams({ ruleAccount: notification.accountId, ruleKind: notification.ruleKind });- if (notification.repoFullName) params.set('ruleRepo', notification.repoFullName);- return `/devtools/github/automations?${params}`;-};--function NotificationRow({ notification, accountLabel, busy, onAction, onUpdated }) {- const [reviewing, setReviewing] = useState(false);- const [picking, setPicking] = useState(false);- const handled = notification.state !== 'open';- const trust = TRUST_VIEW[notification.trust];- const decision = DECISION_VIEW[notification.decision];- const kind = kindOf(notification);- const why = REASON_WHY[notification.reason];- const statusChip = subjectStatusChip(notification.subjectType, notification.subjectStatus);- // Every open row offers the button; a refused lane disables it with its reason.- const agent = handled ? null : notification.agent;- const canResolve = Boolean(agent) && !agent.refused;- const refusedId = `agent-refused-${notification.accountId}-${notification.threadId}`;- const suggestionAction = handled || notification.pullRequest ? null : DECISION_ACTIONS[notification.decision];- const suggestion = suggestionAction ? { ...suggestionAction, icon: SUGGESTION_ICONS[suggestionAction.action] } : null;- const startAgent = async (pin) => {- if (await onAction(notification, 'agent', pin)) setPicking(false);- };- const overflow = [- ...(handled ? [] : MORE_ACTIONS.map(({ action, label, icon }) => ({- id: action, label, icon, disabled: busy, onSelect: () => onAction(notification, action),- }))),- // Handle every similar thread the same way from now on (#13192).- ...(notification.ruleKind ? [{ id: 'add-rule', label: 'Add automation rule…', icon: ListPlus, to: automationRuleLink(notification) }] : []),- ];- return (- <article className={`flex min-w-0 gap-3 border-l-4 px-3 py-3 @3xl/page:px-4 ${TONE_EDGE[handled ? 'muted' : why?.tone] || TONE_EDGE.muted}`}>- <span className="relative mt-0.5 shrink-0">- <kind.icon size={18} className={kind.className} aria-label={kind.label} role="img" />- {notification.unread && <span className="absolute -right-1 -top-1 h-2 w-2 rounded-full bg-port-accent ring-2 ring-port-card" aria-label="Unread" />}- </span>- <div className="flex min-w-0 flex-1 flex-col gap-2 @3xl/page:grid @3xl/page:grid-cols-[minmax(0,1fr)_minmax(0,2fr)] @3xl/page:items-start">- <div className="min-w-0 flex-1">- <Link- to={`/devtools/github/inbox/${encodeURIComponent(notification.accountId)}/${notification.threadId}`}- className={`block break-words text-sm hover:underline ${notification.unread ? 'font-semibold text-white' : 'text-gray-200'}`}- >- {notification.title}- </Link>- <div className="mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-gray-400">- <Pill tone={why?.tone || 'muted'} size="xs">{REASON_LABELS[notification.reason] || notification.reason}</Pill>- {statusChip && <Pill tone={statusChip.tone} size="xs">{statusChip.label}</Pill>}- {notification.repoFullName && <span className="min-w-0 truncate font-mono">{notification.repoFullName}</span>}- <span className="shrink-0">· {timeAgo(notification.updatedAt)}</span>- {accountLabel && <span className="shrink-0">· {accountLabel}</span>}- </div>- {why && <p className="mt-1 text-xs text-gray-400">{why.text}</p>}- {notification.deployment && (- <p className="mt-1 min-w-0 break-words text-xs text-gray-300">- <span className="text-white">{notification.deployment.name}</span>- {notification.deployment.headBranch && <> on <span className="font-mono">{notification.deployment.headBranch}</span></>}- {notification.deployment.displayTitle && <> · {notification.deployment.displayTitle}</>}- </p>- )}- <div className="mt-1.5 flex flex-wrap items-center gap-1.5">- {decision && (suggestion ? (- <button- type="button"- disabled={busy || (suggestion.action === 'agent' && !canResolve)}- onClick={() => (suggestion.action === 'agent' ? setPicking(true) : onAction(notification, suggestion.action))}- aria-describedby={suggestion.action === 'agent' && agent?.refused ? refusedId : undefined}- className={`inline-flex min-h-[36px] items-center gap-1 rounded-lg border px-2.5 py-1 text-xs font-medium hover:brightness-125 disabled:opacity-50 ${SUGGESTION_TONES[decision.tone] || SUGGESTION_TONES.muted}`}- >- <suggestion.icon size={12} aria-hidden="true" /> {suggestion.label}- </button>- ) : <Pill tone={decision.tone}>{decision.label}</Pill>)}- {notification.yourRepo && <Pill tone="accent">Your repo</Pill>}- {notification.repoPrivate && <Pill tone="muted">Private</Pill>}- {trust && <Pill tone={trust.tone}>{trust.label}</Pill>}- {notification.state === 'open' && !notification.unread && <Pill tone="muted">{notification.readOnGithub ? 'Read on GitHub' : 'Read'}</Pill>}- {handled && <Pill tone="muted">{STATE_LABELS[notification.state] || notification.state}</Pill>}- {!handled && notification.agentFailed && (- <Link to={agentFailedLink(notification.agentFailed)} className="rounded hover:underline">- <Pill tone="error">Agent failed</Pill>- </Link>- )}- </div>- {reviewing && (- <GitHubDeploymentReview- notification={notification}- onCancel={() => setReviewing(false)}- onReviewed={(updated) => { setReviewing(false); onUpdated(notification, updated); }}- />- )}- {picking && canResolve && (- <GitHubAgentPinForm- pin={agent.pin}- label={`Agent for ${notification.title}`}- submitLabel={busy ? 'Starting…' : 'Start agent'}- busy={busy}- onSubmit={startAgent}- onCancel={() => setPicking(false)}- />- )}- {agent?.refused && (- <p id={refusedId} className="mt-1 text-xs text-gray-500">- {AGENT_REFUSED_LABELS[agent.refused] || agent.refused}- </p>- )}- </div>- <div className="flex min-w-0 max-w-full flex-wrap items-center gap-1.5">- {!handled && notification.deployment && !reviewing && (- <button- type="button"- disabled={busy}- onClick={() => setReviewing(true)}- className="inline-flex min-h-[36px] items-center gap-1 rounded-lg bg-port-accent px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50"- >- <Rocket size={13} aria-hidden="true" /> Review deployment- </button>- )}- {notification.pullRequest && <GitHubPullRequestActions notification={notification} onUpdated={onUpdated} />}- {agent && !picking && !notification.pullRequest && (- <button- type="button"- disabled={busy || !canResolve}- onClick={() => setPicking(true)}- aria-describedby={agent.refused ? refusedId : undefined}- className={`inline-flex min-h-[36px] items-center gap-1 rounded-lg px-3 py-1.5 text-xs font-medium disabled:opacity-50 ${canResolve- ? 'bg-port-accent text-white'- : 'border border-port-border text-gray-400'}`}- >- <Bot size={13} aria-hidden="true" /> Resolve with agent- </button>- )}- {(handled ? [UNDO_ACTIONS[notification.state]].filter(Boolean) : [DONE_ACTION]).map(({ action, label }) => (- <button- key={action}- type="button"- disabled={busy}- onClick={() => onAction(notification, action)}- className="inline-flex min-h-[36px] items-center gap-1 rounded-lg border border-port-border px-3 py-1.5 text-xs text-gray-200 hover:border-gray-500 disabled:opacity-50"- >- {action === 'done' && <Check size={13} aria-hidden="true" />}- {label}- </button>- ))}- {notification.htmlUrl && (- <a- href={notification.htmlUrl}- target="_blank"- rel="noopener noreferrer"- className="inline-flex min-h-[36px] items-center gap-1 rounded-lg border border-port-border px-3 py-1.5 text-xs text-gray-300 hover:border-gray-500"- >- <ExternalLink size={12} aria-hidden="true" /> Open- </a>- )}- {overflow.length > 0 && <OverflowMenu label={`More actions for ${notification.title}`} items={overflow} />}- </div>- </div>- </article>- );-}-export default function GitHubInboxTab() {const { accountId: routeAccountId, threadId } = useParams();const [accounts, setAccounts] = useState(null);@@ -354,7 +100,6 @@ export default function GitHubInboxTab() {const [data, setData] = useState(null);const [loadFailed, setLoadFailed] = useState(false);const [syncing, setSyncing] = useState(false);- const [busyKey, setBusyKey] = useState(null);const [clearing, setClearing] = useState(false);const [removing, setRemoving] = useState(() => new Set());const [syncTick, setSyncTick] = useState(0);@@ -403,19 +148,6 @@ export default function GitHubInboxTab() {}, []);useEffect(() => { refresh(); }, [refresh]);- // Resolves true once the server took the action. `run` is the agent picker's- // provider/model/effort for Resolve with agent.- const handleAction = async (row, action, run) => {- const key = keyOf(row);- setBusyKey(key);- const updated = await (action === 'agent'- ? resolveGitHubNotificationWithAgent(row.accountId, row.threadId, run)- : applyGitHubNotificationAction(row.accountId, row.threadId, action)).catch(() => null);- setBusyKey(null);- if (updated) applyUpdate(row, updated);- return Boolean(updated);- };-const applyUpdate = (row, updated) => {const key = keyOf(row);if (belongsInView(updated, view)) {@@ -549,11 +281,10 @@ export default function GitHubInboxTab() {const key = keyOf(notification);return (<CollapsibleListItem key={key} removing={removing.has(key)} onExited={() => dropRow(key)}>- <NotificationRow+ <GitHubNotificationCardnotification={notification}accountLabel={labelFor(notification.accountId)}- busy={busyKey === key || removing.has(key)}- onAction={handleAction}+ busy={removing.has(key)}onUpdated={applyUpdate}/></CollapsibleListItem>diff --git a/client/src/components/github/GitHubNotificationCard.jsx b/client/src/components/github/GitHubNotificationCard.jsxnew file mode 100644index 0000000000..7191a960c3--- /dev/null+++ b/client/src/components/github/GitHubNotificationCard.jsx@@ -0,0 +1,282 @@+import { useId, useRef, useState } from 'react';+import { Link } from 'react-router';+import {+ Bell, BellOff, Bot, Check, CheckCircle2, CircleDot, CircleX, ExternalLink,+ GitCommitHorizontal, GitMerge, GitPullRequest, GitPullRequestClosed, GitPullRequestDraft,+ ListPlus, Mail, MailX, MessagesSquare, Rocket, ShieldAlert, Tag,+} from 'lucide-react';+import Pill from '../ui/Pill';+import OverflowMenu from '../ui/OverflowMenu';+import GitHubDeploymentReview from './GitHubDeploymentReview';+import GitHubAgentPinForm from './GitHubAgentPinForm';+import GitHubPullRequestActions from './GitHubPullRequestActions';+import { AGENT_REFUSED_LABELS, DECISION_ACTIONS, DECISION_VIEW, REASON_WHY, TONE_EDGE, TRUST_VIEW, subjectStatusChip } from './githubTriageLabels';+import { timeAgo } from '../../utils/formatters';+import { applyGitHubNotificationAction, resolveGitHubNotificationWithAgent } from '../../services/api';++// GitHub's `reason` vocabulary, phrased for a glance.+const REASON_LABELS = {+ approval_requested: 'Deploy approval',+ assign: 'Assigned',+ author: 'You opened',+ ci_activity: 'CI',+ comment: 'Comment',+ invitation: 'Invitation',+ manual: 'Subscribed',+ mention: 'Mention',+ review_requested: 'Review requested',+ security_alert: 'Security alert',+ state_change: 'State change',+ subscribed: 'Watching',+ team_mention: 'Team mention',+};++const STATE_LABELS = { done: 'Done', muted: 'Muted', unsubscribed: 'Unsubscribed' };++// Undoing Done is local; undoing Mute/Unsubscribe re-subscribes on GitHub.+const UNDO_ACTIONS = {+ done: { action: 'reopen', label: 'Back to inbox' },+ muted: { action: 'resubscribe', label: 'Unmute' },+ unsubscribed: { action: 'resubscribe', label: 'Resubscribe' },+};++const DONE_ACTION = { action: 'done', label: 'Done' };+// Rarer and harder to undo than Done, so they sit in the row's overflow menu.+const MORE_ACTIONS = [+ { action: 'mute', label: 'Mute', icon: BellOff },+ { action: 'unsubscribe', label: 'Unsubscribe', icon: MailX },+];++// The kind of thing a thread is about, as an icon and a word for screen readers.+const KIND_VIEW = {+ PullRequest: { icon: GitPullRequest, label: 'Pull request', className: 'text-port-accent' },+ Issue: { icon: CircleDot, label: 'Issue', className: 'text-port-success' },+ CheckSuite: { icon: CircleX, label: 'CI', className: 'text-port-error' },+ Release: { icon: Tag, label: 'Release', className: 'text-gray-300' },+ Discussion: { icon: MessagesSquare, label: 'Discussion', className: 'text-gray-300' },+ Commit: { icon: GitCommitHorizontal, label: 'Commit', className: 'text-gray-300' },+ RepositoryInvitation: { icon: Mail, label: 'Invitation', className: 'text-gray-300' },+ WorkflowRun: { icon: Rocket, label: 'Workflow run', className: 'text-port-warning' },+};+const SECURITY_KIND = { icon: ShieldAlert, label: 'Security alert', className: 'text-port-error' };+// A PR or issue's icon and color follow its state, as on GitHub: green open,+// gray draft, purple merged or resolved, red closed.+const STATE_KIND = {+ PullRequest: {+ merged: { icon: GitMerge, label: 'Merged pull request', className: 'text-purple-400' },+ closed: { icon: GitPullRequestClosed, label: 'Closed pull request', className: 'text-port-error' },+ draft: { icon: GitPullRequestDraft, label: 'Draft pull request', className: 'text-gray-400' },+ open: { icon: GitPullRequest, label: 'Open pull request', className: 'text-port-success' },+ },+ Issue: {+ merged: { icon: CheckCircle2, label: 'Resolved issue', className: 'text-purple-400' },+ closed: { icon: CheckCircle2, label: 'Closed issue', className: 'text-purple-400' },+ open: { icon: CircleDot, label: 'Open issue', className: 'text-port-success' },+ },+};+const kindOf = (notification) => {+ if (notification.reason === 'security_alert') return SECURITY_KIND;+ const status = notification.subjectStatus;+ const byState = STATE_KIND[notification.subjectType];+ if (byState && status?.state) {+ return byState[status.state === 'open' && status.draft ? 'draft' : status.state] || byState.open;+ }+ return KIND_VIEW[notification.subjectType] || { icon: Bell, label: notification.subjectType || 'Notification', className: 'text-gray-400' };+};++// Where an agent run's failure can be read: its agent, else its CoS task.+const agentFailedLink = ({ agentId, taskId }) => (agentId+ ? `/cos/agents/${encodeURIComponent(agentId)}`+ : `/cos/tasks?task=${encodeURIComponent(taskId)}&source=user`);++const SUGGESTION_ICONS = { agent: Bot, done: Check, mute: BellOff };+// A suggestion button keeps its pill's color, so the row still reads the same.+const SUGGESTION_TONES = {+ accent: 'border-port-accent/40 bg-port-accent/10 text-port-accent',+ warning: 'border-port-warning/40 bg-port-warning/10 text-port-warning',+ muted: 'border-port-border bg-port-bg text-gray-200',+};++// The Automations tab's rule form, prefilled with this thread's kind and repo.+const automationRuleLink = (notification) => {+ const params = new URLSearchParams({ ruleAccount: notification.accountId, ruleKind: notification.ruleKind });+ if (notification.repoFullName) params.set('ruleRepo', notification.repoFullName);+ return `/devtools/github/automations?${params}`;+};++/** The same source-owned controls in the GitHub inbox and central Actions queue. */+export default function GitHubNotificationCard({ notification: sourceNotification, accountLabel, busy: disabled = false, onUpdated, detailTo }) {+ const [localUpdate, setLocalUpdate] = useState(null);+ const notification = localUpdate?.source === sourceNotification ? localUpdate.notification : sourceNotification;+ const [pending, setPending] = useState(false);+ const inFlight = useRef(false);+ const busy = disabled || pending;+ const refusedId = useId();+ const applyUpdate = (row, updated) => {+ setLocalUpdate({ source: sourceNotification, notification: updated });+ onUpdated?.(row, updated);+ };+ const onAction = async (row, action, run) => {+ if (disabled || inFlight.current) return false;+ inFlight.current = true;+ setPending(true);+ const updated = await (action === 'agent'+ ? resolveGitHubNotificationWithAgent(row.accountId, row.threadId, run)+ : applyGitHubNotificationAction(row.accountId, row.threadId, action)).catch(() => null);+ inFlight.current = false;+ setPending(false);+ if (updated) applyUpdate(row, updated);+ return Boolean(updated);+ };+ const [reviewing, setReviewing] = useState(false);+ const [picking, setPicking] = useState(false);+ const handled = notification.state !== 'open';+ const trust = TRUST_VIEW[notification.trust];+ const decision = DECISION_VIEW[notification.decision];+ const kind = kindOf(notification);+ const why = REASON_WHY[notification.reason];+ const statusChip = subjectStatusChip(notification.subjectType, notification.subjectStatus);+ // Every open row offers the button; a refused lane disables it with its reason.+ const agent = handled ? null : notification.agent;+ const canResolve = Boolean(agent) && !agent.refused;+ const suggestionAction = handled || notification.pullRequest ? null : DECISION_ACTIONS[notification.decision];+ const suggestion = suggestionAction ? { ...suggestionAction, icon: SUGGESTION_ICONS[suggestionAction.action] } : null;+ const startAgent = async (pin) => {+ if (await onAction(notification, 'agent', pin)) setPicking(false);+ };+ const overflow = [+ ...(handled ? [] : MORE_ACTIONS.map(({ action, label, icon }) => ({+ id: action, label, icon, disabled: busy, onSelect: () => onAction(notification, action),+ }))),+ // Handle every similar thread the same way from now on (#13192).+ ...(notification.ruleKind ? [{ id: 'add-rule', label: 'Add automation rule…', icon: ListPlus, to: automationRuleLink(notification) }] : []),+ ];+ return (+ <article className={`flex min-w-0 gap-3 border-l-4 px-3 py-3 @3xl/page:px-4 ${TONE_EDGE[handled ? 'muted' : why?.tone] || TONE_EDGE.muted}`}>+ <span className="relative mt-0.5 shrink-0">+ <kind.icon size={18} className={kind.className} aria-label={kind.label} role="img" />+ {notification.unread && <span className="absolute -right-1 -top-1 h-2 w-2 rounded-full bg-port-accent ring-2 ring-port-card" aria-label="Unread" />}+ </span>+ <div className="flex min-w-0 flex-1 flex-col gap-2 @3xl/page:grid @3xl/page:grid-cols-[minmax(0,1fr)_minmax(0,2fr)] @3xl/page:items-start">+ <div className="min-w-0 flex-1">+ <Link+ to={detailTo || `/devtools/github/inbox/${encodeURIComponent(notification.accountId)}/${notification.threadId}`}+ className={`block break-words text-sm hover:underline ${notification.unread ? 'font-semibold text-white' : 'text-gray-200'}`}+ >+ {notification.title}+ </Link>+ <div className="mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-gray-400">+ <Pill tone={why?.tone || 'muted'} size="xs">{REASON_LABELS[notification.reason] || notification.reason}</Pill>+ {statusChip && <Pill tone={statusChip.tone} size="xs">{statusChip.label}</Pill>}+ {notification.repoFullName && <span className="min-w-0 truncate font-mono">{notification.repoFullName}</span>}+ <span className="shrink-0">· {timeAgo(notification.updatedAt)}</span>+ {accountLabel && <span className="shrink-0">· {accountLabel}</span>}+ </div>+ {why && <p className="mt-1 text-xs text-gray-400">{why.text}</p>}+ {notification.deployment && (+ <p className="mt-1 min-w-0 break-words text-xs text-gray-300">+ <span className="text-white">{notification.deployment.name}</span>+ {notification.deployment.headBranch && <> on <span className="font-mono">{notification.deployment.headBranch}</span></>}+ {notification.deployment.displayTitle && <> · {notification.deployment.displayTitle}</>}+ </p>+ )}+ <div className="mt-1.5 flex flex-wrap items-center gap-1.5">+ {decision && (suggestion ? (+ <button+ type="button"+ disabled={busy || (suggestion.action === 'agent' && !canResolve)}+ onClick={() => (suggestion.action === 'agent' ? setPicking(true) : onAction(notification, suggestion.action))}+ aria-describedby={suggestion.action === 'agent' && agent?.refused ? refusedId : undefined}+ className={`inline-flex min-h-[36px] items-center gap-1 rounded-lg border px-2.5 py-1 text-xs font-medium hover:brightness-125 disabled:opacity-50 ${SUGGESTION_TONES[decision.tone] || SUGGESTION_TONES.muted}`}+ >+ <suggestion.icon size={12} aria-hidden="true" /> {suggestion.label}+ </button>+ ) : <Pill tone={decision.tone}>{decision.label}</Pill>)}+ {notification.yourRepo && <Pill tone="accent">Your repo</Pill>}+ {notification.repoPrivate && <Pill tone="muted">Private</Pill>}+ {trust && <Pill tone={trust.tone}>{trust.label}</Pill>}+ {notification.state === 'open' && !notification.unread && <Pill tone="muted">{notification.readOnGithub ? 'Read on GitHub' : 'Read'}</Pill>}+ {handled && <Pill tone="muted">{STATE_LABELS[notification.state] || notification.state}</Pill>}+ {!handled && notification.agentFailed && (+ <Link to={agentFailedLink(notification.agentFailed)} className="rounded hover:underline">+ <Pill tone="error">Agent failed</Pill>+ </Link>+ )}+ </div>+ {reviewing && (+ <GitHubDeploymentReview+ notification={notification}+ onCancel={() => setReviewing(false)}+ onReviewed={(updated) => { setReviewing(false); applyUpdate(notification, updated); }}+ />+ )}+ {picking && canResolve && (+ <GitHubAgentPinForm+ pin={agent.pin}+ label={`Agent for ${notification.title}`}+ submitLabel={busy ? 'Starting…' : 'Start agent'}+ busy={busy}+ onSubmit={startAgent}+ onCancel={() => setPicking(false)}+ />+ )}+ {agent?.refused && (+ <p id={refusedId} className="mt-1 text-xs text-gray-500">+ {AGENT_REFUSED_LABELS[agent.refused] || agent.refused}+ </p>+ )}+ </div>+ <div className="flex min-w-0 max-w-full flex-wrap items-center gap-1.5">+ {!handled && notification.deployment && !reviewing && (+ <button+ type="button"+ disabled={busy}+ onClick={() => setReviewing(true)}+ className="inline-flex min-h-[36px] items-center gap-1 rounded-lg bg-port-accent px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50"+ >+ <Rocket size={13} aria-hidden="true" /> Review deployment+ </button>+ )}+ {notification.pullRequest && <GitHubPullRequestActions notification={notification} onUpdated={applyUpdate} />}+ {agent && !picking && !notification.pullRequest && (+ <button+ type="button"+ disabled={busy || !canResolve}+ onClick={() => setPicking(true)}+ aria-describedby={agent.refused ? refusedId : undefined}+ className={`inline-flex min-h-[36px] items-center gap-1 rounded-lg px-3 py-1.5 text-xs font-medium disabled:opacity-50 ${canResolve+ ? 'bg-port-accent text-white'+ : 'border border-port-border text-gray-400'}`}+ >+ <Bot size={13} aria-hidden="true" /> Resolve with agent+ </button>+ )}+ {(handled ? [UNDO_ACTIONS[notification.state]].filter(Boolean) : [DONE_ACTION]).map(({ action, label }) => (+ <button+ key={action}+ type="button"+ disabled={busy}+ onClick={() => onAction(notification, action)}+ className="inline-flex min-h-[36px] items-center gap-1 rounded-lg border border-port-border px-3 py-1.5 text-xs text-gray-200 hover:border-gray-500 disabled:opacity-50"+ >+ {action === 'done' && <Check size={13} aria-hidden="true" />}+ {label}+ </button>+ ))}+ {notification.htmlUrl && (+ <a+ href={notification.htmlUrl}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex min-h-[36px] items-center gap-1 rounded-lg border border-port-border px-3 py-1.5 text-xs text-gray-300 hover:border-gray-500"+ >+ <ExternalLink size={12} aria-hidden="true" /> Open+ </a>+ )}+ {overflow.length > 0 && <OverflowMenu label={`More actions for ${notification.title}`} items={overflow} />}+ </div>+ </div>+ </article>+ );+}+diff --git a/client/src/hooks/useActionQueue.js b/client/src/hooks/useActionQueue.jsindex efb2d4c476..a82f2a55bf 100644--- a/client/src/hooks/useActionQueue.js+++ b/client/src/hooks/useActionQueue.js@@ -11,6 +11,7 @@ const EVENTS = ['cos:tasks:changed', 'cos:agent:completed','cos:memory:approval-needed', 'cos:memory:approved', 'cos:memory:rejected', 'cos:agent:feedback','messages:changed', 'messages:draft:created', 'messages:draft:sent',+ 'github:notifications:changed','backup:started', 'backup:completed', 'backup:failed','review:item:created', 'review:item:updated', 'review:item:deleted','review:items:bulk-updated', 'review:queue:changed',diff --git a/client/src/hooks/useActionQueue.test.jsx b/client/src/hooks/useActionQueue.test.jsxindex 6d748feaac..16c456cf68 100644--- a/client/src/hooks/useActionQueue.test.jsx+++ b/client/src/hooks/useActionQueue.test.jsx@@ -38,16 +38,20 @@ it('shares event-driven reads, reconciles reconnect/re-show, and stops on unmounexpect(mocks.getReviewQueue).toHaveBeenCalledTimes(2);await settle(() => mocks.handlers.get('connect')());expect(mocks.getReviewQueue).toHaveBeenCalledTimes(3);+ mocks.getReviewQueue.mockResolvedValue(snapshot('GitHub changed'));+ await settle(() => mocks.handlers.get('github:notifications:changed')());+ expect(screen.getByTestId('first')).toHaveTextContent('GitHub changed');+ expect(mocks.getReviewQueue).toHaveBeenCalledTimes(4);vi.spyOn(document, 'visibilityState', 'get').mockReturnValue('hidden');await settle(() => document.dispatchEvent(new Event('visibilitychange')));- expect(mocks.getReviewQueue).toHaveBeenCalledTimes(3);+ expect(mocks.getReviewQueue).toHaveBeenCalledTimes(4);vi.spyOn(document, 'visibilityState', 'get').mockReturnValue('visible');await settle(() => document.dispatchEvent(new Event('visibilitychange')));- expect(mocks.getReviewQueue).toHaveBeenCalledTimes(4);+ expect(mocks.getReviewQueue).toHaveBeenCalledTimes(5);view.unmount();expect(mocks.handlers.size).toBe(0);await settle(() => document.dispatchEvent(new Event('visibilitychange')));- expect(mocks.getReviewQueue).toHaveBeenCalledTimes(4);+ expect(mocks.getReviewQueue).toHaveBeenCalledTimes(5);});it('reconciles invalidation during a pending shared read instead of publishing stale data', async () => {let resolve;diff --git a/client/src/pages/Review.jsx b/client/src/pages/Review.jsxindex 90dbccb033..05e96fb134 100644--- a/client/src/pages/Review.jsx+++ b/client/src/pages/Review.jsx@@ -38,6 +38,7 @@ import CollapsibleText from '../components/ui/CollapsibleText';import MarkdownOutput from '../components/cos/MarkdownOutput';import Drawer from '../components/Drawer';import AgentCard from '../components/cos/tabs/AgentCard';+import GitHubNotificationCard from '../components/github/GitHubNotificationCard';import TabPills from '../components/ui/TabPills';import useUrlParams from '../hooks/useUrlParams';import useAsyncAction from '../hooks/useAsyncAction';@@ -300,6 +301,14 @@ export default function Review() {navigate(`/review/${encodeURIComponent(item.id)}?view=${actionView}`);};+ const handleGitHubUpdated = (item, notification) => {+ if (notification.state !== 'open' || !notification.unread || notification.readOnGithub) {+ handleQueueDismiss(item);+ if (actionId === item.id) navigate(`/review?view=${actionView}`, { replace: true });+ }+ void fetchQueue();+ };+const handleQueueResolve = async (item, operation, input = {}) => {if (resolvingQueueIds.has(item.id)) return;setResolvingQueueIds(prev => new Set(prev).add(item.id));@@ -502,11 +511,11 @@ export default function Review() {{!showLegacyReviewSurface && historyDisclosure}{/* Canonical Actions queue — live-pulled from Brain commitments, manual- todos, Ask, CoS, Messages, Health, and Backups. Shown whenever there+ todos, Ask, CoS, GitHub, Messages, Health, and Backups. Shown whenever thereare items OR a source failed to load (so the degraded-source noticeisn't hidden behind an otherwise-empty queue). */}{(queueItems.length > 0 || queueSourceErrors.length > 0 || queue?.partial) && (- <section className="bg-port-card border border-port-border rounded-xl p-4 space-y-3">+ <section className="@container/page bg-port-card border border-port-border rounded-xl p-4 space-y-3"><div className="flex items-center justify-between gap-3"><h2 className="text-sm font-semibold text-white flex items-center gap-2"><Inbox size={16} className="text-port-accent" />@@ -530,6 +539,8 @@ export default function Review() {onPromoteAsk={handleQueuePromoteAsk}onTriage={handleQueueTriage}onFeedbackSaved={fetchQueue}+ onGitHubUpdated={handleGitHubUpdated}+ actionLink={`/review/${encodeURIComponent(item.id)}?view=${actionView}`}detailOpen={item.id === actionId}resolving={resolvingQueueIds.has(item.id)}/>@@ -714,6 +725,7 @@ export default function Review() {onTriage={handleQueueTriage}triagePending={Boolean(actionId && resolvingQueueIds.has(actionId))}onSaved={fetchQueue}+ onGitHubUpdated={handleGitHubUpdated}onDrill={handleQueueDrill}/></div>@@ -899,10 +911,33 @@ function QueueTriageControls({ item, onTriage, disabled = false }) {);}-function QueueRow({ item, onSelect, onDrill, onResolve, onPromoteAsk, onTriage, onFeedbackSaved, detailOpen = false, resolving = false }) {+function QueueRow({ item, onSelect, onDrill, onResolve, onPromoteAsk, onTriage, onFeedbackSaved, onGitHubUpdated, actionLink, detailOpen = false, resolving = false }) {+ const borderTone = QUEUE_SEVERITY_STYLE[item.severity] || QUEUE_SEVERITY_STYLE.normal;+ if (item.source === 'github' && item.githubNotification) {+ return (+ <div className={`min-w-0 rounded-lg border bg-port-card ${borderTone}`}>+ <p className="px-3 pt-2 text-xs font-medium text-port-warning">{item.sourceLabel}</p>+ {detailOpen ? (+ <button type="button" onClick={() => onSelect?.(item)} className="min-h-[44px] px-3 py-2 text-left text-sm text-white break-words">{item.title}</button>+ ) : (+ <GitHubNotificationCard+ notification={item.githubNotification}+ accountLabel={item.githubNotification.accountLabel}+ detailTo={actionLink}+ onUpdated={(_row, updated) => onGitHubUpdated(item, updated)}+ />+ )}+ {!detailOpen && item.triageOperations?.length > 0 && (+ <div className="flex flex-wrap gap-2 border-t border-port-border px-3 py-2">+ <QueueTriageControls item={item} onTriage={onTriage} disabled={resolving} />+ </div>+ )}+ </div>+ );+ }+const config = QUEUE_SOURCE_CONFIG[item.source] || { icon: Inbox, color: 'text-gray-400' };const Icon = config.icon;- const borderTone = QUEUE_SEVERITY_STYLE[item.severity] || QUEUE_SEVERITY_STYLE.normal;const pullRequestUrl = safeExternalHttpUrl(item.meta?.reviewLoopPRUrl);const promoteTargets = Array.isArray(item.promoteTargets) ? item.promoteTargets : [];const goalOptions = Array.isArray(item.goalOptions) ? item.goalOptions : [];@@ -922,7 +957,6 @@ function QueueRow({ item, onSelect, onDrill, onResolve, onPromoteAsk, onTriage,const inlineActions = item.action? [{ id: 'resolve', label: item.action }]: sourceOperations.filter((operation) => operation.id !== 'rate');-return (<div className={`grid grid-cols-[auto_minmax(0,1fr)] items-start gap-3 p-3 rounded-lg border bg-port-card ${borderTone}`}><div className={`mt-0.5 shrink-0 ${config.color}`}>@@ -1231,7 +1265,7 @@ const threadDraft = (record) => ({notes: record?.notes || '',});-function ActionDetail({ item, onClose, onResolve, onTriage, triagePending = false, onSaved, onDrill }) {+function ActionDetail({ item, onClose, onResolve, onTriage, triagePending = false, onSaved, onGitHubUpdated, onDrill }) {const isThread = item?.source === 'threads';const isTodo = item?.source === 'todo';const [record, setRecord] = useState(item);@@ -1308,18 +1342,27 @@ function ActionDetail({ item, onClose, onResolve, onTriage, triagePending = falscloseLabel="Close action"><div className="space-y-5">- <div className="space-y-2">- <p className="text-sm text-gray-300">{item.summary || 'No additional context.'}</p>- <div className="flex flex-wrap gap-2 text-xs">- {localStatus && <span className="rounded border border-port-accent/30 px-2 py-1 text-port-accent">Commitment: {localStatus}</span>}- {item.meta?.taskStatus && <span className={`rounded border px-2 py-1 ${item.meta.taskStatus === 'blocked' ? 'border-port-warning/30 text-port-warning' : 'border-port-border text-gray-400'}`}>Task: {item.meta.taskStatus}</span>}- {item.meta?.blockedCategory && <span className="rounded border border-port-warning/30 px-2 py-1 text-port-warning">Block: {item.meta.blockedCategory}</span>}- {externalState && <span className="rounded border border-port-border px-2 py-1 text-gray-400">External: {externalState}</span>}- {item.meta?.externalSource && <span className="rounded border border-port-border px-2 py-1 text-gray-400">Source: {item.meta.externalSource}</span>}- {item.meta?.appLabel && <span className="rounded border border-port-border px-2 py-1 text-gray-400">App: {item.meta.appLabel}</span>}+ {item.source === 'github' && item.githubNotification ? (+ <GitHubNotificationCard+ key={item.id}+ notification={item.githubNotification}+ accountLabel={item.githubNotification.accountLabel}+ onUpdated={(_row, updated) => onGitHubUpdated(item, updated)}+ />+ ) : (+ <div className="space-y-2">+ <p className="text-sm text-gray-300">{item.summary || 'No additional context.'}</p>+ <div className="flex flex-wrap gap-2 text-xs">+ {localStatus && <span className="rounded border border-port-accent/30 px-2 py-1 text-port-accent">Commitment: {localStatus}</span>}+ {item.meta?.taskStatus && <span className={`rounded border px-2 py-1 ${item.meta.taskStatus === 'blocked' ? 'border-port-warning/30 text-port-warning' : 'border-port-border text-gray-400'}`}>Task: {item.meta.taskStatus}</span>}+ {item.meta?.blockedCategory && <span className="rounded border border-port-warning/30 px-2 py-1 text-port-warning">Block: {item.meta.blockedCategory}</span>}+ {externalState && <span className="rounded border border-port-border px-2 py-1 text-gray-400">External: {externalState}</span>}+ {item.meta?.externalSource && <span className="rounded border border-port-border px-2 py-1 text-gray-400">Source: {item.meta.externalSource}</span>}+ {item.meta?.appLabel && <span className="rounded border border-port-border px-2 py-1 text-gray-400">App: {item.meta.appLabel}</span>}+ </div>+ {pullRequestUrl && <a href={pullRequestUrl} target="_blank" rel="noopener noreferrer" className="inline-flex min-h-[44px] items-center gap-1 text-sm text-port-accent hover:underline"><ExternalLink size={14} /> Open pull request</a>}</div>- {pullRequestUrl && <a href={pullRequestUrl} target="_blank" rel="noopener noreferrer" className="inline-flex min-h-[44px] items-center gap-1 text-sm text-port-accent hover:underline"><ExternalLink size={14} /> Open pull request</a>}- </div>+ )}{(isThread || isTodo) && (<section className="space-y-3">diff --git a/client/src/pages/Review.test.jsx b/client/src/pages/Review.test.jsxindex a220ebf900..9818168815 100644--- a/client/src/pages/Review.test.jsx+++ b/client/src/pages/Review.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';-import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';+import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react';// A CoS action body is arbitrary agent-authored markdown — thousands of words,// its own heading outline, and raw technical payloads. This is the shape that@@ -105,7 +105,13 @@ vi.mock('../services/api', () => ({promoteAskReviewQueueItem: vi.fn(() => Promise.resolve({})),getCosAgent: vi.fn(),submitCosAgentFeedback: vi.fn(),- normalizeBrainScanReportPath: vi.fn((p) => p)+ normalizeBrainScanReportPath: vi.fn((p) => p),+ applyGitHubNotificationAction: vi.fn(),+ resolveGitHubNotificationWithAgent: vi.fn(),+ actOnGitHubNotificationPullRequest: vi.fn(),+ getGitHubDeploymentReview: vi.fn(),+ reviewGitHubDeployment: vi.fn(),+ getProviders: vi.fn(() => Promise.resolve({ providers: [] })),}));vi.mock('../services/socket', () => ({@@ -156,6 +162,88 @@ beforeEach(() => {const actionQueueBody = () => document.getElementById(`review-item-body-action-queue-${ITEM.id}`);+const GITHUB_NOTIFICATION = {+ accountId: 'example-account', accountLabel: 'Example account', threadId: '42',+ title: 'Example GitHub review', repoFullName: 'acme/app', subjectType: 'PullRequest',+ reason: 'review_requested', state: 'open', unread: true, readOnGithub: false,+ updatedAt: '2026-10-20T12:00:00.000Z', ruleKind: 'review-requested',+ agent: { refused: null, pin: null }, htmlUrl: 'https://github.com/acme/app/pull/42',+};+const githubQueue = (notification = GITHUB_NOTIFICATION) => ({+ items: [{+ id: 'github:example-account/42', source: 'github', sourceLabel: 'GitHub alerts', required: true,+ title: notification.title, revision: notification.updatedAt, operations: [],+ drillTo: '/devtools/github/inbox/example-account/42', githubNotification: notification,+ }], sources: { github: { label: 'GitHub alerts', total: 1 } }, partial: false,+});++describe('GitHub alerts in central Actions', () => {+ beforeEach(() => api.getReviewQueue.mockReset().mockResolvedValue({ items: [], sources: {}, partial: false }));+ afterEach(() => api.getReviewQueue.mockReset().mockResolvedValue({ items: [], sources: {}, partial: false }));+ it('uses the inbox controls and clears a handled alert immediately while the queue refresh is pending', async () => {+ api.getReviewQueue.mockResolvedValueOnce(githubQueue()).mockImplementationOnce(() => new Promise(() => {}));+ api.applyGitHubNotificationAction.mockResolvedValue({ ...GITHUB_NOTIFICATION, state: 'done', unread: false });+ render(<Review />);+ const title = await screen.findByRole('link', { name: GITHUB_NOTIFICATION.title });+ expect(title).toHaveAttribute('href', '/review/github%3Aexample-account%2F42?view=today');+ expect(screen.getByText('GitHub alerts')).toBeInTheDocument();+ expect(screen.getByText(/1 required/)).toBeInTheDocument();+ const card = title.closest('article');+ expect(within(card).getByRole('link', { name: 'Open' })).toHaveAttribute('href', GITHUB_NOTIFICATION.htmlUrl);+ fireEvent.click(within(card).getByRole('button', { name: /More actions/ }));+ expect(screen.getByRole('menuitem', { name: 'Mute' })).toBeInTheDocument();+ expect(screen.getByRole('menuitem', { name: 'Unsubscribe' })).toBeInTheDocument();+ expect(screen.getByRole('link', { name: /Add automation rule/ })).toHaveAttribute('href', expect.stringContaining('/devtools/github/automations?'));+ fireEvent.click(within(card).getByRole('button', { name: 'Done' }));+ await waitFor(() => expect(screen.queryByRole('link', { name: GITHUB_NOTIFICATION.title })).not.toBeInTheDocument());+ expect(api.applyGitHubNotificationAction).toHaveBeenCalledWith('example-account', '42', 'done');+ expect(api.resolveReviewQueueItem).not.toHaveBeenCalled();+ });++ it('keeps failed actions visible and preserves the server refusal for suspicious alerts', async () => {+ api.getReviewQueue.mockResolvedValueOnce(githubQueue({ ...GITHUB_NOTIFICATION, suspect: true, agent: { refused: 'suspect' } }));+ api.applyGitHubNotificationAction.mockRejectedValueOnce(new Error('Unavailable'));+ render(<Review />);+ await screen.findByRole('link', { name: GITHUB_NOTIFICATION.title });+ expect(screen.getByRole('button', { name: 'Resolve with agent' })).toBeDisabled();+ fireEvent.click(screen.getByRole('button', { name: 'Done' }));+ await waitFor(() => expect(api.applyGitHubNotificationAction).toHaveBeenCalled());+ expect(screen.getByRole('link', { name: GITHUB_NOTIFICATION.title })).toBeInTheDocument();+ });++ it('offers PR review and merge controls and applies their response in place', async () => {+ const notification = { ...GITHUB_NOTIFICATION,+ pullRequest: { number: 42, mergeEligible: true, doReviewEligible: true, reviewEligible: false },+ };+ api.getReviewQueue.mockResolvedValueOnce(githubQueue(notification)).mockImplementationOnce(() => new Promise(() => {}));+ api.actOnGitHubNotificationPullRequest.mockResolvedValue({ merged: true,+ notification: { ...notification, pullRequest: null, decision: 'suggest-mark-read' },+ });+ render(<Review />);+ expect(await screen.findByRole('button', { name: 'Do:Review' })).toBeInTheDocument();+ expect(screen.queryByRole('button', { name: 'Resolve with agent' })).not.toBeInTheDocument();+ fireEvent.click(screen.getByRole('button', { name: 'Merge' }));+ fireEvent.click(screen.getByRole('button', { name: 'Merge #42' }));+ await waitFor(() => expect(api.actOnGitHubNotificationPullRequest).toHaveBeenCalledWith('example-account', '42',+ { action: 'merge', method: 'merge', deleteBranch: false }, { silent: true }));+ expect(await screen.findByRole('button', { name: 'Mark done' })).toBeInTheDocument();+ expect(screen.queryByRole('button', { name: 'Merge' })).not.toBeInTheDocument();+ });++ it('offers the full deployment review from a notification deep link', async () => {+ routerState.actionId = 'github:example-account/42';+ const notification = { ...GITHUB_NOTIFICATION, deployment: { name: 'Example deployment', runId: 12 } };+ api.getReviewQueue.mockResolvedValueOnce(githubQueue(notification));+ api.getGitHubDeploymentReview.mockResolvedValue({ environments: [{ environmentId: 7, name: 'Staging', canApprove: true, reviewers: [] }] });+ api.reviewGitHubDeployment.mockResolvedValue({ ...notification, state: 'done', unread: false });+ render(<Review />);+ fireEvent.click(await screen.findByRole('button', { name: 'Review deployment' }));+ fireEvent.click(await screen.findByRole('button', { name: 'Approve and deploy' }));+ await waitFor(() => expect(api.reviewGitHubDeployment).toHaveBeenCalledWith('example-account', '42', { state: 'approved', environmentIds: [7] }));+ expect(routerState.navigate).toHaveBeenCalledWith('/review?view=today', { replace: true });+ });+});+// Wait for the toggle that controls one specific element. `findAllByRole`// alone is not enough: a forceToggle card renders its toggle on the first// paint, so the query resolves before the overflow-measuring passive effectsdiff --git a/server/services/githubNotifications.db.test.js b/server/services/githubNotifications.db.test.jsindex 20e957d717..9af973a09b 100644--- a/server/services/githubNotifications.db.test.js+++ b/server/services/githubNotifications.db.test.js@@ -46,7 +46,7 @@ const { runUntrustedContentAnalysis } = await import('./untrustedContent.js');const { createAccount, updateAccount } = await import('./githubAccounts.js');const { __testing: { listAutopilotCandidates, candidateFilter } } = await import('./githubNotificationAutopilot.js');const {- syncAccountNotifications, syncAllNotifications, listNotifications, applyNotificationAction, clearFinishedNotifications, getNotification, runScheduledNotificationCheck, describeScheduledCheck,+ syncAccountNotifications, syncAllNotifications, listNotifications, listActionableNotifications, applyNotificationAction, clearFinishedNotifications, getNotification, runScheduledNotificationCheck, describeScheduledCheck,listAutomationActivity, undoAutomationAction, listLearnedRules, resolveWithAgent, actOnPullRequest, getAutomationsOverview, setNotificationCadence,} = await import('./githubNotifications.js');const { getDeploymentReview, reviewDeployment } = await import('./githubNotificationDeployment.js');@@ -154,6 +154,37 @@ describe.skipIf(!runDb)('GitHub notifications inbox against Postgres', () => {accountIds.push(account.id);});+ // Central Actions must use the inbox's projection and never fetch GitHub on read.+ it('projects unread open alerts across accounts, including suspect items, and removes handled or disabled sources', async () => {+ const second = await createAccount({ host: 'github.com', login: `other${accountIds.length}`, label: 'Other example' });+ accountIds.push(second.id);+ mockGh(args => githubListing(args, [thread('9001'), thread('9002'), thread('9003'), thread('9004')]));+ await syncAccountNotifications(account.id, { automate: false });+ await syncAccountNotifications(second.id, { automate: false });+ await query("UPDATE github_notifications SET suspect = TRUE WHERE account_id = $1 AND thread_id = '9002'", [account.id]);+ await query("UPDATE github_notifications SET unread = FALSE WHERE account_id = $1 AND thread_id = '9003'", [account.id]);+ await query("UPDATE github_notifications SET read_on_github_at = NOW() WHERE account_id = $1 AND thread_id = '9004'", [account.id]);+ await updateAccount(second.id, { enabled: false });+ vi.mocked(execGh).mockClear();++ const rows = (await listActionableNotifications()).filter(row => row.accountId === account.id || row.accountId === second.id);+ expect(rows.map(row => row.threadId).sort()).toEqual(['9001', '9002']);+ const inbox = (await listNotifications({ accountId: account.id })).notifications.find(row => row.threadId === '9001');+ expect(rows.find(row => row.threadId === '9001')).toEqual({ ...inbox, accountLabel: account.label });+ expect(rows.find(row => row.threadId === '9002')).toMatchObject({ suspect: true, agent: { refused: 'suspect' } });+ expect(await listActionableNotifications({ limit: 1 })).toHaveLength(1);+ expect(execGh).not.toHaveBeenCalled();++ for (const action of ['mute', 'unsubscribe', 'done']) {+ await applyNotificationAction(account.id, '9001', action);+ expect((await listActionableNotifications()).some(row => row.accountId === account.id && row.threadId === '9001')).toBe(false);+ if (action !== 'done') {+ await applyNotificationAction(account.id, '9001', 'resubscribe');+ expect((await listActionableNotifications()).some(row => row.accountId === account.id && row.threadId === '9001')).toBe(true);+ }+ }+ });+// Regression: CI can finish without a new notification or conditional-listing change.it('rechecks pending Dependabot PRs on later syncs and merges only the passing exact head without a model call', async () => {await updateAccount(account.id, { mode: 'autopilot', agentRules: [{ id: 'deps', kind: 'dependabot-pr', repo: '*', action: 'merge', mergeMethod: 'squash', deleteBranch: false }] });diff --git a/server/services/githubNotifications.js b/server/services/githubNotifications.jsindex 431f2a6513..9d61f16b8c 100644--- a/server/services/githubNotifications.js+++ b/server/services/githubNotifications.js@@ -303,9 +303,10 @@ export async function syncAllNotifications(options = {}) {// can clear finished or read threads in one tap without teaching a rule.const FINISHED_SQL = `decision IN (${FINISHED_DECISIONS.map((decision) => `'${decision}'`).join(', ')})`;const CLEARABLE_SQL = `state = 'open' AND NOT suspect AND (${FINISHED_SQL} OR NOT unread)`;+const OPEN_UNREAD_SQL = "state = 'open' AND unread AND read_on_github_at IS NULL";const VIEW_FILTERS = {- 'needs-you': "state = 'open' AND unread AND read_on_github_at IS NULL AND NOT suspect",- suspect: "state = 'open' AND unread AND read_on_github_at IS NULL AND suspect",+ 'needs-you': `${OPEN_UNREAD_SQL} AND NOT suspect`,+ suspect: `${OPEN_UNREAD_SQL} AND suspect`,handled: "(state <> 'open' OR NOT unread OR read_on_github_at IS NOT NULL)",all: 'TRUE',};@@ -381,6 +382,18 @@ const toApi = (row, accountsById) => {};};+/** Local projection only: opening Actions never starts a GitHub sync or model call. */+export async function listActionableNotifications({ limit = 100 } = {}) {+ const accounts = (await listAccounts()).filter(isActive);+ if (!accounts.length) return [];+ const accountsById = new Map(accounts.map((account) => [account.id, account]));+ const { rows } = await query(+ `SELECT * FROM github_notifications WHERE account_id = ANY($1::text[]) AND ${OPEN_UNREAD_SQL}+ ORDER BY gh_updated_at DESC, account_id, thread_id LIMIT $2`,+ [accounts.map((account) => account.id), limit],+ );+ return rows.map((row) => ({ ...toApi(row, accountsById), accountLabel: accountsById.get(row.account_id).label }));+}export async function listNotifications({ accountId = null, view = 'needs-you' } = {}) {const accounts = await listAccounts();diff --git a/server/services/reviewQueue.js b/server/services/reviewQueue.jsindex d7582d0025..09b1eb80e6 100644--- a/server/services/reviewQueue.js+++ b/server/services/reviewQueue.js@@ -97,6 +97,7 @@ const ACTION_KINDS = Object.freeze({todo: 'review.todo',history: 'review.history',feedback: 'cos.feedback',+ github: 'github.notification',product: 'product.recommendation',});@@ -115,6 +116,7 @@ const OPERATION_LABELS = Object.freeze({todo: 'Complete',history: 'History',feedback: 'Rate',+ github: 'Review',});const PRIORITY_ORDER = { HIGH: 0, MEDIUM: 1, LOW: 2 };@@ -634,6 +636,31 @@ const PRODUCERS = [return item;},},+ {+ source: 'github',+ label: 'GitHub alerts',+ drillTo: '/devtools/github/inbox',+ async gather(limit = REVIEW_QUEUE_SOURCE_READ_LIMIT) {+ const { listActionableNotifications } = await import('./githubNotifications.js');+ return listActionableNotifications({ limit });+ },+ map(notification) {+ const sourceRef = `${notification.accountId}/${notification.threadId}`;+ return {+ id: `github:${sourceRef}`,+ sourceRef,+ title: notification.title,+ summary: notification.repoFullName || 'GitHub notification needs attention',+ timestamp: notification.updatedAt,+ severity: notification.suspect || notification.reason === 'security_alert' ? 'high' : 'normal',+ drillTo: `/devtools/github/inbox/${encodeURIComponent(notification.accountId)}/${notification.threadId}`,+ nextAction: 'Review GitHub notification',+ // The shared card uses the source endpoints, preserving their authority checks.+ operations: [],+ githubNotification: notification,+ };+ },+ },{source: 'stacker',label: 'Stacker News approvals',diff --git a/server/services/reviewQueue.test.js b/server/services/reviewQueue.test.jsindex cbc7f2d8ed..2b71e9dad1 100644--- a/server/services/reviewQueue.test.js+++ b/server/services/reviewQueue.test.js@@ -27,6 +27,7 @@ const askPromote = { promoteLatestAssistantTurn: vi.fn() };const identity = { getGoals: vi.fn() };const stackerNews = { listPendingReviewActions: vi.fn() };const x = { listPendingReviewActions: vi.fn() };+const githubNotifications = { listActionableNotifications: vi.fn() };const userTimezone = { getUserTimezone: vi.fn() };const reviewQueueTriageStore = {listReviewQueueTriage: vi.fn(),@@ -63,6 +64,7 @@ vi.mock('./identity.js', () => identity);vi.mock('./askPromote.js', () => askPromote);vi.mock('./stackerNews.js', () => stackerNews);vi.mock('./x.js', () => x);+vi.mock('./githubNotifications.js', () => githubNotifications);vi.mock('./userTimezone.js', () => userTimezone);vi.mock('./reviewQueueTriageStore.js', () => reviewQueueTriageStore);@@ -104,6 +106,7 @@ function resetEmpty() {identity.getGoals.mockResolvedValue({ goals: [] });stackerNews.listPendingReviewActions.mockResolvedValue([]);x.listPendingReviewActions.mockResolvedValue([]);+ githubNotifications.listActionableNotifications.mockResolvedValue([]);userTimezone.getUserTimezone.mockResolvedValue('UTC');reviewQueueTriageStore.listReviewQueueTriage.mockResolvedValue([]);reviewQueueTriageStore.upsertReviewQueueTriage.mockResolvedValue(undefined);@@ -160,6 +163,51 @@ describe('reviewQueue.buildQueue', () => {});});+ it('projects account-scoped GitHub alerts with the full inbox card payload and renewed activity', async () => {+ const notification = {+ accountId: 'example-account', threadId: '123', accountLabel: 'Example account',+ title: 'Review the example change', repoFullName: 'acme/app', reason: 'review_requested',+ state: 'open', unread: true, updatedAt: '2026-10-20T10:00:00.000Z',+ pullRequest: { number: 42, reviewEligible: true }, agent: { refused: null, pin: null },+ };+ githubNotifications.listActionableNotifications.mockResolvedValue([+ notification,+ { ...notification, accountId: 'other-account', suspect: true },+ ]);+ const queue = await buildQueue({ query: { view: 'today' } });+ const row = queue.items.find((item) => item.id === 'github:example-account/123');+ expect(row).toMatchObject({+ source: 'github', sourceRef: 'example-account/123', sourceLabel: 'GitHub alerts',+ actionKind: 'github.notification', required: true, operations: [],+ revision: notification.updatedAt, githubNotification: notification,+ drillTo: '/devtools/github/inbox/example-account/123',+ });+ expect(queue.sources.github.total).toBe(2);+ expect(queue.items.find((item) => item.id === 'github:other-account/123').severity).toBe('high');+ const snoozed = applyQueueTriage(queue.items, [{+ ...queueActionIdentity(row), snoozedUntil: '2026-10-25T10:00:00.000Z',+ }], new Date('2026-10-23T10:00:00.000Z'));+ expect(snoozed.map((item) => item.id)).not.toContain(row.id);+ githubNotifications.listActionableNotifications.mockResolvedValue([{ ...notification, updatedAt: '2026-10-23T11:00:00.000Z' }]);+ const renewed = await buildQueue();+ expect(applyQueueTriage(renewed.items, [{+ ...queueActionIdentity(row), snoozedUntil: '2026-10-25T10:00:00.000Z',+ }], new Date('2026-10-23T12:00:00.000Z')).map((item) => item.id)).toContain(row.id);+ });++ it('reports a failed or capped GitHub read without claiming the central inbox is clear', async () => {+ githubNotifications.listActionableNotifications.mockRejectedValueOnce(new Error('read unavailable'));+ expect(await buildQueue()).toMatchObject({+ partial: true, total: null, sources: { github: { total: null, available: false } },+ });+ githubNotifications.listActionableNotifications.mockResolvedValue(Array.from({ length: REVIEW_QUEUE_SOURCE_READ_LIMIT + 1 }, (_, index) => ({+ accountId: 'example', threadId: String(index), title: 'Example alert',+ })));+ expect(await buildQueue()).toMatchObject({+ partial: true, sources: { github: { total: null, truncation: true, lowerBound: REVIEW_QUEUE_SOURCE_READ_LIMIT } },+ });+ });+it('admits product recommendations once per occurrence below required work', async () => {brain.getInboxLog.mockResolvedValue([{ id: 'required-1', capturedText: 'required work' }]);productMetrics.getProductEngagement.mockResolvedValue({