fix(coding-agent): chain system prompt in before_agent_start closes #3539

This commit is contained in:
Mario Zechner
2026-04-22 14:58:17 +02:00
parent 0e5b6e54f0
commit 4e919868f6
4 changed files with 66 additions and 4 deletions

View File

@@ -877,9 +877,16 @@ export class ExtensionRunner {
systemPrompt: string,
systemPromptOptions: BuildSystemPromptOptions,
): Promise<BeforeAgentStartCombinedResult | undefined> {
const ctx = this.createContext();
const messages: NonNullable<BeforeAgentStartEventResult["message"]>[] = [];
let currentSystemPrompt = systemPrompt;
const ctx = Object.defineProperties(
{},
Object.getOwnPropertyDescriptors(this.createContext()),
) as ExtensionContext;
ctx.getSystemPrompt = () => {
this.assertActive();
return currentSystemPrompt;
};
const messages: NonNullable<BeforeAgentStartEventResult["message"]>[] = [];
let systemPromptModified = false;
for (const ext of this.extensions) {