-
Notifications
You must be signed in to change notification settings - Fork 0
Widen babysitter intake to routed pull requests #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -121,6 +121,22 @@ const slackSchema = z.object({ | |||||
|
|
||||||
| const babysitterSchema = z.object({ | ||||||
| enabled: z.boolean().default(false), | ||||||
| // Preserve the historical issue-created intake unless an operator | ||||||
| // deliberately opts into the wider routed-repository sweep. Keeping the | ||||||
| // rollout switch separate from `enabled` lets the identity fix in #221 land | ||||||
| // before automated writes are attributed across existing human PRs. | ||||||
| mode: z.enum(['factory-created', 'routed-open-prs']).default('factory-created'), | ||||||
|
khaliqgant marked this conversation as resolved.
|
||||||
| // This label is an author-controlled hard stop. Discovery reads it before | ||||||
| // spawning an agent, and routed babysitters are instructed to re-check it | ||||||
| // before their first provider write. | ||||||
| excludeLabels: z.array(z.string().trim().min(1)).default(['factory:skip-babysitter']), | ||||||
| excludePullRequests: z.array(z.string().regex( | ||||||
| /^[A-Za-z0-9](?:[A-Za-z0-9_.-]{0,99})\/[A-Za-z0-9_.-]{0,99}#[1-9]\d*$/u, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The Prompt for AI agents
Suggested change
|
||||||
| 'expected owner/repo#number', | ||||||
| )).default([]), | ||||||
| // Routed intake stays quiet until an operator explicitly approves the | ||||||
| // notification shape observed in a read-only sweep. | ||||||
| notifyHumans: z.boolean().default(false), | ||||||
| }).default({}) | ||||||
|
|
||||||
| const reportingSchema = z.object({ | ||||||
|
|
@@ -307,9 +323,40 @@ const NodeConfigObjectSchema = z.object({ | |||||
|
|
||||||
| const FactoryConfigObjectSchema = WorkspaceConfigObjectSchema.merge(NodeConfigObjectSchema) | ||||||
|
|
||||||
| export const WorkspaceConfigSchema = WorkspaceConfigObjectSchema.transform((cfg) => normalizeWorkspaceConfig(cfg)) | ||||||
| const requireRoutedBabysitterRepos = ( | ||||||
| cfg: z.infer<typeof WorkspaceConfigObjectSchema>, | ||||||
| ctx: z.RefinementCtx, | ||||||
| ): void => { | ||||||
| if (cfg.babysitter.mode === 'routed-open-prs' && (cfg.repos.names?.length ?? 0) === 0) { | ||||||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||||||
| ctx.addIssue({ | ||||||
| code: z.ZodIssueCode.custom, | ||||||
| path: ['repos', 'names'], | ||||||
| message: 'repos.names must contain at least one repository when babysitter.mode is routed-open-prs', | ||||||
| }) | ||||||
| return | ||||||
| } | ||||||
| if (cfg.babysitter.mode === 'routed-open-prs') { | ||||||
| const routedRepos = (cfg.repos.names ?? []).map((name) => | ||||||
| cfg.repos.byLabel[name] ?? cfg.repos.overrides[name] ?? | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The new Prompt for AI agents |
||||||
| (cfg.repos.org ? `${cfg.repos.org}/${name}` : name) | ||||||
| ) | ||||||
| if (!routedRepos.some((repo) => /^[^/]+\/[^/]+$/u.test(repo))) { | ||||||
| ctx.addIssue({ | ||||||
| code: z.ZodIssueCode.custom, | ||||||
| path: ['repos', 'names'], | ||||||
| message: 'repos.names must resolve at least one owner/repository route when babysitter.mode is routed-open-prs', | ||||||
| }) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| export const WorkspaceConfigSchema = WorkspaceConfigObjectSchema | ||||||
| .superRefine(requireRoutedBabysitterRepos) | ||||||
| .transform((cfg) => normalizeWorkspaceConfig(cfg)) | ||||||
| export const NodeConfigSchema = NodeConfigObjectSchema.transform((cfg) => normalizeNodeConfig(cfg)) | ||||||
| export const FactoryConfigSchema = FactoryConfigObjectSchema.transform((cfg) => normalizeFactoryConfig(cfg)) | ||||||
| export const FactoryConfigSchema = FactoryConfigObjectSchema | ||||||
| .superRefine(requireRoutedBabysitterRepos) | ||||||
| .transform((cfg) => normalizeFactoryConfig(cfg)) | ||||||
|
|
||||||
| function normalizeWorkspaceConfig(cfg: z.infer<typeof WorkspaceConfigObjectSchema>) { | ||||||
| const resolved = resolveRepos(cfg.repos, cfg.repos.cloneRoot) | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.