Skip to content

Add mobile Inbox actions for stopping tasks, following up, opening PRs, and dismissing #1724

Closed

Description

@propr-dev

Context

Inbox cards must be actionable rather than acting only as status summaries. Task notifications need Stop, Follow up, Open PR, Dismiss, and detail navigation while reusing existing authenticated task APIs.

Requirements

  • Render only actions advertised by each notification event.
  • Require confirmation before stopping an active task.
  • Reuse the existing follow-up modal and postTaskFollowup API.
  • Open PR URLs in a new browser context with safe noopener,noreferrer behavior.
  • Never trust a PR URL outside https://github.com.
  • Disable actions while a request is pending.
  • Show success and error toasts.
  • Re-fetch or reconcile the Inbox after a successful action.
  • Preserve accessible labels and minimum mobile tap targets.

Acceptance Criteria

  • Stop is unavailable unless included in the event action list.
  • Stop requires explicit confirmation and cannot be triggered by a push click alone.
  • Follow up opens a modal, posts once, and closes after success.
  • Open PR rejects malformed or non-GitHub URLs.
  • Dismiss updates unread count and removes the card.
  • All controls work at 320px width and with keyboard navigation.

Created by ProPR AI Planner

Activity

  1. propr-dev commented on Aug 2, 2026

    @propr-dev
    ContributorAuthor

    Suggested Implementation:

    Implementation Approach

    Use a dedicated action component that receives the immutable notification item and callback hooks from the Inbox. Existing task APIs remain the source of truth; no duplicate notification-specific stop or follow-up endpoint is added. Confirmation is implemented in the foreground UI because notification service workers cannot provide sufficient context for destructive actions.

    File: propr-ui/src/components/Inbox/TaskNotificationActions.tsx (new file)

    Why this file: It encapsulates task-specific mutations and validation without making InboxPage aware of task API details.

    import React, { useState } from 'react';
    import type { NotificationEvent } from '@propr/shared';
    import { ExternalLink, MessageSquarePlus, OctagonX, Trash2 } from 'lucide-react';
    import { postTaskFollowup, stopTaskExecution } from '../../api/proprApi';
    import FollowupModal from '../TaskDetails/FollowupModal';
    import { useToast } from '../ui/useToast';
    
    interface Props {
      item: NotificationEvent;
      onDismiss: () => Promise<void>;
      onChanged: () => Promise<void>;
    }
    
    const safeGithubUrl = (value: string | null | undefined): string | null => {
      try {
        const url = new URL(value ?? '');
        return url.protocol === 'https:' && url.hostname === 'github.com' ? url.href : null;
      } catch {
        return null;
      }
    };
    
    export function TaskNotificationActions({ item, onDismiss, onChanged }: Props) {
      const { addToast } = useToast();
      const [busy, setBusy] = useState(false);
      const [followupOpen, setFollowupOpen] = useState(false);
      const actions = new Set(item.actions);
      const prUrl = safeGithubUrl(item.prUrl);
    
      const stop = async () => {
        // Stopping can discard active agent work, so a foreground confirmation is
        // required even when the action originated from an urgent notification.
        if (!window.confirm('Stop this task? Current agent work will be interrupted.')) return;
        setBusy(true);
        try {
          await stopTaskExecution(item.targetId);
          addToast({ type: 'success', message: 'Stop requested.' });
          await onChanged();
        } catch (error) {
          addToast({ type: 'error', message: (error as Error).message });
        } finally {
          setBusy(false);
        }
      };
    
      const submitFollowup = async (body: string) => {
        setBusy(true);
        try {
          await postTaskFollowup(item.targetId, body);
          setFollowupOpen(false);
          addToast({ type: 'success', message: 'Follow-up posted.' });
          await onChanged();
        } finally {
          setBusy(false);
        }
      };
    
      return (
        <>
          <div className='flex flex-wrap gap-2'>
            {actions.has('stop') && <button type='button' disabled={busy} onClick={stop} className='min-h-10 rounded-md border border-red-200 px-3 text-sm text-red-700'><OctagonX className='mr-1 inline h-4 w-4' />Stop</button>}
            {actions.has('follow_up') && <button type='button' disabled={busy} onClick={() => setFollowupOpen(true)} className='min-h-10 rounded-md border px-3 text-sm'><MessageSquarePlus className='mr-1 inline h-4 w-4' />Follow up</button>}
            {actions.has('open_pr') && prUrl && <button type='button' onClick={() => window.open(prUrl, '_blank', 'noopener,noreferrer')} className='min-h-10 rounded-md border px-3 text-sm'><ExternalLink className='mr-1 inline h-4 w-4' />Open PR</button>}
            {actions.has('dismiss') && <button type='button' disabled={busy} onClick={onDismiss} className='min-h-10 rounded-md border px-3 text-sm text-slate-600'><Trash2 className='mr-1 inline h-4 w-4' />Dismiss</button>}
          </div>
          <FollowupModal
            isOpen={followupOpen}
            onClose={() => setFollowupOpen(false)}
            onSubmit={submitFollowup}
            initialContent=''
            taskInfo={{ repository: item.projectSlug ?? undefined, title: item.title } as never}
          />
        </>
      );
    }

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

    Why this file: Replace the empty action mount point with the task action component while retaining the page-level dismissal and refresh callbacks.

    --- a/propr-ui/src/pages/InboxPage.tsx
    +++ b/propr-ui/src/pages/InboxPage.tsx
    @@ -1,5 +1,6 @@
    +import { TaskNotificationActions } from '../components/Inbox/TaskNotificationActions';
    @@ -145,7 +146,15 @@
    -                  <div className='notification-actions mt-3 flex flex-wrap gap-2' data-notification-id={item.id} />
    +                  {item.targetType === 'task' && (
    +                    <div className='mt-3'>
    +                      <TaskNotificationActions
    +                        item={item}
    +                        onDismiss={() => dismiss(item)}
    +                        onChanged={() => load()}
    +                      />
    +                    </div>
    +                  )}

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

    Why this file: The task detail page is a push deep-link destination. Its existing actions must remain reachable on narrow screens without horizontal clipping.

    --- a/propr-ui/src/components/TaskDetails/ActionBar.tsx
    +++ b/propr-ui/src/components/TaskDetails/ActionBar.tsx
    @@ -119,7 +119,10 @@
    -  <div className='flex items-center gap-2'>
    +  {/* Wrapping preserves every task action on phone-sized screens. Hiding the
    +      overflow would make a valid push deep link land on a page where its action
    +      is still inaccessible. */}
    +  <div className='flex flex-wrap items-center justify-end gap-2'>
  2. propr-dev commented on Aug 24, 2026

    @propr-dev
    ContributorAuthor

    🤖 AI processing has started for this issue using codex agent with gpt-5.6-sol model.

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

    Processing Details:

    • Agent: codex
    • Model: gpt-5.6-sol
    • Branch: 1724/gpt-5.6-sol-add-mobile-inbox-actions--20260824-1639-e1g
    • Base Branch: 1716-epic-failed-to-3m8
    • Worktree: issue-1724-20260824-1639-gpt-5.6-sol-e1g

    🔍 Track Task Execution

  3. added a commit that references this issue on Aug 24, 2026
  4. added a commit that references this issue on Aug 25, 2026
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