Skip to content

feat(gastown): build 'Needs Your Attention' section for Merge Queue page#1365

Merged
jrf0110 merged 5 commits intoconvoy/redesign-merge-queue-needs-attention-ref/e0d20455/headfrom
convoy/redesign-merge-queue-needs-attention-ref/e0d20455/gt/toast/d93f38f3
Mar 21, 2026
Merged

feat(gastown): build 'Needs Your Attention' section for Merge Queue page#1365
jrf0110 merged 5 commits intoconvoy/redesign-merge-queue-needs-attention-ref/e0d20455/headfrom
convoy/redesign-merge-queue-needs-attention-ref/e0d20455/gt/toast/d93f38f3

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented Mar 21, 2026

Summary

  • Built the NeedsAttention component with three attention categories (open PRs, failed reviews, stale PRs), convoy grouping with progress bars, action buttons (Open PR, Retry Review, Fail Bead, View Bead), DrawerStack integration, and confirmation dialogs for destructive actions.
  • Rewrote MergesPageClient to use the getMergeQueueData tRPC procedure with 5s polling, replacing the old event-based approach. Includes loading, error, and empty states.
  • Enhanced the backend review-queue.ts data layer with failure_event_metadata on MR beads and proper source bead resolution via bead_dependencies JOIN for the activity log.

Verification

  • pnpm typecheck — passes cleanly across all workspace packages

Visual Changes

N/A (no screenshots — backend data layer + UI components for merge queue page)

Reviewer Notes

  • The diff includes changes from feat(gastown): configurable terminal orientation with drag-to-resize (#1299) which was already merged to main but not yet in the convoy base branch. These are brought in via cherry-pick commit 0f867653.
  • The actual new work is in commit 6dc2e09a. The review-queue.ts backend enhancements (failure metadata, source bead resolution) support the NeedsAttention UI's failure reason display and bead title resolution.

jrf0110 added 5 commits March 20, 2026 23:32
…1299)

