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:
@@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user