fix(pi-turn-limit): use turnCount for boundary check instead of event.turnIndex\n\nThe exceeded check used event.turnIndex which keeps incrementing from\nthe original session, causing false aborts after a boundary confirmation\nreset. Now turnCount is used consistently, and the dead exceeded check\nis removed since the boundary at turnCount === maxTurns handles all cases.

This commit is contained in:
2026-04-21 12:48:14 +01:00
parent a7f9822fa0
commit 191507785f
2 changed files with 123 additions and 10 deletions
+1 -10
View File
@@ -71,7 +71,7 @@ export default function (pi: ExtensionAPI) {
},
});
pi.on("turn_start", async (event, ctx) => {
pi.on("turn_start", async (_event, ctx) => {
turnCount++;
// Update live widget
@@ -105,14 +105,5 @@ export default function (pi: ExtensionAPI) {
return;
}
}
const { exceeded } = checkTurnLimit(event.turnIndex, maxTurns);
if (exceeded && ctx.hasUI) {
ctx.ui.notify(
`Turn limit exceeded: ${maxTurns} turns reached. Agent aborted.`,
"error",
);
ctx.abort();
}
});
}