Heuristic:AIPexStudio AIPex Intervention Timeout Defaults
| Knowledge Sources | |
|---|---|
| Domains | Intervention, Timeout_Management |
| Last Updated | 2026-10-24 12:00 GMT |
Overview
Intervention requests default to a 300-second (5-minute) timeout and are automatically cancelled on tab switch or page navigation to prevent stale intervention prompts.
Description
The Intervention Manager enforces a default timeout of 300 seconds (5 minutes) on each intervention request. If the user does not respond within this window, the intervention times out and is resolved with `status: "timeout"`. Additionally, interventions are proactively cancelled when the user switches to another browser tab (`tab_switched`) or when the page navigates to a different URL (`page_navigated`). Disabling intervention mode also cancels any ongoing intervention. This ensures that intervention prompts do not linger indefinitely when the user's context has changed.
Usage
Use this heuristic when configuring intervention timeouts for production use. The default 300s timeout balances giving users enough time to respond with preventing indefinite hanging. For faster-paced automation, consider lowering to 60-120s. For voice interventions where the user may need time to speak, the default is appropriate. Always handle the `cancelled` status in your intervention result handler.
The Insight (Rule of Thumb)
- Action: Pass a `timeout` value (in seconds) to `requestIntervention()`, or rely on the default of 300.
- Value: Default: `300` seconds. Cancel triggers: `tab_switched`, `page_navigated`, `mode_disabled`, `user`.
- Trade-off: Higher timeouts give users more time to respond but risk stale prompts if the user has moved on. Lower timeouts may interrupt users who need more time.
- Compatibility: The timeout is per-intervention, not per-queue. Queued interventions start their timeout when they begin executing, not when they are queued.
Reasoning
In browser automation, human-in-the-loop interventions (e.g., selecting an element, confirming an action, providing voice input) require the user's attention on the current tab. If the user switches tabs or navigates away, the intervention context is stale — the element they were asked to click may no longer exist. By proactively cancelling on tab switch and page navigation, the system avoids presenting stale UI and frees the agent to handle the situation differently (e.g., re-snapshot, ask again). The 300s default is long enough for a user who stepped away briefly but short enough to avoid indefinite resource holding.
Code Evidence
Default timeout parameter from `packages/browser-runtime/src/intervention/intervention-manager.ts:117-121`:
async requestIntervention(
type: InterventionType,
params?: unknown,
timeout = 300,
reason?: string,
): Promise<InterventionResult> {
Timeout enforcement from `packages/browser-runtime/src/intervention/intervention-manager.ts:210-215`:
// Set timeout
const timeoutMs = (request.timeout || 300) * 1000;
const timeoutHandle = setTimeout(() => {
console.warn(`[InterventionManager] Intervention timeout: ${request.id}`);
this.handleTimeout(request.id);
}, timeoutMs);
Cancel reasons with human-readable messages from `packages/browser-runtime/src/intervention/intervention-manager.ts:30-52`:
export type CancelReason =
| "user"
| "tab_switched"
| "page_navigated"
| "mode_disabled";
function getCancelMessage(reason: CancelReason): string {
switch (reason) {
case "user":
return "Cancelled by user";
case "tab_switched":
return "Cancelled: browser tab switched";
case "page_navigated":
return "Cancelled: page navigated to a different URL";
case "mode_disabled":
return "Cancelled: intervention mode was disabled";
}
}
Mode-disabled auto-cancel from `packages/browser-runtime/src/intervention/intervention-manager.ts:96-104`:
setConversationMode(mode: InterventionMode): void {
this.currentConversationMode = mode;
if (mode === "disabled" && this.currentIntervention) {
this.cancelIntervention(
this.currentIntervention.request.id,
"mode_disabled",
);
}
}