Post-unit hooks that use browser tools can hang indefinitely when the LLM calls browser_wait_for with condition 'network_idle' against a dev server with persistent connections (Vite HMR, WebSocket). The networkidle event never fires because at least one connection stays open. Fix: Inject a browser safety instruction into every hook prompt warning against network_idle and recommending selector_visible, text_visible, or delay as alternatives. Fixes #1345
This commit is contained in:
parent
b720e7e15c
commit
f069790d7d
1 changed files with 5 additions and 1 deletions
|
|
@ -149,11 +149,15 @@ function dequeueNextHook(basePath: string): HookDispatchResult | null {
|
|||
|
||||
// Build the prompt with variable substitution
|
||||
const [mid, sid, tid] = triggerUnitId.split("/");
|
||||
const prompt = config.prompt
|
||||
let prompt = config.prompt
|
||||
.replace(/\{milestoneId\}/g, mid ?? "")
|
||||
.replace(/\{sliceId\}/g, sid ?? "")
|
||||
.replace(/\{taskId\}/g, tid ?? "");
|
||||
|
||||
// Inject browser safety instruction for hooks that may use browser tools (#1345).
|
||||
// Vite HMR and other persistent connections prevent networkidle from resolving.
|
||||
prompt += "\n\n**Browser tool safety:** Do NOT use `browser_wait_for` with `condition: \"network_idle\"` — it hangs indefinitely when dev servers keep persistent connections (Vite HMR, WebSocket). Use `selector_visible`, `text_visible`, or `delay` instead.";
|
||||
|
||||
return {
|
||||
hookName: config.name,
|
||||
prompt,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue