fix: stop command uses activeSessionId instead of renderer-only getActiveCascadeId #task-411
This commit is contained in:
@@ -25,6 +25,8 @@ export interface CommandHandlerContext {
|
||||
onAutoApproveChanged: (enabled: boolean) => void;
|
||||
/** Track recently sent Discord→AG texts to avoid echo relay */
|
||||
recentDiscordSentTexts: Map<string, number>;
|
||||
/** Get the active cascade/session ID from step-probe polling state */
|
||||
getActiveSessionId: () => string;
|
||||
}
|
||||
|
||||
// ─── File-based command watcher ───
|
||||
@@ -127,10 +129,12 @@ export function handleWSCommand(ctx: CommandHandlerContext, data: { text?: strin
|
||||
* This is the same mechanism AG's native red ■ stop button uses.
|
||||
*/
|
||||
async function _cancelCurrentCascade(ctx: CommandHandlerContext) {
|
||||
// 1. Get the active cascade ID from SDK titles manager
|
||||
const cascadeId = ctx.sdk?.titles?.getActiveCascadeId?.();
|
||||
// 1. Get the active cascade ID from extension state (step-probe polling)
|
||||
// NOTE: ctx.sdk.titles.getActiveCascadeId() is renderer-only (DOM scraping)
|
||||
// and always returns undefined from extension host. Use activeSessionId instead.
|
||||
const cascadeId = ctx.getActiveSessionId();
|
||||
if (!cascadeId) {
|
||||
ctx.logToFile('[STOP] No active cascade to cancel (getActiveCascadeId returned null)');
|
||||
ctx.logToFile('[STOP] No active cascade — no session tracked yet');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user