Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(core): rebuild system prompt after provider switch

Jiayuan Zhangafe51d325d3a
diff --git a/packages/core/src/agent/runner.ts b/packages/core/src/agent/runner.ts
index ddfd3ac11c..beaa4faff7 100644
--- a/packages/core/src/agent/runner.ts
+++ b/packages/core/src/agent/runner.ts
@@ -905,6 +905,14 @@ export class Agent {
contextWindowTokens: this.contextWindowGuard.tokens,
});
+ // Rebuild system prompt so runtime info reflects the new provider/model
+ const toolNames = (this.agent.state.tools ?? []).map((t: { name: string }) => t.name);
+ const systemPrompt = this.rebuildSystemPrompt(toolNames);
+ if (systemPrompt) {
+ this.agent.setSystemPrompt(systemPrompt);
+ this.session.setSystemPrompt(systemPrompt);
+ }
+
return {
provider: providerId,
model: model.id,