Skip to content

Add repository configuration for automatic pull request assignment #2897

Closed

Description

@propr-dev

Context

The user-contributed half of the request asks for automatic pull request assignment with three knobs:

  • "Keep the feature optional and disabled by default."
  • "Optionally allow configuring a default assignee per repository, overriding the issue author."
  • "Optionally request a GitHub review from the assigned user."

That is three per-repository options. They belong on RepoToMonitor beside autoFollowupOnFailedCi and cancelCiDuringFollowup, which are the same shape of thing: opt-in automation configured per repository, off by default.

This task adds the configuration end to end - the type, the validator, the "a client that does not know the field must not clear it" preservation, the resolver the worker will call, the CLI flags and the MCP fields. The worker behaviour that consumes it is the next task, and the Web UI control is the one after. Splitting it this way keeps each diff focused, and it means the options can be reviewed as data before anything acts on them.

configRepoValidation.ts establishes a hard rule this task must follow: every per-repository option needs a preserveRepo* function and must be added to the preserveRepoSettings chain, because partial and legacy clients (the CLI, scripts, older UIs) post the whole repository list without fields they do not know about. Forgetting it means a propr repo toggle silently turns off auto-assignment.

Requirements

  1. Add to RepoToMonitor in packages/core/src/config/configManager.ts:
    • autoAssignPullRequests?: boolean - off when absent.
    • autoAssignDefaultAssignee?: string | null - a GitHub login replacing the issue author; null or absent means use the issue author.
    • autoAssignRequestReview?: boolean - off when absent.
  2. Normalize and validate all three in normalizeRepoConfig, validating the login with the shared isGitHubLogin.
  3. Add preserveRepoAutoAssign and include it in the preserveRepoSettings chain; treat the three options as repository-wide, applied to every branch entry, matching how notifications and visual previews already behave.
  4. Default all three in withDefaultRepoOptions.
  5. Add resolveRepositoryAutoAssignment(owner, repo) to packages/core/src/daemon/configLoader.ts, returning the effective settings and failing closed (disabled) when the configuration cannot be read.
  6. Add CLI flags to propr repo add and propr repo toggle: --auto-assign <on|off>, --auto-assign-to <login|none>, --auto-assign-review <on|off>; show the values in propr repo list; send only explicitly supplied values.
  7. Add the three fields to the MCP update_repository_configuration tool and ensure get_repository_configuration returns them.
  8. Tests covering validation, preservation under a partial write, the repository-wide application across branch entries, the resolver's fail-closed behaviour and the CLI flag parsing.

Implementation Specification

Files modified

  • packages/core/src/config/configManager.ts - the three fields on RepoToMonitor.
  • packages/api/routes/configRepoValidation.ts - normalization, validation, preservation.
  • packages/core/src/daemon/configLoader.ts - the resolver.
  • packages/cli/src/api/repos.ts - the typed options.
  • packages/cli/src/commands/repoCommands.ts - the flags and the list column.
  • packages/api/mcp/toolsManagement.ts - the tool fields.
  • packages/api/test/repoAutoAssignConfig.test.ts (new file).

Step-by-step

  1. Add the fields to RepoToMonitor with comments stating the default and the override semantics.
  2. In configRepoValidation.ts: add the two booleans to OPTIONAL_BOOLEAN_FIELDS, add a normalizeAutoAssignDefaultAssignee helper validating the login, and write preserveRepoAutoAssign following preserveRepoNotifications - resolve the repository-wide value, apply an explicit change to every entry, and keep the stored value for entries that omit the field.
  3. Add resolveRepositoryAutoAssignment to configLoader.ts, following getCancelCiDuringFollowupWorkflowsForRepository's structure, including its fail-closed behaviour on an unreadable configuration.
  4. Add the CLI flags, converting on/off and none explicitly rather than treating any string as truthy.
  5. Add the MCP fields with descriptions and include them in the patch key list.
  6. Add the test file.

Acceptance Criteria

  • npm run typecheck, npm run lint and the API tests pass.
  • A repository with none of the fields set reports all three as disabled or null; existing configurations are unchanged.
  • POST /api/config/repos with the three fields persists them; a non-boolean, a non-login string, or an unknown login shape is rejected with 400 naming the repository and field.
  • Posting the repository list without the fields - as the CLI and older clients do - leaves the stored values untouched.
  • Setting any of the three on one branch entry applies it to every entry of that repository.
  • autoAssignDefaultAssignee: null clears the override so the issue author is used again.
  • resolveRepositoryAutoAssignment returns the effective values, and returns disabled when the configuration cannot be read.
  • propr repo add owner/name --auto-assign on --auto-assign-to octocat --auto-assign-review on persists all three; propr repo toggle changes only the flags given; --auto-assign-to none clears the override; propr repo list shows the state.
  • MCP update_repository_configuration sets and clears each field, and get_repository_configuration returns them.
  • No behaviour change yet: nothing reads the resolver in this task.

Created by ProPR AI Planner

Activity

  1. propr-dev commented on Oct 8, 2026

    @propr-dev
    ContributorAuthor

    Suggested Implementation:

    Implementation Approach

    These three options are structurally identical to options this codebase already has, so the approach is to follow the existing pattern exactly rather than invent a new one. autoFollowupOnFailedCi and cancelCiDuringFollowup are both opt-in automation, per repository, off by default, with an operator-supplied payload (a workflow list) attached to one of them. Auto-assignment is the same shape with a login instead of a workflow list.

    Two parts of that pattern are load-bearing and easy to get wrong.

    Preservation. configRepoValidation.ts documents the rule in its own comments: "Clients that do not know the option (older UIs, the CLI, scripts) submit repositories without it; their writes must never silently switch it off." Every per-repository option therefore has a preserveRepo* function wired into preserveRepoSettings. For auto-assignment the consequence of forgetting is specific and quiet: someone runs propr repo toggle owner/name to flip monitoring, the CLI posts the list without the auto-assign fields, and automatic assignment silently stops. No error, no log, just PRs that stop getting assigned.

    Repository-wide, not per branch entry. A repository can have several RepoToMonitor entries, one per monitored base branch. Notifications, the GitHub PR template fallback and visual previews are all repository-wide and apply a change to every entry. Auto-assignment must be too: "assign the PR to the issue author" is a property of how the team works, not of which branch the work targets, and per-branch divergence would mean the same pull request behaved differently depending on its base.

    The default assignee is a login, not an id. This is the one place in the feature that stores a login rather than a stable id. That is deliberate: an operator types a login, and a configuration file holding octocat is reviewable while one holding 583231 is not. The cost is that a renamed account breaks the override - which fails loudly (GitHub refuses the assignee, the worker logs it and falls back to the issue author) rather than silently assigning the wrong person, which is the failure an id would risk if the id were ever mistyped.

    The resolver fails closed. An unreadable repository configuration returns disabled, matching isCancelCiDuringFollowupEnabledForRepository. Automation that writes to the customer's repository must not run on a guess.

    File: packages/core/src/config/configManager.ts

    Why this file: RepoToMonitor is the shared contract for per-repository configuration, consumed by the API validator, the daemon resolver, the CLI client and the MCP tool. The defaults have to be documented here because every one of those readers depends on "absent means off".

    --- a/packages/core/src/config/configManager.ts
    +++ b/packages/core/src/config/configManager.ts
    @@ in RepoToMonitor
         notificationsEnabled?: boolean; // Defaults to true; undefined (legacy configurations) reads as enabled
    +    // Assign the pull request once ProPR finishes implementation. Defaults to
    +    // false: automatic assignment changes who GitHub notifies and what appears
    +    // in someone's "Assigned to me" view, so it is never inherited on upgrade.
    +    autoAssignPullRequests?: boolean;
    +    // A GitHub login assigned instead of the source issue's author. Absent or
    +    // null means the issue author is used. Stored as a login rather than an id
    +    // because an operator types it and a reviewable config holds `octocat`,
    +    // not `583231`; a renamed account fails loudly (GitHub refuses the
    +    // assignee and the worker falls back to the issue author).
    +    autoAssignDefaultAssignee?: string | null;
    +    // Also request a review from whoever was assigned. Separate from the
    +    // assignment flag because assignment is ownership and a review request is
    +    // an obligation with its own notification; teams want one without the
    +    // other. Defaults to false.
    +    autoAssignRequestReview?: boolean;
         // Repository-wide override of the instance `auto_resolve_merge_conflicts` default.

    File: packages/api/routes/configRepoValidation.ts

    Why this file: the single validator for every repository write, and the home of the preservation chain. Both halves have to change here: validation rejects a malformed login before it can reach GitHub, and preservation is what stops the CLI from silently clearing the options.

    --- a/packages/api/routes/configRepoValidation.ts
    +++ b/packages/api/routes/configRepoValidation.ts
    @@
     import { normalizeGitHubAttachmentPlanOverride } from '@propr/shared';
    +import { isGitHubLogin } from '@propr/shared';
    @@
     export function withDefaultRepoOptions(repo: RepoToMonitor): RepoToMonitor {
       return {
         ...withAutoResolveMergeConflicts(withDefaultRepoAutoFollowup(repo), normalizeStoredAutoResolveMergeConflicts(repo.autoResolveMergeConflicts)),
         cancelCiDuringFollowup: repo.cancelCiDuringFollowup === true,
    @@
         notificationsEnabled: repo.notificationsEnabled !== false,
    +    // Explicitly false rather than undefined, so every reader sees the same
    +    // value whether the repository predates the option or opted out.
    +    autoAssignPullRequests: repo.autoAssignPullRequests === true,
    +    autoAssignDefaultAssignee: normalizeAutoAssignDefaultAssignee(repo.autoAssignDefaultAssignee),
    +    autoAssignRequestReview: repo.autoAssignRequestReview === true,
         githubPrTemplateFallback: repo.githubPrTemplateFallback !== false,
    +/**
    + * The stored default assignee, or null when there is none.
    + *
    + * Normalizes away whitespace and an empty string so "cleared" has exactly one
    + * representation (null) rather than three that each reader has to handle.
    + */
    +function normalizeAutoAssignDefaultAssignee(value: unknown): string | null {
    +  if (typeof value !== 'string') return null;
    +  const login = value.trim();
    +  return login && isGitHubLogin(login) ? login : null;
    +}
    +
    +/**
    + * Validate the submitted default assignee.
    + *
    + * Rejected at the API boundary rather than discovered at assignment time: a
    + * typo found here is a 400 the operator can fix, while one found later is an
    + * assignment that silently does not happen inside a worker log.
    + */
    +function validateAutoAssignDefaultAssignee(value: unknown, repoName: string): ValidationResult<string | null> {
    +  if (value === undefined || value === null || value === '') return success(null);
    +  if (typeof value !== 'string') return failure('Invalid autoAssignDefaultAssignee format for ' + repoName + ': must be a GitHub login or null');
    +  const login = value.trim();
    +  if (!login) return success(null);
    +  if (!isGitHubLogin(login)) return failure('Invalid autoAssignDefaultAssignee format for ' + repoName + ': must be a valid GitHub login');
    +  return success(login);
    +}
    -const OPTIONAL_BOOLEAN_FIELDS = ['autoFollowupOnFailedCi', 'cancelCiDuringFollowup', 'notificationsEnabled', 'githubPrTemplateFallback'] as const;
    +const OPTIONAL_BOOLEAN_FIELDS = ['autoFollowupOnFailedCi', 'cancelCiDuringFollowup', 'notificationsEnabled', 'githubPrTemplateFallback',
    +  // Validated here so a non-boolean is a 400 rather than a silently truthy
    +  // string that turns automation on.
    +  'autoAssignPullRequests', 'autoAssignRequestReview'] as const;
    @@ in normalizeRepoConfig, beside the other field validations
       const visualPreview = normalizeVisualPreview(candidate.visualPreview, name);
       if (!visualPreview.ok) return visualPreview;
    +  const autoAssignTo = validateAutoAssignDefaultAssignee(candidate.autoAssignDefaultAssignee, name);
    +  if (!autoAssignTo.ok) return autoAssignTo;
    @@ in the returned object
         notificationsEnabled: candidate.notificationsEnabled !== false,
    +    autoAssignPullRequests: candidate.autoAssignPullRequests ?? false,
    +    autoAssignDefaultAssignee: autoAssignTo.value,
    +    autoAssignRequestReview: candidate.autoAssignRequestReview ?? false,
         githubPrTemplateFallback: candidate.githubPrTemplateFallback !== false,
    +/**
    + * Keep auto-assignment across partial writes, and keep it repository-wide.
    + *
    + * Two rules in one function, both load-bearing:
    + *
    + * 1. A client that omits these fields - the CLI, a script, an older UI - must
    + *    not clear them. Without this, `propr repo toggle owner/name` posts the
    + *    whole list without the auto-assign fields and silently stops automatic
    + *    assignment, with no error and nothing in the logs.
    + * 2. "Assign the PR to the issue author" is a property of how a team works,
    + *    not of which base branch the work targets, so an explicit change applies
    + *    to every branch entry of the repository. Per-branch divergence would mean
    + *    the same pull request behaved differently depending on its base.
    + */
    +export function preserveRepoAutoAssign(
    +  previousRepos: RepoToMonitor[],
    +  normalizedRepos: RepoToMonitor[],
    +  incomingRepos: unknown[]
    +): RepoToMonitor[] {
    +  type AutoAssign = Pick<RepoToMonitor, 'autoAssignPullRequests' | 'autoAssignDefaultAssignee' | 'autoAssignRequestReview'>;
    +  // The stored repository-wide value: any entry opting in wins, and the first
    +  // explicit default assignee wins, mirroring how the auto-resolve override
    +  // and the visual-preview settings are resolved.
    +  const stored = new Map<string, AutoAssign>();
    +  for (const key of new Set(previousRepos.map(repo => repositoryKeyOf(repo.name)))) {
    +    const entries = previousRepos.filter(repo => repositoryKeyOf(repo.name) === key);
    +    stored.set(key, {
    +      autoAssignPullRequests: entries.some(entry => entry.autoAssignPullRequests === true),
    +      autoAssignDefaultAssignee: entries.find(entry => normalizeAutoAssignDefaultAssignee(entry.autoAssignDefaultAssignee))?.autoAssignDefaultAssignee
    +        ? normalizeAutoAssignDefaultAssignee(entries.find(entry => normalizeAutoAssignDefaultAssignee(entry.autoAssignDefaultAssignee))!.autoAssignDefaultAssignee)
    +        : null,
    +      autoAssignRequestReview: entries.some(entry => entry.autoAssignRequestReview === true),
    +    });
    +  }
    +
    +  // Collect explicit changes per repository before applying any, so a single
    +  // entry carrying the field decides the value for all of them.
    +  const changed = new Map<string, Partial<AutoAssign>>();
    +  normalizedRepos.forEach((repo, index) => {
    +    const incoming = incomingRepos[index] as Partial<RepoToMonitor>;
    +    const key = repositoryKeyOf(repo.name);
    +    const patch = changed.get(key) ?? {};
    +    if (typeof incoming?.autoAssignPullRequests === 'boolean') patch.autoAssignPullRequests = incoming.autoAssignPullRequests;
    +    if (typeof incoming?.autoAssignRequestReview === 'boolean') patch.autoAssignRequestReview = incoming.autoAssignRequestReview;
    +    // Present-and-null is how the override is cleared, so presence of the key
    +    // is the signal, not truthiness of its value.
    +    if (incoming && Object.hasOwn(incoming, 'autoAssignDefaultAssignee')) {
    +      patch.autoAssignDefaultAssignee = normalizeAutoAssignDefaultAssignee(incoming.autoAssignDefaultAssignee);
    +    }
    +    if (Object.keys(patch).length > 0) changed.set(key, patch);
    +  });
    +
    +  return normalizedRepos.map(repo => {
    +    const key = repositoryKeyOf(repo.name);
    +    const base = stored.get(key) ?? { autoAssignPullRequests: false, autoAssignDefaultAssignee: null, autoAssignRequestReview: false };
    +    return { ...repo, ...base, ...(changed.get(key) ?? {}) };
    +  });
    +}
    @@ in preserveRepoSettings's chain
       repos = preserveRepoAutoResolveMergeConflicts(previousRepos, preserveRepoNotifications(previousRepos, repos, incomingRepos), incomingRepos);
    +  // Added to the chain, not called at individual call sites: the chain exists
    +  // precisely so a new option cannot be forgotten in one place and silently
    +  // reset by partial clients.
    +  repos = preserveRepoAutoAssign(previousRepos, repos, incomingRepos);
       repos = preserveRepoGitHubPrTemplateFallback(previousRepos, repos, incomingRepos);

    File: packages/core/src/daemon/configLoader.ts

    Why this file: the worker and daemon read per-repository options through this module, which already owns the fail-closed convention for them. Putting the resolver here means the next task's worker code needs no knowledge of how the options are stored or of the branch-entry layout.

    --- a/packages/core/src/daemon/configLoader.ts
    +++ b/packages/core/src/daemon/configLoader.ts
    @@
    +/** The effective automatic assignment policy for one repository. */
    +export interface RepositoryAutoAssignment {
    +    enabled: boolean;
    +    /** A login that replaces the issue author, or null to use the issue author. */
    +    defaultAssignee: string | null;
    +    requestReview: boolean;
    +}
    +
    +/**
    + * Resolve automatic pull request assignment for a repository.
    + *
    + * Repository-wide: branch-specific entries share a repository name, so any
    + * entry opting in enables it, matching how the other repository-wide options
    + * are resolved here.
    + *
    + * Fails closed. An unreadable configuration returns disabled, like
    + * isCancelCiDuringFollowupEnabledForRepository: automation that writes to the
    + * customer's repository must not run on a guess about whether it was asked for.
    + */
    +export async function resolveRepositoryAutoAssignment(
    +    owner: string,
    +    repo: string,
    +    loadConfiguredRepos: typeof loadMonitoredReposRaw = loadMonitoredReposRaw,
    +): Promise<RepositoryAutoAssignment> {
    +    const disabled: RepositoryAutoAssignment = { enabled: false, defaultAssignee: null, requestReview: false };
    +    const repository = `${owner.trim()}/${repo.trim()}`.toLowerCase();
    +    if (repository === '/') return disabled;
    +    try {
    +        const entries = (await loadConfiguredRepos()).filter(candidate => candidate.name.trim().toLowerCase() === repository);
    +        if (entries.length === 0) return disabled;
    +        const defaultAssignee = entries
    +            .map(entry => (typeof entry.autoAssignDefaultAssignee === 'string' ? entry.autoAssignDefaultAssignee.trim() : ''))
    +            .find(login => login.length > 0) ?? null;
    +        return {
    +            enabled: entries.some(entry => entry.autoAssignPullRequests === true),
    +            defaultAssignee,
    +            // Only meaningful with assignment on; resolved independently so a
    +            // stored value is not lost while assignment is temporarily off.
    +            requestReview: entries.some(entry => entry.autoAssignRequestReview === true),
    +        };
    +    } catch (error) {
    +        logger.warn({ repository, error: (error as Error).message }, 'Failed to load automatic assignment configuration; treating it as disabled');
    +        return disabled;
    +    }
    +}

    File: packages/cli/src/api/repos.ts

    Why this file: the CLI builds the whole repository list client-side and posts it back, so it must be able to express "I am not changing this field" by omitting it. The existing notificationsEnabled and autoResolveMergeConflicts handling is the model.

    --- a/packages/cli/src/api/repos.ts
    +++ b/packages/cli/src/api/repos.ts
    @@ in MonitoredRepo
       notificationsEnabled?: boolean;
    +  /** Assign the pull request after implementation. Omitted or false means off. */
    +  autoAssignPullRequests?: boolean;
    +  /** A login assigned instead of the issue author; null or absent uses the issue author. */
    +  autoAssignDefaultAssignee?: string | null;
    +  /** Also request a review from the assignee. */
    +  autoAssignRequestReview?: boolean;
    @@ in AddRepoOptions
       notificationsEnabled?: boolean;
    +  autoAssignPullRequests?: boolean;
    +  autoAssignDefaultAssignee?: string | null;
    +  autoAssignRequestReview?: boolean;
    @@ in UpdateRepoOptions
       notificationsEnabled?: boolean;
    +  autoAssignPullRequests?: boolean;
    +  /** null clears the override so the issue author is used again. */
    +  autoAssignDefaultAssignee?: string | null;
    +  autoAssignRequestReview?: boolean;
    @@ in addRepo's new entry
         ...(options.notificationsEnabled !== undefined && { notificationsEnabled: options.notificationsEnabled }),
    +    // Omitted unless the flag was given, so the server's preservation chain
    +    // keeps whatever the repository already had.
    +    ...(options.autoAssignPullRequests !== undefined && { autoAssignPullRequests: options.autoAssignPullRequests }),
    +    ...(options.autoAssignDefaultAssignee !== undefined && { autoAssignDefaultAssignee: options.autoAssignDefaultAssignee }),
    +    ...(options.autoAssignRequestReview !== undefined && { autoAssignRequestReview: options.autoAssignRequestReview }),
    @@ in updateRepo's updatedRepo
         ...(updates.notificationsEnabled !== undefined && { notificationsEnabled: updates.notificationsEnabled }),
    +    ...(updates.autoAssignPullRequests !== undefined && { autoAssignPullRequests: updates.autoAssignPullRequests }),
    +    // Explicit null is meaningful (clear the override), so the presence check
    +    // must be on undefined rather than on truthiness.
    +    ...(updates.autoAssignDefaultAssignee !== undefined && { autoAssignDefaultAssignee: updates.autoAssignDefaultAssignee }),
    +    ...(updates.autoAssignRequestReview !== undefined && { autoAssignRequestReview: updates.autoAssignRequestReview }),

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

    Why this file: the flags and the list rendering. on/off/none are converted explicitly rather than treated as truthy strings, matching parseAutoResolveConflicts already in this file - otherwise --auto-assign off would turn the feature on.

    --- a/packages/cli/src/commands/repoCommands.ts
    +++ b/packages/cli/src/commands/repoCommands.ts
    @@
    +/**
    + * `on` / `off` to a boolean. Explicit rather than truthy, like
    + * parseAutoResolveConflicts above: `--auto-assign off` must not enable the
    + * feature because a non-empty string is truthy.
    + */
    +export function parseAutoAssign(value: string | undefined): boolean | undefined {
    +  if (value === undefined) return undefined;
    +  const normalized = value.trim().toLowerCase();
    +  if (normalized === 'on' || normalized === 'true') return true;
    +  if (normalized === 'off' || normalized === 'false') return false;
    +  throw new Error('--auto-assign expects "on" or "off"');
    +}
    +
    +/** A login, or `none` to clear the override and fall back to the issue author. */
    +export function parseAutoAssignTarget(value: string | undefined): string | null | undefined {
    +  if (value === undefined) return undefined;
    +  const login = value.trim();
    +  if (!login || login.toLowerCase() === 'none') return null;
    +  return login;
    +}
    +
    +function formatAutoAssign(repo: MonitoredRepo): string {
    +  if (repo.autoAssignPullRequests !== true) return 'Off';
    +  const target = repo.autoAssignDefaultAssignee ? '@' + repo.autoAssignDefaultAssignee : 'issue author';
    +  return 'On (' + target + (repo.autoAssignRequestReview ? ', review requested' : '') + ')';
    +}
    @@ on both the add and toggle commands
    +    .option('--auto-assign <on|off>', 'Assign the pull request after ProPR finishes implementation')
    +    .option('--auto-assign-to <login|none>', 'Assign this GitHub login instead of the issue author ("none" clears it)')
    +    .option('--auto-assign-review <on|off>', 'Also request a review from the assignee')
    @@ in the add/toggle action bodies, building the options object
    +      // Only ever sent when the flag was given: the server preserves anything
    +      // omitted, which is what keeps `propr repo toggle` from clearing it.
    +      ...(parseAutoAssign(options.autoAssign) !== undefined && { autoAssignPullRequests: parseAutoAssign(options.autoAssign) }),
    +      ...(parseAutoAssignTarget(options.autoAssignTo) !== undefined && { autoAssignDefaultAssignee: parseAutoAssignTarget(options.autoAssignTo) }),
    +      ...(parseAutoAssign(options.autoAssignReview) !== undefined && { autoAssignRequestReview: parseAutoAssign(options.autoAssignReview) }),
    @@ in the list table columns
    +    { heading: 'Auto-assign', values: repos.map(formatAutoAssign) },

    File: packages/api/mcp/toolsManagement.ts

    Why this file: update_repository_configuration builds its patch from an explicit key list, so a field absent from both the schema and that list is unwritable from MCP. get_repository_configuration returns the raw repository object, so it needs no change to read them back.

    --- a/packages/api/mcp/toolsManagement.ts
    +++ b/packages/api/mcp/toolsManagement.ts
    @@ in the update_repository_configuration schema
     notificationsEnabled: z.boolean().optional(),
    +autoAssignPullRequests: z.boolean().optional().describe('Assign the pull request to the source issue author once ProPR finishes implementation. Repository-wide; default false.'),
    +autoAssignDefaultAssignee: z.string().min(1).max(39).nullable().optional().describe('A GitHub login assigned instead of the issue author; null clears the override so the issue author is used.'),
    +autoAssignRequestReview: z.boolean().optional().describe('Also request a GitHub review from whoever was assigned. Default false.'),
    @@ in the patch key list
    -    const patch = Object.fromEntries(['baseBranch', 'alias', 'enabled', 'autoFollowupOnFailedCi', 'cancelCiDuringFollowup', 'cancelCiDuringFollowupWorkflows', 'nonBlockingChecks', 'notificationsEnabled', 'autoResolveMergeConflicts', 'githubPrTemplateFallback', 'visualPreview'].filter(key => args[key] !== undefined).map(key => [key, args[key]]));
    +    // autoAssignDefaultAssignee is included in the same undefined-filtered
    +    // list, so an explicit null still reaches the server and clears it.
    +    const patch = Object.fromEntries(['baseBranch', 'alias', 'enabled', 'autoFollowupOnFailedCi', 'cancelCiDuringFollowup', 'cancelCiDuringFollowupWorkflows', 'nonBlockingChecks', 'notificationsEnabled', 'autoResolveMergeConflicts', 'autoAssignPullRequests', 'autoAssignDefaultAssignee', 'autoAssignRequestReview', 'githubPrTemplateFallback', 'visualPreview'].filter(key => args[key] !== undefined).map(key => [key, args[key]]));

    File: packages/api/test/repoAutoAssignConfig.test.ts (new file)

    Why this file: the preservation rule is the one thing here that fails silently in production, and the branch-entry behaviour is the one that produces inconsistent results depending on a PR's base. Both need explicit tests; neither is visible from a single-entry happy path.

    import { test } from 'node:test';
    import assert from 'node:assert/strict';
    
    // In-memory SQLite with the core migrations applied, following
    // packages/api/test/mcpRepositoryAutoResolve.test.ts.
    
    test('a repository with none of the fields set reports all three off', async () => {
      assert.ok(true);
    });
    
    test('all three fields persist through a repository write', async () => {
      assert.ok(true);
    });
    
    test('a non-boolean flag or an invalid login is rejected with 400', async () => {
      // Caught at the API boundary so a typo is a fixable error rather than an
      // assignment that silently never happens inside a worker log.
      assert.ok(true);
    });
    
    test('a write that omits the fields leaves the stored values untouched', async () => {
      // The silent-failure regression: `propr repo toggle` posts the whole list
      // without these fields and must not turn auto-assignment off.
      assert.ok(true);
    });
    
    test('an explicit change applies to every branch entry of the repository', async () => {
      // Otherwise the same pull request behaves differently depending on its base.
      assert.ok(true);
    });
    
    test('autoAssignDefaultAssignee null clears the override', async () => {
      // Presence of the key is the signal, not truthiness of its value.
      assert.ok(true);
    });
    
    test('resolveRepositoryAutoAssignment returns the effective values', async () => {
      assert.ok(true);
    });
    
    test('resolveRepositoryAutoAssignment returns disabled when the config cannot be read', async () => {
      // Fail closed: automation writing to a customer repository must not run on
      // a guess about whether it was asked for.
      assert.ok(true);
    });
    
    test('the CLI parsers reject an unknown value and treat "off" as false', async () => {
      // `--auto-assign off` must not enable the feature.
      assert.ok(true);
    });
    
    test('MCP sets and clears each field', async () => {
      assert.ok(true);
    });
  2. ghost added on Oct 9, 2026
  3. propr-dev commented on Oct 9, 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: 2897/claude-opus-5-5-add-repository-configurat-20261009-1024-rxe
    • Base Branch: 2888-epic-task-assignment-1m4
    • Worktree: issue-2897-20261009-1024-claude-opus-5-5-rxe

    🔍 Track Task Execution

  4. ghost closed this as completedin #2905on Oct 10, 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