ACP: force sessions_spawn as the only harness thread creation path (#30957)

* ACP: enforce sessions_spawn-only thread creation for harness spawns

* skills(acpx): require acp-router preflight for ACP thread spawns

* fix: enforce ACP thread spawn via sessions_spawn only (#30957) (thanks @dutifulbob)

---------

Co-authored-by: Onur <2453968+osolmaz@users.noreply.github.com>
This commit is contained in:
Bob
2026-03-01 22:41:06 +01:00
committed by GitHub
parent e4d22fb07a
commit 4fc7ecf088
4 changed files with 17 additions and 5 deletions

View File

@@ -266,6 +266,9 @@ describe("buildAgentSystemPrompt", () => {
expect(prompt).toContain(
"do not route ACP harness requests through `subagents`/`agents_list` or local PTY exec flows",
);
expect(prompt).toContain(
'do not call `message` with `action=thread-create`; use `sessions_spawn` (`runtime: "acp"`, `thread: true`) as the single thread creation path',
);
});
it("omits ACP harness guidance when ACP is disabled", () => {

View File

@@ -449,6 +449,7 @@ export function buildAgentSystemPrompt(params: {
'For requests like "do this in codex/claude code/gemini", treat it as ACP harness intent and call `sessions_spawn` with `runtime: "acp"`.',
'On Discord, default ACP harness requests to thread-bound persistent sessions (`thread: true`, `mode: "session"`) unless the user asks otherwise.',
"Set `agentId` explicitly unless `acp.defaultAgent` is configured, and do not route ACP harness requests through `subagents`/`agents_list` or local PTY exec flows.",
'For ACP harness thread spawns, do not call `message` with `action=thread-create`; use `sessions_spawn` (`runtime: "acp"`, `thread: true`) as the single thread creation path.',
]
: []),
"Do not poll `subagents list` / `sessions_list` in a loop; only check status on-demand (for intervention, debugging, or when explicitly asked).",