PEP-272: тест зависшего раннера ждёт, пока экран устоится, вместо паузы 1,5 с
Под нагрузкой CI ответ мок-агента дорисовывался между тиками, вачдог видел активность. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ce03df667c
commit
1341d61a05
@ -129,7 +129,18 @@ describe("Зависший раннер перезапускается", () => {
|
|||||||
const p = await storyAtWork({ turns: [[{ say: "Думаю." }, { hang: true }]], resumeTurns: [[{ say: "Отвис." }]] });
|
const p = await storyAtWork({ turns: [[{ say: "Думаю." }, { hang: true }]], resumeTurns: [[{ say: "Отвис." }]] });
|
||||||
const sid = await p.start();
|
const sid = await p.start();
|
||||||
await p.waitLog("turn 0", (e) => e.ev === "prompt");
|
await p.waitLog("turn 0", (e) => e.ev === "prompt");
|
||||||
await new Promise((r) => setTimeout(r, 1500));
|
// The hung agent's screen must settle first: under a loaded CI a fixed pause was too short, the
|
||||||
|
// reply landed between ticks and the watchdog rightly saw "activity" (PEP-272 CI run 360).
|
||||||
|
const pane = (await sess(sid)).tmuxName;
|
||||||
|
await waitFor("hung reply on screen", async () => (await runner.tmux.capturePane(pane)).includes("Думаю."));
|
||||||
|
let prev = "";
|
||||||
|
await waitFor("screen settled", async () => {
|
||||||
|
const now = await runner.tmux.capturePane(pane);
|
||||||
|
const same = now === prev;
|
||||||
|
prev = now;
|
||||||
|
if (!same) await new Promise((r) => setTimeout(r, 700));
|
||||||
|
return same;
|
||||||
|
});
|
||||||
const t0 = Date.now();
|
const t0 = Date.now();
|
||||||
await tickAt(new Date(t0)); // remembers the screen
|
await tickAt(new Date(t0)); // remembers the screen
|
||||||
await tickAt(new Date(t0 + 10 * MIN), 5 * MIN); // stalled → alert
|
await tickAt(new Date(t0 + 10 * MIN), 5 * MIN); // stalled → alert
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user