* feat(gastown): configurable terminal orientation and drag-to-resize (#1237)

Terminal bar can be positioned at bottom/top/left/right with drag-to-resize.
Position and size persisted to localStorage. Collapsed state only reserves
the tab bar strip. Dynamic page padding replaces static pb-[340px].
DrawerStack offsets when terminal is on the right.

* fix(gastown): clamp size on orientation switch, add vertical close button

Re-clamp persisted size when switching position so horizontal minimum
(100px) doesn't persist as a too-small vertical width (min 200px).
Show close button on agent tabs in vertical mode via absolute positioning
on hover.

* fix(gastown): fix terminal resize handle and position picker for left/right orientations

- Make resize handle a flex child instead of absolute positioned to avoid
  z-index conflicts with framer-motion stacking contexts
- Add visible hover indicator pill on resize handle for discoverability
- Remove width/height from CSS transition so drag resize is immediate
- Use fixed positioning with viewport clamping for position picker popup
  to prevent overflow on left/right orientations
…eue-needs-attention-ref/e0d20455/gt/toast/c4ed4587' into convoy/redesign-merge-queue-needs-attention-ref/e0d20455/gt/toast/d93f38f3
…5/gt/toast/d93f38f3' of https://github.com/Kilo-Org/cloud into convoy/redesign-merge-queue-needs-attention-ref/e0d20455/gt/toast/d93f38f3

# Conflicts:
#	cloudflare-gastown/src/dos/town/review-queue.ts
Add NeedsAttention component with:
- Three attention categories: open PRs, failed reviews, stale PRs
- Convoy grouping with header cards showing progress, branch, merge mode
- Action buttons: Open PR, Retry Review, Fail Bead, View Bead
- DrawerStack integration for bead and convoy drawer opening
- Confirmation dialogs for destructive actions
- Empty state when no items need attention

Rewrite MergesPageClient to use getMergeQueueData tRPC procedure
with 5s polling interval.
@jrf0110 jrf0110 merged commit 3df7843 into convoy/redesign-merge-queue-needs-attention-ref/e0d20455/head Mar 21, 2026
2 checks passed
@jrf0110 jrf0110 deleted the convoy/redesign-merge-queue-needs-attention-ref/e0d20455/gt/toast/d93f38f3 branch March 21, 2026 14:37
(SELECT ${bead_events.metadata}
FROM ${bead_events}
WHERE ${bead_events.bead_id} = ${beads.bead_id}
AND ${bead_events.event_type} IN ('review_completed', 'pr_creation_failed')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: This can hide the actual failure reason for PR creation failures

pr_creation_failed events currently log { reason: 'invalid_url' } without a message, while completeReviewWithResult() logs the human-readable failure text on the preceding review_completed event. Because this subquery picks the newest of either event type, invalid-URL failures end up with failure_event_metadata.message === undefined, so the new UI renders no reason for that class of failure.


// Fail bead mutation: use adminForceFailBead
const failMutation = useMutation(
trpc.gastown.adminForceFailBead.mutationOptions({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: This action is wired to an admin-only mutation

adminForceFailBead is protected by adminProcedure, but the merge queue page itself is town-scoped and available to non-admin Gastown users. For those users the new "Fail Bead" button will always 403 even though the UI presents it as a normal action.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Mar 21, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
cloudflare-gastown/src/dos/town/review-queue.ts 1012 pr_creation_failed can win the failure-metadata subquery even though it does not carry the human-readable message, so some failed-review cards render without a reason.
src/app/(app)/gastown/[townId]/merges/NeedsAttention.tsx 318 The new Fail Bead action calls adminForceFailBead, which is admin-only and will 403 for non-admin Gastown users on this town-scoped page.
Other Observations (not in diff)

N/A

Files Reviewed (9 files)
  • cloudflare-gastown/src/dos/town/review-queue.ts - 1 issue
  • src/app/(app)/gastown/[townId]/layout.tsx - 0 issues
  • src/app/(app)/gastown/[townId]/merges/MergesPageClient.tsx - 0 issues
  • src/app/(app)/gastown/[townId]/merges/NeedsAttention.tsx - 1 issue
  • src/app/(app)/organizations/[id]/gastown/[townId]/layout.tsx - 0 issues
  • src/components/gastown/DrawerStack.tsx - 0 issues
  • src/components/gastown/TerminalBar.tsx - 0 issues
  • src/components/gastown/TerminalBarContext.tsx - 0 issues
  • src/components/gastown/TerminalBarPadding.tsx - 0 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.4-20260305 · 1,301,752 tokens

jrf0110 added a commit that referenced this pull request Mar 23, 2026
… log (#1378)

* feat(gastown): add getMergeQueueData tRPC procedure for merge queue page

Add a dedicated tRPC query that returns structured merge queue data:
- needsAttention section with openPRs, failedReviews, and stalePRs
- activityLog with enriched review-related bead events
- Full JOINs to review_metadata, source beads, convoy_metadata, agents, rigs
- Input params: townId (required), rigId, limit, since for filtering/polling
- Zod schemas with rpcSafe wrappers and type declarations for frontend

* feat(gastown): build 'Needs Your Attention' section for Merge Queue page (#1365)

* feat(gastown): configurable terminal orientation with drag-to-resize (#1299)

* feat(gastown): configurable terminal orientation and drag-to-resize (#1237)

Terminal bar can be positioned at bottom/top/left/right with drag-to-resize.
Position and size persisted to localStorage. Collapsed state only reserves
the tab bar strip. Dynamic page padding replaces static pb-[340px].
DrawerStack offsets when terminal is on the right.

* fix(gastown): clamp size on orientation switch, add vertical close button

Re-clamp persisted size when switching position so horizontal minimum
(100px) doesn't persist as a too-small vertical width (min 200px).
Show close button on agent tabs in vertical mode via absolute positioning
on hover.

* fix(gastown): fix terminal resize handle and position picker for left/right orientations

- Make resize handle a flex child instead of absolute positioned to avoid
  z-index conflicts with framer-motion stacking contexts
- Add visible hover indicator pill on resize handle for discoverability
- Remove width/height from CSS transition so drag resize is immediate
- Use fixed positioning with viewport clamping for position picker popup
  to prevent overflow on left/right orientations

* chore: cherry-pick getMergeQueueData types from bead 0

* feat(gastown): build 'Needs Your Attention' section for Merge Queue page

Add NeedsAttention component with:
- Three attention categories: open PRs, failed reviews, stale PRs
- Convoy grouping with header cards showing progress, branch, merge mode
- Action buttons: Open PR, Retry Review, Fail Bead, View Bead
- DrawerStack integration for bead and convoy drawer opening
- Confirmation dialogs for destructive actions
- Empty state when no items need attention

Rewrite MergesPageClient to use getMergeQueueData tRPC procedure
with 5s polling interval.

* feat(gastown): add convoy grouping and per-rig filtering to Merge Queue page (#1366)

* feat(gastown): add convoy grouping and per-rig filtering to Merge Queue page

- Add RefineryActivityLog with convoy grouping: entries grouped by convoy
  with header cards showing title, branch, progress, clickable to open
  convoy drawer
- Add per-rig filter dropdown using listRigs query and shadcn Select,
  passes rigId to getMergeQueueData for server-side filtering
- Include status_changed ActionType with type guard (no unsafe 'as' cast)
- Polish layout: page title, rig filter, Needs Attention, Activity Log
  sections with consistent headers and empty states

* fix(gastown): move hooks above early returns and paginate by convoy groups

- Move all useMemo hooks above isLoading/empty early returns to prevent
  React crash when entries transition from 0 to non-zero (hooks must be
  called in the same order on every render)
- Replace flat-entry pagination with group-based pagination: convoy
  groups (sorted by most recent activity) are kept whole, and standalone
  entries fill remaining page budget. This ensures recently active
  convoys appear on page 1 regardless of other convoys' sizes.

* fix(gastown): interleave convoy groups and standalone entries by recency in pagination

The previous pagination showed all convoy groups before any standalone
entries regardless of timestamps. A standalone entry more recent than all
convoy groups would still appear below them on page 1.

Merge convoy groups and standalone entries into a unified DisplayItem list
sorted by most-recent timestamp, then paginate over that list. Convoy
groups use their latestTimestamp as sort key; standalone entries use their
event.created_at. This ensures the most recently active items appear first
on page 1 regardless of whether they are convoy-grouped or standalone.

Hooks were already correctly placed before early returns (no conditional
hooks issue in the current code).

* fix(gastown): gate fail button behind admin check and fix pagination remaining count

Hide the admin-only 'Fail Bead' button for non-admin users by checking
isAdmin from the session. Fix the activity log pagination to compute
hasMore and remaining count based on actual visible entries rather than
the budget, preventing incorrect 'Show more' state when a convoy group
exceeds the page budget.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant