Skip to content

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

fix: retire resolved PR action cards

[._.]/ Adam Eivy026c48768bb6
diff --git a/client/src/pages/Review.jsx b/client/src/pages/Review.jsx
index 2f54c340c7..4f0984e484 100644
--- a/client/src/pages/Review.jsx
+++ b/client/src/pages/Review.jsx
@@ -68,6 +68,16 @@ const QUEUE_SEVERITY_STYLE = {
normal: 'border-port-border'
};
+const safeExternalHttpUrl = (value) => {
+ if (typeof value !== 'string' || !value.trim()) return null;
+ try {
+ const url = new URL(value);
+ return ['http:', 'https:'].includes(url.protocol) ? url.href : null;
+ } catch {
+ return null;
+ }
+};
+
const TYPE_CONFIG = {
alert: { label: 'Alerts', icon: AlertTriangle, color: 'text-port-warning' },
cos: { label: 'CoS Actions', icon: Crown, color: 'text-port-accent' },
@@ -709,6 +719,28 @@ function QueueMetaChips({ meta }) {
</span>
);
}
+ if (typeof meta.appLabel === 'string' && meta.appLabel) {
+ chips.push(
+ <span key="app" className="text-[10px] px-1.5 py-0.5 rounded border border-port-border text-gray-400 max-w-[14rem] truncate" title={meta.appLabel}>
+ App: {meta.appLabel}
+ </span>
+ );
+ }
+ if (typeof meta.taskStatus === 'string' && meta.taskStatus) {
+ const blocked = meta.taskStatus === 'blocked';
+ chips.push(
+ <span key="task-status" className={`text-[10px] px-1.5 py-0.5 rounded border ${blocked ? 'border-port-warning/30 bg-port-warning/10 text-port-warning' : 'border-port-border text-gray-400'}`}>
+ Task: {meta.taskStatus}
+ </span>
+ );
+ }
+ if (typeof meta.blockedCategory === 'string' && meta.blockedCategory) {
+ chips.push(
+ <span key="blocked-category" className="text-[10px] px-1.5 py-0.5 rounded border border-port-warning/30 text-port-warning">
+ Block: {meta.blockedCategory}
+ </span>
+ );
+ }
if (meta.alertType) {
chips.push(
<span key="alert" className="text-[10px] px-1.5 py-0.5 rounded border border-port-border text-gray-400">
@@ -822,6 +854,7 @@ function QueueRow({ item, onSelect, onDrill, onResolve, onPromoteAsk, onTriage,
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 : [];
// The goal target needs a goalId, so it's rendered as a picker rather than a
@@ -859,6 +892,16 @@ function QueueRow({ item, onSelect, onDrill, onResolve, onPromoteAsk, onTriage,
<p className="text-xs text-gray-500 mt-0.5 line-clamp-2 break-words">{item.summary}</p>
)}
<QueueMetaChips meta={item.meta} />
+ {pullRequestUrl && (
+ <a
+ href={pullRequestUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="mt-1 inline-flex min-h-[32px] items-center gap-1 text-xs text-port-accent hover:underline"
+ >
+ <ExternalLink size={12} /> Open pull request
+ </a>
+ )}
{item.timestamp && (
<p className="text-xs text-gray-600 mt-1 flex items-center gap-1">
<Clock3 size={12} />
@@ -1189,6 +1232,7 @@ function ActionDetail({ item, onClose, onResolve, onTriage, triagePending = fals
: [];
const localStatus = item.meta?.localStatus || record?.status || item.meta?.status;
const externalState = item.meta?.externalState;
+ const pullRequestUrl = safeExternalHttpUrl(item.meta?.reviewLoopPRUrl);
const updateDraft = (patch) => setDraft((previous) => ({ ...previous, ...patch }));
const resolve = async (operation, input = {}) => {
const ok = await onResolve(item, operation, input);
@@ -1208,10 +1252,14 @@ function ActionDetail({ item, onClose, onResolve, onTriage, triagePending = fals
<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">Local: {localStatus}</span>}
+ {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>
{(isThread || isTodo) && (
diff --git a/client/src/pages/Review.test.jsx b/client/src/pages/Review.test.jsx
index 7154d9c5dd..63121312c0 100644
--- a/client/src/pages/Review.test.jsx
+++ b/client/src/pages/Review.test.jsx
@@ -265,6 +265,38 @@ describe('Review Hub queue-card triage (#3282)', () => {
));
});
+ it('shows linked app and blocked task context with a direct PR link', async () => {
+ const item = {
+ id: 'threads:pr-follow-up',
+ source: 'threads',
+ sourceLabel: 'Brain commitments',
+ title: 'PR follow-up needs attention',
+ summary: 'Fix the merge follow-up or merge the PR manually. Still blocked: Repository path is unavailable.',
+ timestamp: '2026-09-24T20:00:00.000Z',
+ drillTo: '/brain/threads?thread=pr-follow-up',
+ operations: [{ id: 'complete', label: 'Complete', available: true }],
+ meta: {
+ localStatus: 'open',
+ taskStatus: 'blocked',
+ blockedCategory: 'app-unresolved',
+ appLabel: 'Example Repo',
+ reviewLoopPRUrl: 'https://github.com/example-org/example-repo/pull/9',
+ },
+ };
+ api.getReviewQueue.mockResolvedValueOnce({ items: [item], sources: {}, partial: false });
+
+ render(<Review />);
+
+ expect(await screen.findByText(item.summary)).toBeInTheDocument();
+ expect(screen.getByText('App: Example Repo')).toBeInTheDocument();
+ expect(screen.getByText('Task: blocked')).toBeInTheDocument();
+ expect(screen.getByText('Block: app-unresolved')).toBeInTheDocument();
+ const openPr = screen.getByRole('link', { name: 'Open pull request' });
+ expect(openPr).toHaveAttribute('href', item.meta.reviewLoopPRUrl);
+ expect(openPr).toHaveAttribute('target', '_blank');
+ expect(openPr).toHaveAttribute('rel', 'noopener noreferrer');
+ });
+
it('shows durable snooze and recommendation-dismiss controls', async () => {
api.getReviewQueue.mockResolvedValueOnce({ items: [TRIAGE_RECOMMENDATION], sources: {}, partial: false });
diff --git a/server/services/cos.js b/server/services/cos.js
index 3c26d3aee2..5d49400041 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -1591,11 +1591,11 @@ export async function init() {
});
// A task that was going to MERGE a pull request just got blocked — surface the
- // PR it left orphaned. Registered separately from the dequeue listener above
- // because it must fire on a transition that listener has no branch for
- // (→ blocked), and it is not gated on `isDaemonRunning()`: a block that lands
- // as the daemon stops still strands its PR. See orphanedPrNotifier.js for why
- // nothing else ever recovers these.
+ // current blocker and PR link. Registered separately from the dequeue listener
+ // above because it must fire on a transition that listener has no branch for
+ // (→ blocked), and it is not gated on `isDaemonRunning()`: even while stopped,
+ // the notification and Brain commitment preserve the next action. The
+ // development watchdog later retires the task if the PR is already terminal.
cosEvents.on('tasks:changed', (data) => {
notifyIfPrLeftOrphaned(data)
.catch(err => console.error(`❌ Orphaned-PR check failed for task ${data?.task?.id}: ${err.message}`));
diff --git a/server/services/developmentWatchdog.js b/server/services/developmentWatchdog.js
index b7804d49f3..8783fc5607 100644
--- a/server/services/developmentWatchdog.js
+++ b/server/services/developmentWatchdog.js
@@ -136,7 +136,7 @@ async function inspectApp(app, tasks, localReviewTasks = [], activeAgentTaskIds
if (localReviewTasks.length) {
const { getPullRequestState } = await import('./github.js');
const openNumbers = new Set(row.pullRequests.map(pr => Number(pr.number)));
- const candidates = localReviewTasks.filter(task => task.status === 'pending'
+ const candidates = localReviewTasks.filter(task => ['pending', 'blocked'].includes(task.status)
&& task.metadata?.app === app.id && !activeAgentTaskIds.has(task.id))
.map(task => ({ task, number: reviewFollowUpPrNumber(task, target) }))
.filter(candidate => candidate.number && !openNumbers.has(candidate.number));
@@ -149,7 +149,7 @@ async function inspectApp(app, tasks, localReviewTasks = [], activeAgentTaskIds
}
const state = states.get(candidate.number);
if (state?.status === 'known' && ['MERGED', 'CLOSED'].includes(state.state)) {
- row.terminalReviewFollowUps.push({ taskId: candidate.task.id, prNumber: candidate.number, prState: state.state });
+ row.terminalReviewFollowUps.push({ taskId: candidate.task.id, prNumber: candidate.number, prState: state.state, status: candidate.task.status });
}
}
}
@@ -185,8 +185,15 @@ async function retireTerminalReviewFollowUps(app, row) {
const reason = followUp.prState === 'MERGED' ? 'pull-request-merged-before-follow-up' : 'pull-request-closed-before-follow-up';
const result = await updateTask(followUp.taskId, {
status: 'completed', metadata: { reviewLoopRetiredReason: reason },
- }, 'internal', { expectedStatus: 'pending', suppressDequeue: true });
- if (result?.status === 'completed') row.retiredReviewFollowUps.push({ ...followUp, reason });
+ }, 'internal', { expectedStatus: followUp.status, suppressDequeue: true });
+ if (result?.status === 'completed') {
+ row.retiredReviewFollowUps.push({
+ taskId: followUp.taskId,
+ prNumber: followUp.prNumber,
+ prState: followUp.prState,
+ reason,
+ });
+ }
}
}
diff --git a/server/services/developmentWatchdog.test.js b/server/services/developmentWatchdog.test.js
index 122fc5a632..45f1a758d5 100644
--- a/server/services/developmentWatchdog.test.js
+++ b/server/services/developmentWatchdog.test.js
@@ -142,6 +142,50 @@ it('retires a pending review follow-up when the forge confirms its PR is already
}]);
});
+it('retires a blocked review follow-up when the forge confirms its PR is already terminal', async () => {
+ const task = {
+ id: 'sys-rl-blocked', status: 'blocked',
+ metadata: {
+ app: 'app', reviewLoopFollowUp: true, reviewLoopPRNumber: '7', reviewLoopPRHost: 'github.com',
+ reviewLoopPROwner: 'atomantic', reviewLoopPRRepo: 'example',
+ reviewLoopPRUrl: 'https://github.com/atomantic/example/pull/7',
+ },
+ };
+ m.tasks = [task];
+ m.prStates['7'] = { status: 'known', state: 'MERGED' };
+
+ const receipt = await runDevelopmentWatchdog({ force: true });
+
+ expect(m.updates).toEqual([expect.objectContaining({
+ id: task.id,
+ updates: { status: 'completed', metadata: { reviewLoopRetiredReason: 'pull-request-merged-before-follow-up' } },
+ type: 'internal', options: { expectedStatus: 'blocked', suppressDequeue: true },
+ })]);
+ expect(task.status).toBe('completed');
+ expect(receipt.apps[0].retiredReviewFollowUps).toEqual([{
+ taskId: task.id, prNumber: 7, prState: 'MERGED', reason: 'pull-request-merged-before-follow-up',
+ }]);
+});
+
+it('keeps a blocked follow-up when its PR is still open', async () => {
+ const task = {
+ id: 'sys-rl-still-open', status: 'blocked',
+ metadata: {
+ app: 'app', reviewLoopFollowUp: true, reviewLoopPRNumber: '8', reviewLoopPRHost: 'github.com',
+ reviewLoopPROwner: 'atomantic', reviewLoopPRRepo: 'example',
+ reviewLoopPRUrl: 'https://github.com/atomantic/example/pull/8',
+ },
+ };
+ m.tasks = [task];
+ m.prStates['8'] = { status: 'known', state: 'OPEN' };
+
+ const receipt = await runDevelopmentWatchdog({ force: true });
+
+ expect(task.status).toBe('blocked');
+ expect(m.updates).toEqual([]);
+ expect(receipt.apps[0].retiredReviewFollowUps).toEqual([]);
+});
+
it('keeps a pending review follow-up when the PR state is unavailable', async () => {
const task = {
id: 'sys-rl-unavailable', status: 'pending',
diff --git a/server/services/orphanedPrNotifier.js b/server/services/orphanedPrNotifier.js
index fde89a0cc0..381cc7fdd4 100644
--- a/server/services/orphanedPrNotifier.js
+++ b/server/services/orphanedPrNotifier.js
@@ -3,16 +3,16 @@
*
* A review-loop / merge follow-up task (`spawnReviewLoopFollowUp`) exists for
* exactly one reason: to land the pull request named in its `reviewLoopPRUrl`.
- * Blocking one is therefore not the self-contained "a task got parked" outcome
- * an ordinary block is — the PR, its branch, and its worktree are left with
- * nothing in the system that will ever merge them, and the Blocked list is the
- * only trace.
+ * Blocking one can leave the PR, its branch, and its worktree with no active
+ * merge follow-up. The development watchdog rechecks the forge and retires the
+ * task if the PR has already become terminal; while it remains open and the
+ * follow-up remains blocked, the user needs the blocker and PR link to decide
+ * what to do.
*
- * Nothing sweeps them up afterwards, either: `app-unresolved` (the category that
- * produced the incident this was written for) sits in BOTH
- * `PAUSED_BLOCKED_CATEGORIES` and `USER_DECISION_BLOCKED_CATEGORIES`, so the
- * failure reaper never expires it and the investigation auto-retry never revives
- * it. The PR stays open indefinitely.
+ * Some block categories are deliberate user decisions, so the investigation
+ * retry and failure reaper leave them alone. A blocked follow-up can therefore
+ * outlive a PR that was merged or closed externally; developmentWatchdog owns
+ * that forge-state reconciliation.
*
* Keyed on the `pending|in_progress|… → blocked` TRANSITION off the shared
* `tasks:changed` event rather than hung off one blocking call site: ~12 sites
@@ -58,8 +58,8 @@ export async function notifyIfPrLeftOrphaned({ task, previousStatus } = {}) {
await addNotification({
type: NOTIFICATION_TYPES.AGENT_WARNING,
title: 'PR left open: its merge follow-up was blocked',
- description: `Task ${task.id} was going to land ${prUrl}, but ${why} `
- + `Nothing else will merge this PR — land it manually, or fix the block and re-run the task.`,
+ description: `The merge follow-up task ${task.id} is blocked: ${why} PR: ${prUrl}. `
+ + `If the PR is still open, fix the blocker and re-run the task or merge it manually.`,
priority: PRIORITY_LEVELS.HIGH,
link: prUrl,
metadata: { taskId: task.id, prUrl, prBranch: task.metadata?.reviewLoopPRBranch },
@@ -67,7 +67,7 @@ export async function notifyIfPrLeftOrphaned({ task, previousStatus } = {}) {
await ensureTaskThread({
taskId: task.id,
title: 'PR left open: its merge follow-up was blocked',
- nextAction: 'Fix the blocked merge follow-up or land the pull request manually.',
+ nextAction: 'Check the linked PR. If it is still open, fix the blocker and re-run the task or merge it manually.',
notes: `${prUrl}\n${why}`,
priority: 'high',
});
diff --git a/server/services/reviewQueue.js b/server/services/reviewQueue.js
index 9a208bf4fb..2573be3d57 100644
--- a/server/services/reviewQueue.js
+++ b/server/services/reviewQueue.js
@@ -168,12 +168,17 @@ function threadBelongsToView(thread, view, timezone, now = new Date()) {
// Read live state so legacy recovery commitments clear as soon as
// automation resumes or finishes. Missing tasks stay visible; unreadable tasks
// fail the source read rather than falsely reporting an empty queue.
-async function taskNeedsUserAction(taskId) {
+async function taskActionContext(taskId) {
const task = await cosTaskStore.getTaskById(taskId);
- if (!task) return true;
- if (task.status === 'pending' && task.approvalRequired) return true;
- if (task.status === 'blocked') return !TIMED_COOLDOWN_BLOCKED_CATEGORIES.has(task.metadata?.blockedCategory);
- return !['pending', 'in_progress', 'completed', 'cancelled'].includes(task.status);
+ if (!task) return { needsUserAction: true, task: null };
+ if (task.status === 'pending' && task.approvalRequired) return { needsUserAction: true, task };
+ if (task.status === 'blocked') {
+ return { needsUserAction: !TIMED_COOLDOWN_BLOCKED_CATEGORIES.has(task.metadata?.blockedCategory), task };
+ }
+ return {
+ needsUserAction: !['pending', 'in_progress', 'completed', 'cancelled'].includes(task.status),
+ task,
+ };
}
const visibleInLiveViews = (producer, view) => {
@@ -252,18 +257,63 @@ const PRODUCERS = [
.filter((thread) => threadBelongsToView(thread, ctx.view, timezone, now));
const actionable = await Promise.all(candidates.map(async thread => {
const taskRef = thread.source === 'cos' && thread.refs?.find(ref => ref?.kind === 'cos.task' && ref.id);
- return !taskRef || ctx.view === 'history' || await taskNeedsUserAction(taskRef.id);
+ if (!taskRef || ctx.view === 'history') return { needsUserAction: true, task: null };
+ return taskActionContext(taskRef.id);
}));
- const matching = candidates.filter((_, index) => actionable[index]);
- return { items: matching, truncated: matching.length > limit };
+ const matching = candidates.flatMap((thread, index) => actionable[index].needsUserAction
+ ? [{ thread, task: actionable[index].task }]
+ : []);
+ const appIds = [...new Set(matching
+ .map(({ task }) => typeof task?.metadata?.app === 'string' ? task.metadata.app.trim() : '')
+ .filter(Boolean))];
+ const appNames = new Map();
+ if (appIds.length) {
+ const appService = await import('./apps.js').catch(() => null);
+ if (appService?.getAppById) {
+ await Promise.all(appIds.map(async appId => {
+ const app = await appService.getAppById(appId).catch(() => null);
+ if (typeof app?.name === 'string' && app.name.trim()) appNames.set(appId, app.name.trim());
+ }));
+ }
+ }
+ return {
+ items: matching.map(({ thread, task }) => {
+ const nextAction = threadNextLine(thread);
+ const summaryParts = [nextAction || (thread.waitingOn ? `Waiting on ${thread.waitingOn}` : 'No next action set')];
+ const metadata = task?.metadata && typeof task.metadata === 'object' ? task.metadata : {};
+ const blockedCategory = typeof metadata.blockedCategory === 'string' ? metadata.blockedCategory.trim() : '';
+ if (task?.status === 'blocked') {
+ const reason = typeof metadata.blockedReason === 'string' ? metadata.blockedReason.trim() : '';
+ summaryParts.push(reason
+ ? `Still blocked: ${reason}`
+ : `Still blocked${blockedCategory ? ` (${blockedCategory})` : ''}.`);
+ }
+ const appId = typeof metadata.app === 'string' ? metadata.app.trim() : '';
+ const appLabel = appId ? (appNames.get(appId) || appId) : '';
+ const prUrl = typeof metadata.reviewLoopPRUrl === 'string'
+ ? metadata.reviewLoopPRUrl.trim()
+ : typeof metadata.prUrl === 'string' ? metadata.prUrl.trim() : '';
+ const meta = {
+ ...threadMeta(thread),
+ ...(typeof task?.status === 'string' ? { taskStatus: task.status } : {}),
+ ...(blockedCategory ? { blockedCategory } : {}),
+ ...(appLabel ? { appLabel } : {}),
+ ...(prUrl ? { reviewLoopPRUrl: prUrl } : {}),
+ };
+ return {
+ ...thread,
+ queueSummary: summaryParts.join(' ').slice(0, 500),
+ queueMeta: meta,
+ };
+ }),
+ truncated: matching.length > limit,
+ };
},
map(thread) {
- const nextAction = threadNextLine(thread);
- const summary = nextAction || (thread.waitingOn ? `Waiting on ${thread.waitingOn}` : 'No next action set');
return {
id: `threads:${thread.id}`,
title: thread.title || 'Untitled commitment',
- summary,
+ summary: thread.queueSummary || threadNextLine(thread) || (thread.waitingOn ? `Waiting on ${thread.waitingOn}` : 'No next action set'),
timestamp: thread.updatedAt || thread.createdAt || null,
severity: thread.priority === 'urgent' ? 'high' : 'normal',
required: true,
@@ -271,7 +321,7 @@ const PRODUCERS = [
dueAt: thread.dueAt || null,
drillTo: `/brain/threads?thread=${encodeURIComponent(thread.id)}`,
operations: threadAction(thread),
- meta: threadMeta(thread),
+ meta: thread.queueMeta || threadMeta(thread),
};
},
},
diff --git a/server/services/reviewQueue.test.js b/server/services/reviewQueue.test.js
index 341d0ba6f6..a9bf03c33e 100644
--- a/server/services/reviewQueue.test.js
+++ b/server/services/reviewQueue.test.js
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
// Mock every producer service the aggregator pulls from, so the test exercises
// only the normalization / sort / bounded-read / snapshot / degrade-on-failure logic.
-const apps = { getAllApps: vi.fn() };
+const apps = { getAllApps: vi.fn(), getAppById: vi.fn() };
vi.mock('./apps.js', () => apps);
const brain = { getInboxLog: vi.fn(), markInboxDone: vi.fn() };
const brainStorage = { getThreads: vi.fn(), getThreadById: vi.fn(), updateWith: vi.fn() };
@@ -77,6 +77,7 @@ const {
// Default: every producer returns "nothing needs attention".
function resetEmpty() {
apps.getAllApps.mockResolvedValue([]);
+ apps.getAppById.mockResolvedValue(null);
cosTaskStore.getTaskById.mockResolvedValue(null);
brain.getInboxLog.mockResolvedValue([]);
brainStorage.getThreads.mockResolvedValue([]);
@@ -383,6 +384,57 @@ describe('reviewQueue.buildQueue', () => {
expect(queue.items.some((item) => item.id === 'threads:thread-done')).toBe(false);
});
+ it('shows the live blocker, managed app, task state, and PR link on a blocked follow-up commitment', async () => {
+ brainStorage.getThreads.mockResolvedValue([{
+ id: 'pr-follow-up',
+ title: 'PR follow-up needs attention',
+ status: 'open',
+ source: 'cos',
+ refs: [{ kind: 'cos.task', id: 'sys-follow-up' }],
+ nextAction: 'Fix the blocker or merge the PR manually.',
+ }]);
+ cosTaskStore.getTaskById.mockResolvedValue({
+ id: 'sys-follow-up',
+ status: 'blocked',
+ metadata: {
+ app: 'app-id',
+ blockedCategory: 'app-unresolved',
+ blockedReason: 'Repository path is unavailable.',
+ reviewLoopPRUrl: 'https://github.com/example-org/example-repo/pull/9',
+ },
+ });
+ apps.getAppById.mockResolvedValue({ id: 'app-id', name: 'Example Repo' });
+
+ const queue = await buildQueue();
+
+ expect(queue.items.find((item) => item.id === 'threads:pr-follow-up')).toMatchObject({
+ summary: 'Fix the blocker or merge the PR manually. Still blocked: Repository path is unavailable.',
+ meta: {
+ localStatus: 'open',
+ taskStatus: 'blocked',
+ blockedCategory: 'app-unresolved',
+ appLabel: 'Example Repo',
+ reviewLoopPRUrl: 'https://github.com/example-org/example-repo/pull/9',
+ },
+ });
+ expect(apps.getAppById).toHaveBeenCalledWith('app-id');
+ });
+
+ it('hides a task-owned commitment as soon as its CoS task is completed', async () => {
+ brainStorage.getThreads.mockResolvedValue([{
+ id: 'resolved-follow-up',
+ title: 'PR follow-up needs attention',
+ status: 'open',
+ source: 'cos',
+ refs: [{ kind: 'cos.task', id: 'sys-completed' }],
+ }]);
+ cosTaskStore.getTaskById.mockResolvedValue({ id: 'sys-completed', status: 'completed', metadata: {} });
+
+ const queue = await buildQueue();
+
+ expect(queue.items.some((item) => item.id === 'threads:resolved-follow-up')).toBe(false);
+ });
+
it('keeps waiting and someday commitments out of Today unless their follow-up is due', async () => {
userTimezone.getUserTimezone.mockResolvedValue('America/Los_Angeles');
brainStorage.getThreads.mockResolvedValue([