Skip to content

Commit 1108655

Browse files
committed
fix: preserve focused agent glob isolation
1 parent b2cfe89 commit 1108655

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

‎scripts/test-projects.test-support.mjs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4251,11 +4251,7 @@ function classifyTarget(arg, cwd) {
42514251
}
42524252
if (isPathAtOrUnder(relative, "src/agents")) {
42534253
// Focused runs must preserve the full suite's isolated harness and hook-timeout contracts.
4254-
if (
4255-
relative === "src/agents" ||
4256-
relative === AGENTS_EMBEDDED_AGENT_TEST_ROOT ||
4257-
isGlobTarget(relative)
4258-
) {
4254+
if (relative === "src/agents" || relative === AGENTS_EMBEDDED_AGENT_TEST_ROOT) {
42594255
return "agent";
42604256
}
42614257
if (agentsEmbeddedIncompleteTurnTestFiles.includes(relative)) {
@@ -4268,11 +4264,15 @@ function classifyTarget(arg, cwd) {
42684264
return "agentEmbeddedRun";
42694265
}
42704266
if (isPathAtOrUnder(relative, AGENTS_EMBEDDED_AGENT_TEST_ROOT)) {
4271-
return "agentEmbedded";
4267+
return isGlobTarget(relative) ? "agent" : "agentEmbedded";
42724268
}
42734269
if (isPathAtOrUnder(relative, "src/agents/tools")) {
42744270
return "agentTools";
42754271
}
4272+
if (isGlobTarget(relative)) {
4273+
const owner = relative.slice("src/agents/".length).split("/", 1)[0];
4274+
return isGlobTarget(owner) ? "agent" : "agentSupport";
4275+
}
42764276
return isFileLikeTarget(relative) && path.posix.dirname(relative) === "src/agents"
42774277
? "agentCore"
42784278
: "agentSupport";

‎test/scripts/test-projects.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,6 +2735,29 @@ describe("scripts/test-projects changed-target routing", () => {
27352735
]);
27362736
});
27372737

2738+
it.each([
2739+
[
2740+
"src/agents/embedded-agent-runner/run/*.test.ts",
2741+
"test/vitest/vitest.agents-embedded-agent-run.config.ts",
2742+
],
2743+
["src/agents/runtime-plan/**/*.test.ts", "test/vitest/vitest.agents-support.config.ts"],
2744+
["src/agents/tools/**/*.test.ts", "test/vitest/vitest.agents-tools.config.ts"],
2745+
])("routes focused agent glob %s to its owning shard", (target, config) => {
2746+
const plans = buildVitestRunPlans([target]);
2747+
2748+
expect(plans).toEqual(
2749+
expect.arrayContaining([
2750+
{
2751+
config,
2752+
forwardedArgs: [],
2753+
includePatterns: [target],
2754+
watchMode: false,
2755+
},
2756+
]),
2757+
);
2758+
expect(plans.map((plan) => plan.config)).not.toContain("test/vitest/vitest.agents.config.ts");
2759+
});
2760+
27382761
it("keeps mixed embedded-agent and cron-tool targets in their owning shards", () => {
27392762
const embeddedTest = "src/agents/embedded-agent-runner/run.before-agent-reply-cron.test.ts";
27402763
const cronToolTest = "src/agents/tools/cron-tool.pacing.test.ts";

0 commit comments

Comments
 (0)