Phase 15: wire mid-turn steer delivery on session_compact defer path
When agent is not idle after auto compaction, deliver pending reinject immediately via steer instead of waiting for before_agent_start. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
applyPendingReinjectAfterCompact,
|
applyPendingReinjectAfterCompact,
|
||||||
clearPendingReinjectOnUserPrompt,
|
clearPendingReinjectOnUserPrompt,
|
||||||
|
deliverDeferredReinjectSteer,
|
||||||
planDeferredReinject,
|
planDeferredReinject,
|
||||||
planReinject,
|
planReinject,
|
||||||
sendImmediateReinjectAllFollowUp,
|
sendImmediateReinjectAllFollowUp,
|
||||||
@@ -101,6 +102,8 @@ export default function skillReinject(pi: ExtensionAPI): void {
|
|||||||
const skills = resolveRegisteredSkills(ctx.cwd, registeredSkills);
|
const skills = resolveRegisteredSkills(ctx.cwd, registeredSkills);
|
||||||
const branch = ctx.sessionManager.getBranch();
|
const branch = ctx.sessionManager.getBranch();
|
||||||
compactionRuntime.lastCompactionFirstKeptEntryId = event.compactionEntry.firstKeptEntryId;
|
compactionRuntime.lastCompactionFirstKeptEntryId = event.compactionEntry.firstKeptEntryId;
|
||||||
|
compactionRuntime.lastCompactionEntryId = event.compactionEntry.id;
|
||||||
|
compactionRuntime.deferredDeliveredForCompactionId = null;
|
||||||
const trackedNames = state.skills.map((skill) => skill.name);
|
const trackedNames = state.skills.map((skill) => skill.name);
|
||||||
const keptEntries = getKeptEntries(branch, event.compactionEntry.firstKeptEntryId);
|
const keptEntries = getKeptEntries(branch, event.compactionEntry.firstKeptEntryId);
|
||||||
const keptPresent = skillsPresentInKeptWindow(keptEntries, trackedNames);
|
const keptPresent = skillsPresentInKeptWindow(keptEntries, trackedNames);
|
||||||
@@ -126,6 +129,17 @@ export default function skillReinject(pi: ExtensionAPI): void {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (deliveryMode === "defer") {
|
if (deliveryMode === "defer") {
|
||||||
|
if (shouldReinject && planned.length > 0 && !ctx.isIdle()) {
|
||||||
|
deliverDeferredReinjectSteer(
|
||||||
|
pi,
|
||||||
|
state,
|
||||||
|
settings,
|
||||||
|
skills,
|
||||||
|
compactionRuntime,
|
||||||
|
event.compactionEntry.id,
|
||||||
|
ctx,
|
||||||
|
);
|
||||||
|
}
|
||||||
persistState();
|
persistState();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user