Skip to content

Turn /tasks into a master-detail triage console: inline task details pane, footer docked under the list with honest row counts, and no mid-word title cutoffs #2719

Closed

Description

@propr-dev

Context

On a 1080p screen the /tasks page shows about 11 compact rows and then roughly 400px of empty space above the pagination bar, which says Showing 1–50 of 14,919 tasks. One title also stops mid-word with no ellipsis (… so an MCP client can actu).

Here is what the code shows is going on. Don't skip this part: it changes which fixes are worth doing.

  1. The footer isn't lying about the data, but it misleads. TaskList asks for 50 tasks per page (listTasks({ limit: 50 })). groupTasksForDisplay (propr-ui/src/components/TaskList/utils.ts) then folds every run of the same pull request into one row with an "N earlier runs" rollup (see rowModel.ts / TaskRows.tsx). 50 tasks across 11 pull requests become 11 rows. Asking for "25–30 tasks per page" (the quick fix in the request) would make this worse: fewer tasks means fewer rows. The real problems are (a) the footer counts tasks while the screen shows pull-request rows, and (b) the layout pins the footer to the bottom of the viewport.
  2. Layout. The full-page branch of TaskList stretches its container to the viewport height (a min-h-[calc(100vh-…)] / flex-1 + justify-between style column) so Pagination stays at the bottom edge. A short page therefore leaves a tall blank gap between the last row and the footer.
  3. Horizontal sprawl. The ledger grid (task-queue.css, TASK_QUEUE_COLUMNS) gives the title column all remaining width. On a 1920px monitor that leaves around 800px of white space between a short title and the metadata columns.
  4. Mid-word cutoff. The visible title is exactly 100 characters long. A hard substring(0, 100) / slice(0, 100) runs on the title before it is stored (most likely where PR task titles are built: src/jobs/prTaskTitleHelpers.ts → buildPrTaskTitle, or where issue titles are copied into initial_job_data). The UI's CSS line-clamp can't add an ellipsis because the string itself is already cut.

Goal

Make /tasks feel like a desktop triage console (the Linear/Sentry pattern recommended in the request, Solution 1), and also apply the cheap structural fixes (Solution 3 and the truncation bug):

  • Master-detail split pane at ≥1280px (Tailwind xl). Selecting a task opens the existing TaskDetails view (timeline, changed files, implementation log, terminal) in a right-hand pane. There is no route change and no modal. The list stays on the left.
  • Footer docks under the last row instead of sitting at the bottom of the viewport.
  • Footer copy matches what is on screen: it says both how many tasks and how many pull-request rows the page contains.
  • Titles are never cut mid-word: new titles are shortened at a word boundary with …, and titles that were already stored hard-cut at 100 characters get an … in the UI.

Virtualized infinite scroll (Solution 2) is out of scope. With rows grouped by pull request it would also need server-side grouping to page correctly, so it's a separate project.

Requirements

R1 – Selection state lives in the URL

  • Add ?task=<taskId> to /tasks. Keep every existing filter param (repository, status, search, page, …) when it changes. Use replace: true so arrow-key triage doesn't flood browser history.
  • Add a hook useTaskSelection() (new file) that returns { selectedTaskId, select(id|null), isSplitViewport }. isSplitViewport uses window.matchMedia('(min-width: 1280px)') and updates on change.

R2 – Split workspace (≥1280px)

  • New component TaskSplitWorkspace renders react-resizable-panels (already a dependency; see AiAgentsDesktopWorkspace.tsx and PlanEditorDesktopLayout.tsx for the house pattern): a left panel (default 45%, min 32%) holding <TaskList … /> and a right panel (default 55%, min 35%) holding <TaskDetails taskId={selected} embedded onClose onDeleted />.
  • The split is shown only when a task is selected and the viewport is ≥1280px. With nothing selected the ledger stays full width, exactly as today. This keeps first load uncluttered and keeps the existing full-width e2e assertions valid.
  • Below 1280px nothing changes: clicking a row goes to /tasks/:id as it does today.
  • The pane header has two controls: Open full page (link to /tasks/:id) and Close (clears ?task, Esc also works).
  • Each panel scrolls on its own (min-h-0 overflow-y-auto) so neither creates page-level scroll.

R3 – Row interaction in split-capable viewports

  • TaskList gets two optional props: selectedTaskId?: string | null and onSelectTask?: (taskId: string) => void. When onSelectTask is set, a plain primary click (no Ctrl/Meta/Shift/Alt, button 0) on a row's title link calls event.preventDefault() and onSelectTask(primaryTaskId). Modified clicks, middle-click and "open in new tab" keep working because the element is still a real <Link to="/tasks/:id">.
  • The selected row gets aria-selected="true" (rows already have role="row") and a visible selected style (bg-teal-50/60 plus a 2px teal inset shadow on the left; reuse the teal accent the sidebar uses).
  • Keyboard triage while the split is active: j/ArrowDown and k/ArrowUp move the selection to the next/previous primary row (group.tasks[0].id) on the current page. They do nothing while focus is in an input, textarea, select or [contenteditable]. Esc closes the pane. Earlier runs inside an expanded rollup can be selected by clicking them, but j/k skip them.
  • The left pane is narrower than 880px, so the existing container queries in task-queue.css switch the list to the MobileTaskCard layout on their own. Don't fight this: card density is right for a 45% pane. Check that the queries use @container on the list wrapper and not viewport @media. If they use @media, convert them to a container (container-type: inline-size on .task-queue).

R4 – TaskDetails can run embedded

  • propr-ui/src/components/TaskDetails/index.tsx currently reads the task ID from useParams. Add optional props taskId?: string, embedded?: boolean, onClose?: () => void, onDeleted?: () => void. The prop wins over the route param.
  • When embedded:
    • don't call useDocumentTitle (the list owns the title);
    • after a successful delete, call onDeleted() instead of navigate('/tasks');
    • use h-full min-h-0 and keep the internal desktop split. Above lg, TaskDetails already switches to a two-column timeline/output layout; inside a ~55% pane at 1280–1600px that is about 700–880px wide. Use a container query or the embedded flag to force the single-column task-workspace-scroll layout, which task-details-responsive.pw.ts already covers at narrow widths.
    • key={taskId} on <TaskDetails> in the workspace, so switching tasks tears down old socket subscriptions and live-data state (useTaskLiveData, useTaskData) cleanly.

R5 – Footer docks under the list and states row count honestly

  • Remove the viewport-height stretching from the full-page TaskList wrapper so Pagination comes right after the table/cards, with mt-4 pb-8 spacing.
  • Pagination gets an optional groupCount prop. New copy: Showing tasks 1–50 of 14,919 · 11 pull requests on this page. Keep the task range wording so the existing count assertion only needs a small change. Leave out the second part when groupCount === tasksOnPage (every task is its own row).

R6 – Titles are never cut mid-word

  • Backend (new data): find the hard slice. Run grep -rnE "\.(substring|slice)\(0, ?100\)" src packages/core/src packages/api and check every hit that touches a title. Replace it with a new shared helper truncateAtWord(text, max) in packages/shared/src/text.ts (export it from the shared index). The helper cuts at the last whitespace before max - 1, trims trailing punctuation, and appends …. Never return more than max characters.
  • UI (existing data): add ellipsizeHardCutTitle(title) in propr-ui/src/components/TaskList/displayTitle.ts. If the string is exactly 100 characters and ends in a letter or digit (a strong sign of the legacy hard slice, see Context), trim back to the last whitespace and append …. Apply it at the end of sanitizeTaskTitle in rowModel.ts, so the desktop rows, mobile cards and the earlier-runs list all pick it up. The full original title stays in the title= tooltip.

Out of scope

  • Server-side grouping, infinite scroll, virtualization.
  • Changing the API page size (it stays 50 tasks).

Acceptance criteria

  1. At 1920×1080, clicking a task title on /tasks puts ?task=<id> in the URL. The list moves to the left pane, TaskDetails (timeline, changed files, implementation log, terminal) appears on the right, and the page does not navigate.
  2. j/k/arrow keys move the selection and update the right pane. Esc closes it. Typing in the search box doesn't trigger these keys.
  3. Ctrl/Cmd-click and middle-click on a title still open /tasks/:id in a new tab. At 1024px a plain click still navigates to /tasks/:id.
  4. Reloading /tasks?task=<id>&repository=x restores both the selection and the filter.
  5. With a short page, the pagination bar sits right under the last row (no viewport-height gap). The footer reads Showing tasks 1–50 of N · K pull requests on this page.
  6. A stored title of exactly 100 characters that ends mid-word shows … in rows, cards and earlier runs. Newly generated titles longer than the limit end with … at a word boundary.
  7. Deleting a task from the embedded pane closes the pane and refreshes the list. Nothing navigates away.
  8. npm run typecheck -w propr-ui, npm run lint -w propr-ui -- --max-warnings 0, the vitest suites, and npx playwright test e2e/task-list-desktop.pw.ts (with the assertion updates described in the implementation) all pass.

Created by ProPR AI Planner

