fix(sdk): prevent interactive tool calls in headless self-discuss mode

The discuss step loaded the full interactive workflow prompt which
instructs the agent to use AskUserQuestion, Skill(), and area selection
UIs. In headless auto mode, the agent followed these instructions and
tried to interact with a non-existent user.

Fix: prepend a mandatory headless override BEFORE the workflow prompt
that explicitly forbids interactive tools and instructs the agent to
make all decisions autonomously. Prepending (not appending) ensures
the override takes priority over conflicting instructions later in
the prompt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-04-25 13:57:43 -06:00
parent 25d9763878
commit f0953dec0c
2 changed files with 29 additions and 4 deletions

View File

@@ -1989,8 +1989,8 @@ Use TypeScript.`, 'utf-8');
);
expect(discussCalls.length).toBeGreaterThanOrEqual(1);
const prompt = discussCalls[0][0] as string;
expect(prompt).toContain('Self-Discuss Mode');
expect(prompt).toContain('No human is present');
expect(prompt).toContain('HEADLESS MODE');
expect(prompt).toContain('no human present');
});
it('skips self-discuss when context already exists even in auto-mode', async () => {