Skip to content

Expose automatic CI follow-up controls in CLI, UI, and docs #1928

Closed

Description

@propr-dev

Context

The backend option is only useful if administrators can enable it for selected repositories. ProPR already has CLI and UI flows for adding, editing, and toggling monitored repositories. Those surfaces need to expose the new autoFollowupOnFailedCi flag while keeping the default off.

Requirements

  • Add CLI support for enabling/disabling the repo flag.
  • Add UI controls for admins in repository add/edit flows.
  • Keep controls disabled or hidden for read-only/non-admin users.
  • Show current state in repository lists so admins can audit which repos have automation enabled.
  • Document the option and its off-by-default behavior.
  • Add UI and CLI tests for preserving and changing the field.

Implementation Specification

  1. Update packages/cli/src/commands/repoCommands.ts so repo add accepts --auto-ci-followup and repo toggle or equivalent update command accepts --auto-ci-followup / --no-auto-ci-followup.
  2. Update repository UI types and state in propr-ui/src/hooks/useRepositoryManagement.ts.
  3. Add a checkbox/toggle in AddRepositoryModal and AddRepositoryForm.
  4. Add a visible badge or toggle row in RepositoryListItem for admins.
  5. Update docs/docs/features/propr-cli.md.
  6. Add or update tests in propr-ui/src/hooks/useRepositoryManagement.test.tsx and CLI command tests.

Acceptance Criteria

  • propr repo add owner/repo --auto-ci-followup creates a repo with autoFollowupOnFailedCi: true.
  • Admin UI can enable the option for one repo without changing others.
  • Non-admin/read-only UI cannot mutate the option.
  • The repository list clearly shows which repos have automatic CI follow-up enabled.
  • Documentation states the option is off by default and should be enabled only for repos with trusted CI signal quality.

Created by ProPR AI Planner

