fix(tool-subagent): enforce depth only at runtime

This commit is contained in:
Tianyi Cui
2026-07-20 17:58:57 +08:00
parent c40e63d04b
commit 46d60d6d90
26 changed files with 192 additions and 302 deletions
+12 -9
View File
@@ -30,6 +30,7 @@ const BOTH_MODE_CONFIG = fileURLToPath(new URL('../both-mode.cordis.yml', import
const WORKSPACE_CONTEXT_CONFIG = fileURLToPath(new URL('../workspace-context.cordis.yml', import.meta.url))
const ADVANCED_CONFIG = fileURLToPath(new URL('../advanced.cordis.yml', import.meta.url))
const FS_CONFIG = fileURLToPath(new URL('../fs.cordis.yml', import.meta.url))
const DEPTH_TWO_CONFIG = fileURLToPath(new URL('../depth-two.cordis.yml', import.meta.url))
function snapshotModeFromEnv(value: string | undefined): SnapshotSuiteOptions['mode'] {
switch (value) {
@@ -105,12 +106,17 @@ const SCENARIOS: Scenario[] = [
},
{ name: 'cancel', hasModelTurn: true, recorded: false, overridden: true },
{ name: 'cancel-tool-calls', hasModelTurn: true, recorded: false, overridden: true },
// Children sit at this example's configured depth cap (`maxDepth: 1`), so each child's header
// legitimately omits the delegation tool that spawned it (schema hiding).
{ name: 'subagent-spawn', hasModelTurn: true, recorded: true, childToolOmissions: ['subagent'] },
{ name: 'subagent-multi', hasModelTurn: true, recorded: true, childToolOmissions: ['subagent'] },
{ name: 'subagent-fork', hasModelTurn: true, recorded: true, childToolOmissions: ['subagent_fork'] },
{ name: 'subagent-mixed', hasModelTurn: true, recorded: true, childToolOmissions: ['subagent', 'subagent_fork'] },
{ name: 'subagent-spawn', hasModelTurn: true, recorded: true },
{ name: 'subagent-multi', hasModelTurn: true, recorded: true },
{ name: 'subagent-fork', hasModelTurn: true, recorded: true },
{ name: 'subagent-mixed', hasModelTurn: true, recorded: true },
{
name: 'subagent-depth-two-rejection',
hasModelTurn: true,
recorded: false,
overridden: true,
configPath: DEPTH_TWO_CONFIG,
},
// The workflow tool: the model writes a one-child orchestration script; the
// child runs as a spawn subagent under the worker-thread engine (its session is the
// child fixture), and the tool result carries the script's return value.
@@ -125,9 +131,6 @@ const SCENARIOS: Scenario[] = [
pinsHeader: true,
headerClass: 'advanced',
configPath: ADVANCED_CONFIG,
// The direct spawn child sits at the configured cap and loses `subagent`;
// workflow children bypass tool-subagent and keep the full set.
childToolOmissions: ['subagent'],
},
{
name: 'cordis-inspect-jsdoc',