Skip to content

Per-repo configuration of Auto merge / QA Agent / Code Reviewer - #6319

Open
deco-cms[bot] wants to merge 5 commits into
mainfrom
sandbox/thread-thrd_G9IPSXP2RABxTaMPJomy8
Open

Per-repo configuration of Auto merge / QA Agent / Code Reviewer#6319
deco-cms[bot] wants to merge 5 commits into
mainfrom
sandbox/thread-thrd_G9IPSXP2RABxTaMPJomy8

Conversation

@deco-cms

@deco-cms deco-cms Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What

The three review toggles in Settings — QA Agent, Code Reviewer, Auto merge — were workspace-wide. A workspace with several repos had to pick one review setup for all of them: wanting reviewers but not auto-merge on decocms/studio forced that on every other repo too.

Settings now has a Per-repository overrides section under "Reviewers & merge": one row per connected repo (any active repo-scoped mcp-github connection), with the three switches. Each row starts on the workspace default and stores only what it deviates on; Reset drops the row back to inheriting.

How

  • organization_settings.repo_flags (new nullable jsonb, migration 172-org-repo-flags) — a bag of overrides keyed by lowercased owner/name, e.g. {"decocms/studio": {"auto_merge": false}}. Empty/absent for every existing org, which is what makes this additive: a repo with no entry reads the org flag exactly as before.
  • flagsForRepo(settings, repo) in packages/shared/src/organization/schema.ts is the single reader — it returns the org flags with that repo's overrides layered on. Every review gate now goes through it, passing the task's repo: enqueue-reviewer, merge-pr (verified-approval + auto-merge retry), review-decision, conflict-reaction, rerun, promote-to-production. An org-wide task (repo: null) resolves to the org flags untouched.
  • Only booleans override; a stored null means "inherit", which is how a write drops an override (an omitted key keeps its stored value under the merge).
  • repo_flags writes merge two levels deep in SQL, so setting one repo's one toggle never disturbs another repo or that repo's other toggles. The org-level flags || $new concat can't do this — at the top level it would replace the repo's whole entry.
  • cheap_reviewer_model and auto_assign_report_tasks_to_super_agent stay org-only; they aren't per-repo decisions.

Testing

  • packages/shared/src/organization/schema.test.ts — new flagsForRepo unit tests (layering, no-entry/org-wide fallback, case-insensitive key, null-inherits, non-overridable keys ignored). Passing.
  • apps/api/src/storage/organization-settings.integration.test.ts — new cases for the two-level merge, null persistence, and org flags vs repo overrides not clobbering each other. These need Postgres (not available in the sandbox), so they run in CI.
  • bun test on enqueue-reviewer + migrations index, tsc --noEmit on api/web/shared, biome check, and knip are all clean.

🤖 Generated with Claude Code


Summary by cubic

Enable per-repo overrides for QA Agent, Code Reviewer, and auto-merge so multi-repo workspaces no longer share one review setup. Previously these toggles were workspace-wide; now each connected repo can inherit or override. Repos without overrides behave exactly as before.

  • Migration: add organization_settings.repo_flags (jsonb) keyed by lowercased owner/name. Run 172-org-repo-flags. Existing orgs default to no overrides.
  • Reads: use flagsForRepo(settings, repo) from @decocms/shared/organization/schema everywhere — enqueue reviewer, verified-approval checks, auto-merge retry, conflict handback, rerun, promote-to-production; Task dialog LinksSection now uses the same resolver so the ship button matches server gates.
  • Writes: merge two levels deep in SQL so changing one repo’s one toggle doesn’t affect other repos or other toggles; cast the repo key to text in -> lookups; validate repo_flags keys as owner/name and store lowercased. Only booleans override; set a flag to null to drop the override and inherit.
  • UI: new “Per-repository overrides” section lists repo-scoped mcp-github connections with three switches each, shows effective values with an override marker, supports Reset, and suspends the repo list so the rest of Settings renders. Rows stack on small screens.
  • Out of scope: cheap_reviewer_model and auto_assign_report_tasks_to_super_agent remain workspace-only. Tests cover repo read layering, case-insensitive keys, null-inherits, and two-level merge semantics.

Written for commit 5d32ca3. Summary will update on new commits.

Review in cubic

The QA Agent / Code Reviewer / auto-merge toggles were workspace-wide, so a
workspace with several repos had to run one review setup on all of them — a repo
that wants reviewers but not auto-merge forced that choice on the rest.

Adds an `organization_settings.repo_flags` jsonb bag keyed by lowercased
`owner/name`, holding only the deviations, plus `flagsForRepo` as the single
reader every review gate now goes through (enqueue, auto-merge, conflict
handback, re-run, manual ship). A repo with no entry reads the org flag exactly
as before, so the change is additive.

Settings grows a "Per-repository overrides" section listing the connected repos
with the three switches each, showing the effective value and a Reset that drops
the row back to the workspace defaults.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the claude PR authored by a coding agent label Aug 20, 2026
decobot and others added 4 commits August 20, 2026 12:46
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
LinksSection read the org flags while the server gate (PROMOTE_TO_PRODUCTION)
reads flagsForRepo, so a repo overriding a reviewer made the two disagree.

Also validate repo_flags keys as `owner/name` in ORGANIZATION_SETTINGS_UPDATE.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude PR authored by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant