Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/__tests__/CodexACPAgent/e2e/acp-e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from "node:path";
import {afterEach, expect, it} from "vitest";
import {AgentMode} from "../../../AgentMode";
import {
Expand Down Expand Up @@ -90,7 +91,7 @@ describeE2E("E2E tests", () => {
});
});

it("lists a user skill from the wrapped CODEX_HOME", async () => {
it("lists a user skill from the CODEX_HOME", async () => {
fixture = await createAuthenticatedFixture();
fixture.writeSkill({
name: "integration-skill",
Expand All @@ -103,4 +104,28 @@ describeE2E("E2E tests", () => {
expect(text).toContain("- integration-skill: Integration skill");
});
});

// Currently, `additionalRoots` are not propagated when listing skills
it.skip("lists skills from additional session roots", async () => {
fixture = await createAuthenticatedFixture();
const additionalSkillsRoot = path.join(fixture.workspaceDir, "custom-skills");
fixture.writeSkill({
name: "session-root-skill",
description: "Session root skill",
body: "This skill exists only in an additional root passed at session creation.",
}, additionalSkillsRoot);

const session = await fixture.connection.newSession({
cwd: fixture.workspaceDir,
mcpServers: [],
_meta: {
additionalRoots: [additionalSkillsRoot],
},
});

await fixture.expectPromptText(session.sessionId, "/skills", (text) => {
expect(text).toContain("Available skills:");
expect(text).toContain("- session-root-skill: Session root skill");
});
});
});
7 changes: 4 additions & 3 deletions src/__tests__/CodexACPAgent/e2e/spawned-agent-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface SpawnedAgentFixture {
readonly workspaceDir: string;
createSession(mcpServers?: acp.McpServer[]): Promise<acp.NewSessionResponse>;
restart(): Promise<SpawnedAgentFixture>;
writeSkill(skill: TestSkill): void;
writeSkill(skill: TestSkill, rootDir?: string): void;
setPermissionResponder(responder: PermissionResponder): void;
expectPromptText(
sessionId: string,
Expand Down Expand Up @@ -170,8 +170,9 @@ class SpawnedAgentFixtureImpl implements SpawnedAgentFixture {
return await createSpawnedAgentFixture(this.initializeConnection, this.extraEnv, this.paths);
}

writeSkill(skill: TestSkill): void {
const skillDirectory = path.join(this.paths.codexHome, "skills", skill.name);
writeSkill(skill: TestSkill, rootDir?: string): void {
const skillsRoot = rootDir ?? path.join(this.paths.codexHome, "skills");
const skillDirectory = path.join(skillsRoot, skill.name);
fs.mkdirSync(skillDirectory, {recursive: true});
fs.writeFileSync(
path.join(skillDirectory, "SKILL.md"),
Expand Down