Activity

  1. propr-dev commented on Oct 3, 2026

    @propr-dev
    ContributorAuthor

    Suggested Implementation:

    Implementation Approach

    The empty space has two causes. Rows are grouped by pull request (50 tasks become ~11 rows), and the footer is pinned to the bottom of the viewport. Fetching more tasks treats a symptom and changes API semantics. So we fix the layout and the copy, and then make better use of the space with a master-detail split, built from components the app already has:

    • Selection lives in the URL (?task=), not in React state. A reload or a shared link restores it, browser back works, and the existing TaskList URL-synced filters keep working with no extra plumbing. We considered a context/store, but it loses state on reload, so we rejected it.
    • react-resizable-panels is already used by AiAgentsDesktopWorkspace and PlanEditorDesktopLayout. Reusing it keeps keyboard-resizable handles consistent across the app and adds no dependency.
    • TaskDetails is reused as-is behind a taskId prop. This is not a new "diagnostic console" component. TaskDetails already renders the timeline, files, log and terminal, with socket subscriptions and responsive scroll ownership covered by e2e tests. A second implementation would drift.
    • The split appears only when something is selected. An always-on empty right pane would just move the blank space from the bottom of the screen to the right. It would also break every full-width ledger e2e assertion.
    • Titles get two fixes. The backend fix stops new hard cuts. The UI heuristic (exactly 100 characters, ending in a letter or digit) repairs rows already stored. A UI-only fix would leave bad data behind, and a backend-only fix would leave the existing rows broken.

    Note: the repository context for this plan did not include the source of TaskList.tsx, TaskRows.tsx, StateComponents.tsx, Pagination.tsx, TasksPage.tsx or TaskDetails/index.tsx. Their diffs below are illustrative: hunk line numbers are approximate and surrounding lines are paraphrased from the file summaries. Use the new files exactly as written, and apply the modifications to the real code by their intent (the comments explain each one).


    File: propr-ui/src/components/TaskList/useTaskSelection.ts (new file)

    Why this file: This is the single source of truth for "which task is open in the pane" and "is the viewport wide enough to split". TasksPage, TaskSplitWorkspace and the keyboard handler all read from it, so selection and URL can't get out of sync.

    import { useCallback, useEffect, useState } from 'react';
    import { useSearchParams } from 'react-router-dom';
    
    /** Matches Tailwind `xl`. Below this the list keeps navigating to /tasks/:id. */
    export const SPLIT_VIEW_QUERY = '(min-width: 1280px)';
    export const SELECTED_TASK_PARAM = 'task';
    
    function matchesSplit(): boolean {
      // jsdom and SSR may not have matchMedia; default to the narrow behaviour,
      // which is exactly today's behaviour, so tests that don't stub it are unaffected.
      return typeof window !== 'undefined' && typeof window.matchMedia === 'function'
        && window.matchMedia(SPLIT_VIEW_QUERY).matches;
    }
    
    export function useIsSplitViewport(): boolean {
      const [matches, setMatches] = useState(matchesSplit);
      useEffect(() => {
        if (typeof window.matchMedia !== 'function') return;
        const query = window.matchMedia(SPLIT_VIEW_QUERY);
        const update = () => setMatches(query.matches);
        update();
        // Listening (rather than reading once) lets a window resized across the
        // breakpoint fall back to navigation instead of keeping a cramped split.
        query.addEventListener('change', update);
        return () => query.removeEventListener('change', update);
      }, []);
      return matches;
    }
    
    export function useTaskSelection() {
      const [searchParams, setSearchParams] = useSearchParams();
      const isSplitViewport = useIsSplitViewport();
      const selectedTaskId = searchParams.get(SELECTED_TASK_PARAM);
    
      const select = useCallback((taskId: string | null) => {
        setSearchParams(previous => {
          // Copy the previous params so repository/status/search/page filters survive.
          const next = new URLSearchParams(previous);
          if (taskId) next.set(SELECTED_TASK_PARAM, taskId);
          else next.delete(SELECTED_TASK_PARAM);
          return next;
          // replace: arrow-key triage would otherwise push dozens of history
          // entries and make the browser Back button useless.
        }, { replace: true });
      }, [setSearchParams]);
    
      return {
        selectedTaskId,
        select,
        isSplitViewport,
        // The split only renders when there is something to show on the right;
        // an empty detail pane would just move the blank space sideways.
        isSplitActive: isSplitViewport && Boolean(selectedTaskId),
      };
    }

    File: propr-ui/src/components/TaskList/TaskSplitWorkspace.tsx (new file)

    Why this file: Keeps the panel layout, pane chrome and keyboard triage out of TaskList, which is already large and handles fetching, filters and sockets. TasksPage mounts it instead of a bare TaskList. It reuses TaskDetails through the new embedded props (see the TaskDetails changes below).

    import React, { useCallback, useEffect } from 'react';
    import { Link } from 'react-router-dom';
    import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels';
    import { ExternalLink, X } from 'lucide-react';
    import TaskList from '../TaskList';
    import TaskDetails from '../TaskDetails';
    import { useTaskSelection } from './useTaskSelection';
    
    /** Elements whose keystrokes belong to the user, not to list triage. */
    function isTypingTarget(target: EventTarget | null): boolean {
      if (!(target instanceof HTMLElement)) return false;
      return target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName);
    }
    
    /**
     * Primary rows are rendered with data-task-row-id (added in TaskRows /
     * MobileTaskCard). Reading the order from the DOM instead of re-deriving the
     * grouping keeps keyboard order identical to visual order under any filter.
     */
    function visibleRowIds(): string[] {
      return Array.from(document.querySelectorAll<HTMLElement>('[data-task-row-id]'))
        .map(element => element.dataset.taskRowId!)
        .filter(Boolean);
    }
    
    const TaskSplitWorkspace: React.FC = () => {
      const { selectedTaskId, select, isSplitViewport, isSplitActive } = useTaskSelection();
    
      // Narrow viewports never intercept clicks: passing undefined keeps TaskList's
      // existing <Link> navigation to /tasks/:id byte-for-byte unchanged.
      const onSelectTask = isSplitViewport ? select : undefined;
    
      const move = useCallback((delta: 1 | -1) => {
        const ids = visibleRowIds();
        if (ids.length === 0) return;
        const index = selectedTaskId ? ids.indexOf(selectedTaskId) : -1;
        // An earlier run (not in ids) is selected: start from the top instead of
        // jumping to a surprising place.
        const next = index === -1 ? 0 : Math.min(ids.length - 1, Math.max(0, index + delta));
        select(ids[next]);
        document.querySelector(`[data-task-row-id="${CSS.escape(ids[next])}"]`)
          ?.scrollIntoView({ block: 'nearest' });
      }, [select, selectedTaskId]);
    
      useEffect(() => {
        if (!isSplitViewport) return;
        const onKeyDown = (event: KeyboardEvent) => {
          if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.altKey) return;
          if (isTypingTarget(event.target)) return;
          if (event.key === 'j' || event.key === 'ArrowDown') { event.preventDefault(); move(1); }
          else if (event.key === 'k' || event.key === 'ArrowUp') { event.preventDefault(); move(-1); }
          // Esc only closes when the pane is open, so it never swallows Esc for
          // other UI (menus inside TaskDetails call preventDefault and are skipped above).
          else if (event.key === 'Escape' && selectedTaskId) { event.preventDefault(); select(null); }
        };
        document.addEventListener('keydown', onKeyDown);
        return () => document.removeEventListener('keydown', onKeyDown);
      }, [isSplitViewport, move, select, selectedTaskId]);
    
      const list = (
        <TaskList selectedTaskId={isSplitActive ? selectedTaskId : null} onSelectTask={onSelectTask} />
      );
    
      if (!isSplitActive) return list;
    
      return (
        // autoSaveId persists the user's chosen split ratio like the agents workspace does.
        <PanelGroup direction="horizontal" autoSaveId="propr.tasks.split" className="h-full min-h-0">
          <Panel defaultSize={45} minSize={32} className="min-h-0">
            {/* Independent scroll owner: the list never pushes the detail pane. */}
            <div className="h-full min-h-0 overflow-y-auto" data-testid="task-split-list">{list}</div>
          </Panel>
          <PanelResizeHandle
            className="w-px bg-slate-200 hover:bg-teal-400 focus-visible:bg-teal-500 focus-visible:outline-none"
            aria-label="Resize task list and details"
          />
          <Panel defaultSize={55} minSize={35} className="min-h-0">
            <section aria-label="Task details" data-testid="task-split-details" className="flex h-full min-h-0 flex-col bg-white">
              <div className="flex flex-none items-center justify-end gap-1 border-b border-slate-200 px-3 py-1.5">
                <Link
                  to={`/tasks/${encodeURIComponent(selectedTaskId!)}`}
                  className="inline-flex items-center gap-1 rounded px-2 py-1 text-xs font-medium text-slate-600 hover:bg-slate-100 hover:text-slate-900"
                >
                  <ExternalLink className="h-3.5 w-3.5" aria-hidden="true" /> Open full page
                </Link>
                <button
                  type="button"
                  onClick={() => select(null)}
                  aria-label="Close task details"
                  className="rounded p-1 text-slate-500 hover:bg-slate-100 hover:text-slate-900"
                >
                  <X className="h-4 w-4" aria-hidden="true" />
                </button>
              </div>
              <div className="min-h-0 flex-1">
                {/* key: a new task remounts TaskDetails so its socket subscriptions
                    and live-data merges from the previous task can't leak across. */}
                <TaskDetails
                  key={selectedTaskId!}
                  taskId={selectedTaskId!}
                  embedded
                  onClose={() => select(null)}
                  onDeleted={() => select(null)}
                />
              </div>
            </section>
          </Panel>
        </PanelGroup>
      );
    };
    
    export default TaskSplitWorkspace;

    File: propr-ui/src/pages/TasksPage.tsx

    Why this file: This is the route entry point. /tasks (no :taskId) now mounts the workspace instead of a bare list. /tasks/:taskId still renders the full-page TaskDetails, so deep links and narrow screens behave exactly as before.

    --- a/propr-ui/src/pages/TasksPage.tsx
    +++ b/propr-ui/src/pages/TasksPage.tsx
    @@ -1,12 +1,15 @@
     import React from 'react';
     import { useParams } from 'react-router-dom';
    -import TaskList from '../components/TaskList';
     import TaskDetails from '../components/TaskDetails';
    +// The workspace wraps TaskList and decides per viewport whether a row click
    +// navigates (narrow) or opens the inline detail pane (>=1280px).
    +import TaskSplitWorkspace from '../components/TaskList/TaskSplitWorkspace';
     
     const TasksPage: React.FC = () => {
       const { taskId } = useParams<{ taskId: string }>();
       return (
         <div className="flex h-full min-h-0 flex-col">
    -      {taskId ? <TaskDetails /> : <TaskList />}
    +      {/* Full-page details remain the deep-link / narrow-screen experience. */}
    +      {taskId ? <TaskDetails /> : <TaskSplitWorkspace />}
         </div>
       );
     };

    File: propr-ui/src/components/TaskList/types.ts

    Why this file: Adds the selection contract to TaskListProps so TaskList → StateComponents → TaskRows/MobileTaskCard stay type-checked end to end.

    --- a/propr-ui/src/components/TaskList/types.ts
    +++ b/propr-ui/src/components/TaskList/types.ts
    @@ -40,6 +40,14 @@ export interface TaskListProps {
       // ...existing props (embedded dashboard mode, limits, etc.)
    +  /**
    +   * Task currently shown in the split detail pane. Drives aria-selected and the
    +   * selected-row style; null/undefined when no pane is open.
    +   */
    +  selectedTaskId?: string | null;
    +  /**
    +   * When set, a plain primary click on a row opens the task inline instead of
    +   * navigating. Left undefined below 1280px so today's navigation is untouched.
    +   */
    +  onSelectTask?: (taskId: string) => void;
     }

    File: propr-ui/src/components/TaskList.tsx

    Why this file: Two changes. (1) Remove the viewport-height stretching that pins Pagination to the bottom of the screen and causes the blank gap (Solution 3). (2) Pass the selection props down and give Pagination the row count, so its copy matches what is on screen.

    --- a/propr-ui/src/components/TaskList.tsx
    +++ b/propr-ui/src/components/TaskList.tsx
    @@ -60,7 +60,7 @@
    -const TaskList: React.FC<TaskListProps> = ({ embedded, ...rest }) => {
    +const TaskList: React.FC<TaskListProps> = ({ embedded, selectedTaskId, onSelectTask, ...rest }) => {
    @@ -300,24 +300,30 @@
       const groups = useMemo(() => groupTasksForDisplay(tasks), [tasks]);
     
       return (
    -    <div className="flex min-h-[calc(100vh-4rem)] flex-col justify-between">
    +    // No min-height / justify-between: a short page should simply end. Pinning
    +    // the footer to the viewport bottom is what produced the ~400px blank band.
    +    <div className="flex flex-col">
           <Filters /* ...unchanged props... */ />
           <TaskTableContent
             groups={groups}
             /* ...unchanged props... */
    +        selectedTaskId={selectedTaskId}
    +        onSelectTask={onSelectTask}
           />
    -      <Pagination
    -        currentPage={currentPage}
    -        tasksPerPage={tasksPerPage}
    -        totalTasks={totalTasks}
    -        setCurrentPage={setCurrentPage}
    -      />
    +      {/* Docks directly under the last row (mt-4) with breathing room below (pb-8). */}
    +      <div className="mt-4 pb-8">
    +        <Pagination
    +          currentPage={currentPage}
    +          tasksPerPage={tasksPerPage}
    +          totalTasks={totalTasks}
    +          tasksOnPage={tasks.length}
    +          groupCount={groups.length}
    +          setCurrentPage={setCurrentPage}
    +        />
    +      </div>
         </div>
       );

    File: propr-ui/src/components/TaskList/StateComponents.tsx

    Why this file: TaskTableContent maps groups to TaskQueueRow (desktop grid) or MobileTaskCard (narrow container). Both need the selection props. The split's left pane is narrow, so it will usually render cards.

    --- a/propr-ui/src/components/TaskList/StateComponents.tsx
    +++ b/propr-ui/src/components/TaskList/StateComponents.tsx
    @@ -90,12 +90,18 @@ export const TaskTableContent: React.FC<TaskTableContentProps> = ({
       groups,
    +  selectedTaskId,
    +  onSelectTask,
       ...rest
     }) => (
    @@ -110,8 +116,20 @@
    -      {groups.map(group => <TaskQueueRow key={group.key} row={buildTaskRow(group)} {...rowProps} />)}
    +      {groups.map(group => (
    +        <TaskQueueRow
    +          key={group.key}
    +          row={buildTaskRow(group)}
    +          {...rowProps}
    +          selectedTaskId={selectedTaskId}
    +          onSelectTask={onSelectTask}
    +        />
    +      ))}
    @@ -130,8 +148,15 @@
    -      {groups.map(group => <MobileTaskCard key={group.key} row={buildTaskRow(group)} {...rowProps} />)}
    +      {groups.map(group => (
    +        <MobileTaskCard
    +          key={group.key}
    +          row={buildTaskRow(group)}
    +          {...rowProps}
    +          selectedTaskId={selectedTaskId}
    +          onSelectTask={onSelectTask}
    +        />
    +      ))}

    File: propr-ui/src/components/TaskList/selectionLink.ts (new file)

    Why this file: TaskQueueRow, MobileTaskCard and EarlierRunsList share one click rule. Without a shared helper, three copies of the modifier-key check would drift and break Ctrl-click in one of them.

    import type React from 'react';
    
    /**
     * Decide whether a click on a task <Link> should open the inline pane instead.
     * Modified clicks (new tab/window), non-primary buttons, or an absent
     * onSelectTask fall through to normal <Link> navigation, so "open in new tab"
     * keeps working and narrow viewports are unaffected.
     */
    export function handleTaskLinkClick(
      event: React.MouseEvent<HTMLElement>,
      taskId: string,
      onSelectTask?: (taskId: string) => void,
    ): void {
      if (!onSelectTask) return;
      if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
      event.preventDefault();
      onSelectTask(taskId);
    }
    
    /** Selected-row styling, shared so desktop rows and cards look identical. */
    export const SELECTED_ROW_CLASS = 'bg-teal-50/60 shadow-[inset_2px_0_0_0_theme(colors.teal.600)]';

    File: propr-ui/src/components/TaskList/TaskRows.tsx

    Why this file: This is where the row's title <Link> and role="row" element live. It hooks up the shared click rule, marks the selected row and exposes data-task-row-id, which the workspace uses for j/k order.

    --- a/propr-ui/src/components/TaskList/TaskRows.tsx
    +++ b/propr-ui/src/components/TaskList/TaskRows.tsx
    @@ -1,6 +1,7 @@
     import React from 'react';
     import { Link } from 'react-router-dom';
    +import { handleTaskLinkClick, SELECTED_ROW_CLASS } from './selectionLink';
    @@ -120,20 +121,30 @@ export const TaskQueueRow: React.FC<TaskQueueRowProps> = ({
       row,
    +  selectedTaskId,
    +  onSelectTask,
       ...rest
     }) => {
    +  const primaryId = row.primary.id;
    +  // A selected earlier run also highlights its parent row so the user can
    +  // still see which pull request the pane belongs to.
    +  const selected = selectedTaskId != null
    +    && (selectedTaskId === primaryId || row.runs.some(run => run.id === selectedTaskId));
       return (
    -    <div data-testid="task-row">
    -      <div role="row" className="task-queue-grid ...">
    +    <div data-testid="task-row" data-task-row-id={primaryId}>
    +      <div
    +        role="row"
    +        aria-selected={onSelectTask ? selected : undefined}
    +        className={`task-queue-grid ... ${selected ? SELECTED_ROW_CLASS : ''}`}
    +      >
             ...
    -        <Link to={`/tasks/${primaryId}`} title={row.title} className="...">
    +        <Link
    +          to={`/tasks/${primaryId}`}
    +          title={row.title}
    +          className="..."
    +          onClick={event => handleTaskLinkClick(event, primaryId, onSelectTask)}
    +        >
    @@ EarlierRunsList: apply the same onClick to each run's <Link> (pass onSelectTask down) @@

    Make the same three changes in propr-ui/src/components/TaskList/MobileTaskCard.tsx: data-task-row-id={primaryId} on the card root, SELECTED_ROW_CLASS + aria-current={selected ? 'true' : undefined} on the card (cards are list items, not grid rows, so aria-current is the right attribute), and onClick={event => handleTaskLinkClick(event, primaryId, onSelectTask)} on its title link. Pass onSelectTask into its EarlierRunsList too.

    File: propr-ui/src/components/TaskList/Pagination.tsx

    Why this file: This is the footer whose copy reads as "50 rows" while 11 rows show. It now states both units. The second clause is left out when grouping didn't collapse anything, so the common one-run-per-PR case stays short.

    --- a/propr-ui/src/components/TaskList/Pagination.tsx
    +++ b/propr-ui/src/components/TaskList/Pagination.tsx
    @@ -5,14 +5,24 @@ interface PaginationProps {
       currentPage: number;
       tasksPerPage: number;
       totalTasks: number;
    +  /** Tasks actually returned for this page (may be < tasksPerPage on the last page). */
    +  tasksOnPage?: number;
    +  /** Rows rendered after grouping runs by pull request. */
    +  groupCount?: number;
       setCurrentPage: (page: number) => void;
     }
    @@ -30,9 +40,19 @@
       const start = totalTasks === 0 ? 0 : (currentPage - 1) * tasksPerPage + 1;
       const end = Math.min(currentPage * tasksPerPage, totalTasks);
    +  const onPage = tasksOnPage ?? end - start + 1;
    +  // Only mention rows when grouping actually collapsed something; otherwise
    +  // "50 tasks · 50 pull requests" is noise.
    +  const rowsNote = groupCount != null && groupCount < onPage
    +    ? ` · ${groupCount.toLocaleString()} pull ${groupCount === 1 ? 'request' : 'requests'} on this page`
    +    : '';
       return (
         ...
    -      <span>Showing {start.toLocaleString()}–{end.toLocaleString()} of {totalTasks.toLocaleString()} tasks</span>
    +      <span>
    +        Showing tasks {start.toLocaleString()}–{end.toLocaleString()} of {totalTasks.toLocaleString()}{rowsNote}
    +      </span>

    File: propr-ui/src/components/TaskList/displayTitle.ts (new file)

    Why this file: This is a pure function that repairs titles stored before the backend fix. It is a separate module so it can be unit-tested without React, and it is called from the one place every title passes through: sanitizeTaskTitle.

    /**
     * The legacy backend stored titles with a hard `slice(0, 100)`, producing
     * strings like "... so an MCP client can actu". CSS ellipsis can't help because
     * the string itself is complete from the browser's point of view.
     */
    export const LEGACY_TITLE_CAP = 100;
    
    export function ellipsizeHardCutTitle(title: string): string {
      // Only exactly-100-char titles ending in a word character are treated as cut:
      // a title that naturally ends in "." or ")" or is any other length is left
      // alone, so we never decorate a complete sentence with a false "…".
      if (title.length !== LEGACY_TITLE_CAP || !/[\p{L}\p{N}]$/u.test(title)) return title;
      const boundary = title.lastIndexOf(' ');
      // No space in the last 40% means one huge token (a path or URL); keep it
      // and just mark it, rather than chopping most of the title away.
      const head = boundary > LEGACY_TITLE_CAP * 0.6 ? title.slice(0, boundary) : title;
      return `${head.replace(/[\s,;:–—-]+$/u, '')}…`;
    }

    File: propr-ui/src/components/TaskList/displayTitle.test.ts (new file)

    import { describe, expect, it } from 'vitest';
    import { ellipsizeHardCutTitle } from './displayTitle';
    
    const cut = 'Expose GitHub comment image attachments through the MCP discussion surface so an MCP client can actu';
    
    describe('ellipsizeHardCutTitle', () => {
      it('trims a legacy hard-cut title back to a word boundary and adds an ellipsis', () => {
        expect(cut).toHaveLength(100);
        expect(ellipsizeHardCutTitle(cut)).toBe(
          'Expose GitHub comment image attachments through the MCP discussion surface so an MCP client can…',
        );
      });
    
      it('leaves titles of any other length untouched', () => {
        expect(ellipsizeHardCutTitle('Short title')).toBe('Short title');
        expect(ellipsizeHardCutTitle(cut.slice(0, 99))).toBe(cut.slice(0, 99));
      });
    
      it('does not decorate a 100-character title that ends in punctuation', () => {
        const complete = `${'a '.repeat(49)}b.`;
        expect(complete).toHaveLength(100);
        expect(ellipsizeHardCutTitle(complete)).toBe(complete);
      });
    
      it('keeps a single long token instead of discarding most of it', () => {
        const token = `Fix ${'x'.repeat(96)}`;
        expect(ellipsizeHardCutTitle(token)).toBe(`${token}…`);
      });
    });

    File: propr-ui/src/components/TaskList/rowModel.ts

    Why this file: sanitizeTaskTitle is the single funnel for row, card and earlier-run titles (see rowModel.test.ts). Applying the repair after prefix and model-tag stripping matters: stripping shortens the string, so the 100-character check has to run on the raw title, and the ellipsis is then added to the sanitized result.

    --- a/propr-ui/src/components/TaskList/rowModel.ts
    +++ b/propr-ui/src/components/TaskList/rowModel.ts
    @@ -1,3 +1,4 @@
    +import { ellipsizeHardCutTitle, LEGACY_TITLE_CAP } from './displayTitle';
    @@ export function sanitizeTaskTitle(raw: string | null | undefined, ...): string {
    -  return cleaned;
    +  // Detect the legacy cut on the raw string (stripping prefixes would hide the
    +  // 100-char signature), then mark the cleaned title so the "…" survives.
    +  if (raw && raw.length === LEGACY_TITLE_CAP && ellipsizeHardCutTitle(raw) !== raw) {
    +    // Same rule as ellipsizeHardCutTitle, applied to the cleaned string:
    +    // drop the trailing partial word, then mark the cut.
    +    const head = cleaned.includes(' ') ? cleaned.replace(/\s+\S*$/u, '') : cleaned;
    +    return `${head.replace(/[\s,;:–—-]+$/u, '')}…`;
    +  }
    +  return cleaned;
     }

    (If cleaned is shorter than 100 after stripping, the first branch applies: drop the trailing partial word and append …. Add a case to rowModel.test.ts with a Fix PR #2693: prefix and a 100-character raw title, and assert that the output ends with can….)

    File: packages/shared/src/text.ts (new file)

    Why this file: The backend needs one tested truncation helper for every place that clips titles. It lives in @propr/shared so the API, core and worker code all import the same rule.

    /**
     * Shorten `text` to at most `max` characters without splitting a word, marking
     * the cut with a single "…" so readers (and the UI) can tell it is incomplete.
     */
    export function truncateAtWord(text: string, max: number): string {
      if (max < 2) throw new RangeError('truncateAtWord needs room for at least one character and the ellipsis');
      const value = text.trim();
      if (value.length <= max) return value;
      const room = value.slice(0, max - 1); // reserve one char for "…"
      const boundary = room.lastIndexOf(' ');
      // Fall back to a hard cut only for a single enormous token (path/URL), where
      // no word boundary exists in a reasonable window.
      const head = boundary >= Math.floor(max * 0.6) ? room.slice(0, boundary) : room;
      return `${head.replace(/[\s,;:–—-]+$/u, '')}…`;
    }

    Export it from packages/shared/src/index.ts (export * from './text.js';). Add packages/shared/src/text.test.ts with the same four cases as the UI test, plus truncateAtWord('abc', 10) === 'abc' and a check that the result length is always <= max.

    File: backend title builders (locate with grep)

    Why: This stops the bug at its source for new tasks. Run:

    grep -rnE "\.(substring|slice)\(0, ?100\)" src packages/core/src packages/api | grep -i title

    and replace each title-related hit as below (the likely location is src/jobs/prTaskTitleHelpers.ts, buildPrTaskTitle):

    --- a/src/jobs/prTaskTitleHelpers.ts
    +++ b/src/jobs/prTaskTitleHelpers.ts
    @@
    +import { truncateAtWord } from '@propr/shared';
    @@
    -  const title = rawTitle.substring(0, 100);
    +  // A hard slice produced titles ending mid-word ("...can actu") that no UI can
    +  // repair; cut at a word boundary and mark the cut explicitly.
    +  const title = truncateAtWord(rawTitle, 100);

    Update test/prTaskTitleHelpers.test.ts: add a case with an over-long issue title and assert that the built title ends with … and has no partial final word.

    File: propr-ui/src/components/TaskDetails/index.tsx

    Why this file: TaskDetails is reused in the pane, so it has to accept the ID as a prop and give up page-level responsibilities (document title, post-delete navigation, wide two-column layout) when embedded.

    --- a/propr-ui/src/components/TaskDetails/index.tsx
    +++ b/propr-ui/src/components/TaskDetails/index.tsx
    @@
    -const TaskDetails: React.FC = () => {
    -  const { taskId = '' } = useParams<{ taskId: string }>();
    +interface TaskDetailsProps {
    +  /** Overrides the route param; set by the /tasks split pane. */
    +  taskId?: string;
    +  /** Rendered inside the split pane rather than as its own page. */
    +  embedded?: boolean;
    +  onClose?: () => void;
    +  onDeleted?: () => void;
    +}
    +
    +const TaskDetails: React.FC<TaskDetailsProps> = ({ taskId: taskIdProp, embedded = false, onDeleted }) => {
    +  const { taskId: routeTaskId = '' } = useParams<{ taskId: string }>();
    +  // Prop first: the pane lives under /tasks, which has no :taskId param.
    +  const taskId = taskIdProp ?? routeTaskId;
    @@
    -  useDocumentTitle(title);
    +  // The list owns the tab title while embedded; flipping it on every j/k
    +  // keystroke would be distracting and pollutes history-based title UIs.
    +  useDocumentTitle(embedded ? null : title);
    @@ handleDelete success path
    -  navigate('/tasks');
    +  // Embedded: close the pane and stay on the list (the list's live refresh
    +  // drops the deleted row). Page mode keeps its original navigation.
    +  if (embedded && onDeleted) onDeleted(); else navigate('/tasks');
    @@ root element
    -  <div data-testid="task-details" className="...">
    +  <div
    +    data-testid="task-details"
    +    data-embedded={embedded || undefined}
    +    // Force the single-column, workspace-scroll layout in the pane: at 55% of
    +    // 1280–1600px the two-column lg layout would squeeze both columns.
    +    className={`... ${embedded ? 'task-details-embedded h-full min-h-0' : ''}`}
    +  >

    If useDocumentTitle doesn't accept null, call it conditionally through a tiny wrapper component instead. Don't call a hook conditionally. In the two-column layout branch, choose the single-column branch when embedded is true. Use the same condition the component already uses for widths below 1024px (task-workspace-scroll), so the scroll ownership already verified by task-details-responsive.pw.ts is reused.

    File: propr-ui/e2e/task-list-split.pw.ts (new file)

    Why this file: Covers the new behaviour end to end with the same privacy-safe fixture approach as task-list-desktop.pw.ts (route stubs, fixed clock), so a future layout change can't quietly bring back the blank gap or break new-tab clicks.

    import { expect, test, type Page } from '@playwright/test';
    
    // Two pull requests with two runs each plus details/live endpoints for the pane.
    const tasks = [1, 2].flatMap(pr => [0, 1].map(run => ({
      id: `pr-${pr}-run-${run}`, repository: 'acme/web', repositoryOwner: 'acme', repositoryName: 'web',
      issueNumber: pr, prNumber: pr, linkedIssueNumber: pr,
      title: run === 0 && pr === 1
        ? 'Expose GitHub comment image attachments through the MCP discussion surface so an MCP client can actu'
        : `Fix PR #${pr}: Task ${pr}`,
      subtitle: null, status: 'completed', createdAt: '2026-10-01T11:00:00Z', processedAt: '2026-10-01T11:00:00Z',
      completedAt: '2026-10-01T11:05:00Z', llmProvider: 'codex', model: 'gpt-6-astra',
    })));
    
    async function fixture(page: Page) {
      await page.routeWebSocket('**/socket.io/**', socket => socket.close());
      await page.route('**/api/**', route => {
        const path = new URL(route.request().url()).pathname;
        if (path === '/api/auth/demo-mode') return route.fulfill({ json: { demoMode: true } });
        if (path === '/api/tasks') return route.fulfill({ json: { tasks, total: 14919 } });
        const history = /^\/api\/task\/([^/]+)\/history$/.exec(path);
        if (history) return route.fulfill({ json: { history: [{ state: 'COMPLETED', timestamp: '2026-10-01T11:05:00Z' }], taskInfo: { title: `Details ${history[1]}`, type: 'issue', number: 1, repoOwner: 'acme', repoName: 'web' } } });
        if (path.endsWith('/live-details')) return route.fulfill({ json: { events: [], todos: [], currentTask: null } });
        return route.fulfill({ status: 503, json: { error: 'unavailable in split fixture' } });
      });
    }
    
    test('wide screens open tasks inline and keep filters in the URL', async ({ page }) => {
      await page.setViewportSize({ width: 1920, height: 1080 });
      await fixture(page);
      await page.goto('/tasks?repository=acme%2Fweb');
      await page.getByRole('link', { name: /Expose GitHub comment/ }).first().click();
      await expect(page).toHaveURL(/\/tasks\?.*repository=acme%2Fweb.*task=pr-1-run-0|\/tasks\?.*task=pr-1-run-0.*repository=acme%2Fweb/);
      await expect(page.getByTestId('task-split-details').getByTestId('task-details')).toBeVisible();
      await page.keyboard.press('j');
      await expect(page).toHaveURL(/task=pr-2-run-0/);
      await page.keyboard.press('Escape');
      await expect(page.getByTestId('task-split-details')).toHaveCount(0);
    });
    
    test('titles cut by the legacy 100-character slice end with an ellipsis', async ({ page }) => {
      await page.setViewportSize({ width: 1920, height: 1080 });
      await fixture(page);
      await page.goto('/tasks');
      await expect(page.getByText(/MCP client can…$/).first()).toBeVisible();
      await expect(page.getByText(/can actu$/)).toHaveCount(0);
    });
    
    test('pagination docks under the last row and counts both units', async ({ page }) => {
      await page.setViewportSize({ width: 1920, height: 1080 });
      await fixture(page);
      await page.goto('/tasks');
      const footer = page.getByText('Showing tasks 1–4 of 14,919 · 2 pull requests on this page');
      await expect(footer).toBeVisible();
      const lastRow = page.getByTestId('task-row').last();
      const gap = (await footer.boundingBox())!.y - ((await lastRow.boundingBox())!.y + (await lastRow.boundingBox())!.height);
      // Docked, not pinned: well under the old ~400px void.
      expect(gap).toBeLessThan(80);
    });
    
    test('narrow screens still navigate to the full page', async ({ page }) => {
      await page.setViewportSize({ width: 1024, height: 800 });
      await fixture(page);
      await page.goto('/tasks');
      await page.getByText('Task 2').first().click();
      await expect(page).toHaveURL(/\/tasks\/pr-2-run-0$/);
    });

    File: propr-ui/e2e/task-list-desktop.pw.ts

    Why this file: Two existing assertions depend on old behaviour: the footer wording, and Enter on a title navigating at 1280/1920. Update them so they describe the new contract instead of deleting coverage.

    --- a/propr-ui/e2e/task-list-desktop.pw.ts
    +++ b/propr-ui/e2e/task-list-desktop.pw.ts
    @@
    -      await expect(page.getByText('Showing 1–50 of 14,769 tasks')).toBeVisible();
    +      // Footer now states both units; the fixture page has 23 tasks in 5 PR rows.
    +      await expect(page.getByText(/^Showing tasks 1–50 of 14,769 · 5 pull requests on this page$/)).toBeVisible();
    @@
    -      await page.keyboard.press('Enter');
    -      await expect(page).toHaveURL(/\/tasks\/pr-2664-run-0$/);
    +      await page.keyboard.press('Enter');
    +      // >=1280px: Enter on the title link opens the inline pane instead of navigating.
    +      await expect(page).toHaveURL(/\/tasks\?(.*&)?task=pr-2664-run-0/);
    +      await expect(page.getByTestId('task-split-details')).toBeVisible();

    (Enter on a focused <a> fires a click with button === 0 and no modifiers, so handleTaskLinkClick intercepts it on purpose. Keyboard users get the pane, and "Open full page" in the pane header gives the full route.) Check the rollup assertions in the same test: they run before any selection, so they still see the full-width table.


    Verification steps for the implementer

    1. npm run build -w @propr/shared && npm run typecheck -w propr-ui && npm run lint -w propr-ui -- --max-warnings 0
    2. npx vitest run src/components/TaskList (in propr-ui), plus the TaskDetails and TaskList.test.tsx suites. TaskList.test.tsx has footer-text assertions; update them to the new copy.
    3. node scripts/run-test-suite.mjs test/prTaskTitleHelpers.test.ts packages/shared/src/text.test.ts
    4. cd propr-ui && npx playwright test e2e/task-list-desktop.pw.ts e2e/task-list-split.pw.ts e2e/task-details-responsive.pw.ts
    5. Manual: at 1920×1080, click through tasks with j/k, resize the split and reload (the ratio persists), Ctrl-click a title (opens a new tab), delete a task from the pane (the pane closes and the row disappears).
  2. propr-dev commented on Oct 3, 2026

    @propr-dev
    ContributorAuthor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 2719/claude-opus-5-5-turn-tasks-into-a-master--20261003-2256-hk0
    • Base Branch: main
    • Worktree: issue-2719-20261003-2256-claude-opus-5-5-hk0

    🔍 Track Task Execution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions