fix(core): limit v2 subagent nesting depth (#37291)

This commit is contained in:
opencode-agent[bot] 2026-07-16 09:28:15 -04:00 committed by GitHub
commit d01dfa57b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 116 additions and 0 deletions

View file

@ -175,6 +175,9 @@ export const Info = Schema.Struct({
primary_tools: Schema.optional(Schema.mutable(Schema.Array(Schema.String))).annotate({
description: "Tools that should only be available to primary agents.",
}),
subagent_depth: Schema.optional(NonNegativeInt).annotate({
description: "Maximum subagent nesting depth. Defaults to 1.",
}),
continue_loop_on_deny: Schema.optional(Schema.Boolean).annotate({
description: "Continue the agent loop when a tool call is denied",
}),

View file

@ -77,6 +77,10 @@ export function migrate(info: typeof ConfigV1.Info.Type) {
commands: commands(info.command),
instructions: info.instructions,
references: info.references ?? info.reference,
experimental:
info.experimental?.subagent_depth === undefined
? undefined
: { subagent_depth: info.experimental.subagent_depth },
plugins: info.plugin?.map((plugin) =>
typeof plugin === "string" ? plugin : { package: plugin[0], options: plugin[1] },
),