Activity

  1. propr-dev commented on Aug 24, 2026

    @propr-dev
    ContributorAuthor

    Suggested Implementation:

    Implementation Approach

    This implementation extends existing repo-management surfaces instead of creating a separate settings page. That keeps the feature close to the repository it affects and prevents admins from managing two disconnected lists. The UI should use a compact toggle because this is a binary operational setting, while the CLI should expose explicit positive and negative flags so scripts can set the state idempotently.

    File: packages/cli/src/commands/repoCommands.ts

    Why this file: This file owns the propr repo command group. Adding flags here gives admins a scriptable way to opt individual repos in or out.

    --- a/packages/cli/src/commands/repoCommands.ts
    +++ b/packages/cli/src/commands/repoCommands.ts
    @@
       repoCommand
         .command('add')
         .argument('<owner/repo>')
         .option('-a, --alias <alias>', 'Display alias')
         .option('-b, --base-branch <branch>', 'Base branch')
    +    .option('--auto-ci-followup', 'Automatically post a ProPR follow-up request when CI fails for this repository')
         .option('--json', 'Output raw JSON')
         .action(async (fullName, options) => {
           const result = await addRepo(fullName, {
             alias: options.alias,
             baseBranch: options.baseBranch,
    +        // Keep this explicit instead of deriving from another repo flag; automatic
    +        // CI follow-up creates work, so only this dedicated admin option enables it.
    +        autoFollowupOnFailedCi: options.autoCiFollowup === true,
           });
    @@
       repoCommand
         .command('toggle')
         .argument('<owner/repo>')
         .option('--enable', 'Enable repository monitoring')
         .option('--disable', 'Disable repository monitoring')
    +    .option('--auto-ci-followup', 'Enable automatic CI failure follow-up for this repository')
    +    .option('--no-auto-ci-followup', 'Disable automatic CI failure follow-up for this repository')
         .option('--json', 'Output raw JSON')
         .action(async (fullName, options) => {
           const updates = {
             ...(options.enable ? { enabled: true } : {}),
             ...(options.disable ? { enabled: false } : {}),
    +        // Commander sets the value to false only when --no-auto-ci-followup is
    +        // provided, so undefined correctly means leave the existing repo setting alone.
    +        ...(options.autoCiFollowup !== undefined ? { autoFollowupOnFailedCi: options.autoCiFollowup } : {}),
           };
           const result = await updateRepo(fullName, updates);

    File: propr-ui/src/hooks/useRepositoryManagement.ts

    Why this file: This hook owns repository state mutations. The flag must be included in optimistic updates and save payloads so the UI does not drop it while editing unrelated fields.

    --- a/propr-ui/src/hooks/useRepositoryManagement.ts
    +++ b/propr-ui/src/hooks/useRepositoryManagement.ts
    @@
     export type Repo = MonitoredRepo & {
       // existing fields
    +  autoFollowupOnFailedCi?: boolean;
     };
    @@
    +const normalizeRepoAutomationDefaults = (repo: Repo): Repo => ({
    +  ...repo,
    +  // Normalize at the UI boundary so old API responses render as off and saves
    +  // preserve the explicit boolean instead of relying on undefined semantics.
    +  autoFollowupOnFailedCi: repo.autoFollowupOnFailedCi === true,
    +});
    +
    @@
    -  setRepos(response.repos_to_monitor);
    +  setRepos(response.repos_to_monitor.map(normalizeRepoAutomationDefaults));
    @@
    +  const updateRepoAutoCiFollowup = useCallback((repoName: string, enabled: boolean) => {
    +    // Use the same local state path as other repo edits so one save operation
    +    // persists all repository settings together and avoids racing config writes.
    +    setRepos((current) => current.map((repo) => repo.name === repoName
    +      ? { ...repo, autoFollowupOnFailedCi: enabled }
    +      : repo));
    +    setSaveStatus('saving');
    +  }, []);
    +
    @@
       return {
         repos,
    +    updateRepoAutoCiFollowup,
         // existing returned values
       };

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

    Why this file: Admins should be able to opt in at the moment they add a repo, but the checkbox must default off.

    --- a/propr-ui/src/components/AddRepositoryForm.tsx
    +++ b/propr-ui/src/components/AddRepositoryForm.tsx
    @@
     interface AddRepositoryFormProps {
       // existing props
    +  autoFollowupOnFailedCi: boolean;
    +  onAutoFollowupOnFailedCiChange: (enabled: boolean) => void;
     }
    @@
    +      <label className="flex items-start gap-3 rounded border border-gray-200 p-3 text-sm">
    +        <input
    +          type="checkbox"
    +          checked={autoFollowupOnFailedCi}
    +          disabled={readOnly}
    +          onChange={(event) => onAutoFollowupOnFailedCiChange(event.target.checked)}
    +          className="mt-1 h-4 w-4"
    +        />
    +        <span>
    +          <span className="block font-medium text-gray-800">Auto follow-up on failing CI</span>
    +          <span className="block text-gray-500">
    +            Post a ProPR follow-up request with the failing check details when CI fails. Off by default.
    +          </span>
    +        </span>
    +      </label>

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

    Why this file: The repository list is the fastest audit surface for admins. Showing the state here makes it clear which repos can create automatic follow-up work.

    --- a/propr-ui/src/components/RepositoryListItem.tsx
    +++ b/propr-ui/src/components/RepositoryListItem.tsx
    @@
     interface RepositoryListItemProps {
       repo: MonitoredRepo;
       // existing props
    +  onAutoCiFollowupChange?: (repoName: string, enabled: boolean) => void;
     }
    @@
    +      <button
    +        type="button"
    +        disabled={readOnly || !onAutoCiFollowupChange}
    +        onClick={() => onAutoCiFollowupChange?.(repo.name, !repo.autoFollowupOnFailedCi)}
    +        className={repo.autoFollowupOnFailedCi ? 'text-amber-700' : 'text-gray-400'}
    +        title="Auto follow-up on failing CI"
    +      >
    +        {repo.autoFollowupOnFailedCi ? 'CI follow-up on' : 'CI follow-up off'}
    +      </button>

    File: docs/docs/features/propr-cli.md

    Why this file: This is the user-facing CLI reference and should document the new admin option alongside existing repository commands.

    --- a/docs/docs/features/propr-cli.md
    +++ b/docs/docs/features/propr-cli.md
    @@
     propr repo list                              # Monitored repositories
     propr repo add owner/repo -a "Alias" -b dev  # Add with alias and base branch
    +propr repo add owner/repo --auto-ci-followup # Add and opt into CI failure follow-up
     propr repo remove owner/repo
     propr repo toggle owner/repo --enable        # Enable/disable monitoring
    +propr repo toggle owner/repo --auto-ci-followup
    +propr repo toggle owner/repo --no-auto-ci-followup
     propr repo index owner/repo                  # Full reindex
    @@
     
    +
    +`--auto-ci-followup` is off by default. Enable it only for repositories where failing check output is specific enough for ProPR to turn into useful follow-up work; ProPR posts a visible PR comment with the failing check excerpt before processing it.

    Tests

    Add tests covering:

    • CLI repo add --auto-ci-followup sends autoFollowupOnFailedCi: true.
    • CLI repo toggle --no-auto-ci-followup sends false without changing enabled.
    • UI add form defaults the checkbox to false.
    • UI repository list invokes updateRepoAutoCiFollowup(repo.name, nextValue) only for admins/non-read-only mode.
  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: 1928/gpt-5.6-sol-expose-automatic-ci-follo-20260824-0937-v7v
    • Base Branch: 1926-epic-automatic-ci-vn4
    • Worktree: issue-1928-20260824-0937-gpt-5.6-sol-v7v

    🔍 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 24, 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