Skip to content

Commit bbfb54d

Browse files
authored
Pass skill slash commands through to Codex (#161)
Skill commands are advertised with a `$` prefix, such as `/$imagegen`, but ACP-local slash command handling was intercepting them and reporting them as unknown commands. Treat `$` commands as normal prompt input so Codex can resolve the referenced skill. Add a regression test that verifies a skill slash command is forwarded to `turn/start` without emitting an ACP unknown-command response.
1 parent e698674 commit bbfb54d

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/CodexCommands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ export class CodexCommands {
106106
}
107107

108108
async tryHandleCommand(prompt: acp.ContentBlock[], sessionState: SessionState): Promise<boolean> {
109-
const commandName = this.getCommandName(prompt)
109+
const commandName = this.getCommandName(prompt);
110110
if (commandName === null) return false;
111+
if (commandName.startsWith("$")) return false;
111112

112113
const sessionId = sessionState.sessionId;
113114
switch (commandName) {

src/__tests__/CodexACPAgent/CodexAcpClient.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,24 @@ describe('ACP server test', { timeout: 40_000 }, () => {
801801
await expect(mockFixture.getAcpConnectionDump([])).toMatchFileSnapshot("data/command-status.json");
802802
});
803803

804+
it('passes skill slash commands through to Codex', async () => {
805+
const { mockFixture, turnStartSpy } = setupPromptFixture();
806+
807+
await mockFixture.getCodexAcpAgent().prompt({
808+
sessionId: "session-id",
809+
prompt: [{ type: "text", text: "/$imagegen create a hero image" }],
810+
});
811+
812+
expect(turnStartSpy).toHaveBeenCalledWith(expect.objectContaining({
813+
input: [{
814+
type: "text",
815+
text: "/$imagegen create a hero image",
816+
text_elements: []
817+
}]
818+
}));
819+
expect(mockFixture.getAcpConnectionDump([])).toBe("");
820+
});
821+
804822
it('handles logout command', async () => {
805823
const codexAcpAgent = fixture.getCodexAcpAgent();
806824
await codexAcpAgent.initialize({protocolVersion: 1});

0 commit comments

Comments
 (0)