Merge pull request #6074 from yzhg1983/private/pre-prompt-compaction-no-continue

fix(coding-agent): avoid pre-prompt compaction continue
This commit is contained in:
Mario Zechner
2026-06-28 17:49:12 +02:00
committed by GitHub
2 changed files with 79 additions and 10 deletions
@@ -1075,17 +1075,11 @@ export class AgentSession {
throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
}
// Check if we need to compact before sending (catches aborted responses)
// Check if we need to compact before sending (catches aborted responses).
// The user's new prompt is sent below, so do not call agent.continue() here.
const lastAssistant = this._findLastAssistantMessage();
if (lastAssistant && (await this._checkCompaction(lastAssistant, false))) {
try {
await this.agent.continue();
while (await this._handlePostAgentRun()) {
await this.agent.continue();
}
} finally {
this._flushPendingBashMessages();
}
if (lastAssistant) {
await this._checkCompaction(lastAssistant, false);
}
// Build messages array (custom message if any, then user message)