Per-repo configuration of Auto merge / QA Agent / Code Reviewer - #6319
Open
deco-cms[bot] wants to merge 5 commits into
Open
Per-repo configuration of Auto merge / QA Agent / Code Reviewer#6319deco-cms[bot] wants to merge 5 commits into
deco-cms[bot] wants to merge 5 commits into
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/studioforced 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-githubconnection), 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, migration172-org-repo-flags) — a bag of overrides keyed by lowercasedowner/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)inpackages/shared/src/organization/schema.tsis 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'srepo: 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.nullmeans "inherit", which is how a write drops an override (an omitted key keeps its stored value under the merge).repo_flagswrites 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-levelflags || $newconcat can't do this — at the top level it would replace the repo's whole entry.cheap_reviewer_modelandauto_assign_report_tasks_to_super_agentstay org-only; they aren't per-repo decisions.Testing
packages/shared/src/organization/schema.test.ts— newflagsForRepounit 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 teston enqueue-reviewer + migrations index,tsc --noEmiton api/web/shared,biome check, andknipare 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.
organization_settings.repo_flags(jsonb) keyed by lowercasedowner/name. Run172-org-repo-flags. Existing orgs default to no overrides.flagsForRepo(settings, repo)from@decocms/shared/organization/schemaeverywhere — 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.textin->lookups; validaterepo_flagskeys asowner/nameand store lowercased. Only booleans override; set a flag tonullto drop the override and inherit.mcp-githubconnections 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.cheap_reviewer_modelandauto_assign_report_tasks_to_super_agentremain 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.