teapot-coding-agent 0.37.145 → 0.37.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/agent/agent.js
CHANGED
|
@@ -1370,32 +1370,25 @@ export class Agent {
|
|
|
1370
1370
|
this.bgExits.shift();
|
|
1371
1371
|
bus.emit("update", { kind: "agent-update", agentId: this.opts.id });
|
|
1372
1372
|
/**
|
|
1373
|
-
*
|
|
1373
|
+
* Wake the agent, but NEVER for a round with nothing to report.
|
|
1374
1374
|
*
|
|
1375
|
-
*
|
|
1376
|
-
*
|
|
1377
|
-
*
|
|
1375
|
+
* Two failures met here. The original callback re-checked only `status === "idle"`, so an exit that arrived while a
|
|
1376
|
+
* round was running scheduled a round that the running round had already drained — that produced eleven rounds in
|
|
1377
|
+
* mediapad-t5 with the reason "background job bgNN finished" and no report in any of them, which read as a loop at
|
|
1378
|
+
* shutdown ("こいつなんで終了時にループしてんの?").
|
|
1378
1379
|
*
|
|
1379
|
-
*
|
|
1380
|
-
*
|
|
1380
|
+
* Suppressing the wake for a finished goal fixed the loop but silenced the completion entirely — "goal doneで通知
|
|
1381
|
+
* しないのは違うのでは? / エージェントにも通知されてない". So the condition is the CONTENT, not the goal state: a round
|
|
1382
|
+
* starts only if `bgExits` still holds something undrained, which is exactly "there is news to deliver".
|
|
1381
1383
|
*/
|
|
1382
|
-
|
|
1383
|
-
/**
|
|
1384
|
-
* …and a RUNNING round is not given an extra one.
|
|
1385
|
-
*
|
|
1386
|
-
* The exit is already in `bgExits` and the running round drains it at its next turn (`drainBackgroundExits`), so
|
|
1387
|
-
* scheduling a round from here produced one extra round per exit whose only content was "完了済みです。追加の作業は
|
|
1388
|
-
* ありません。" — the reason on those `state` events named the job, but no report was in them, because the report had
|
|
1389
|
-
* gone to the round that was already running. MEASURED in mediapad-t5-root-attempt-2: eleven such rounds in a row,
|
|
1390
|
-
* all labelled "background job bgNN finished", none with a prompt row.
|
|
1391
|
-
*
|
|
1392
|
-
* So only an IDLE agent is woken, and the `enqueue` re-check stays because a round can start in between.
|
|
1393
|
-
*/
|
|
1394
|
-
if (!this.stopRequested && !workIsDone && this.status === "idle") {
|
|
1384
|
+
if (!this.stopRequested && (this.status === "idle" || this.status === "waiting" || this.status === "running")) {
|
|
1395
1385
|
void this.enqueue(async () => {
|
|
1396
1386
|
if (this.stopRequested)
|
|
1397
1387
|
return;
|
|
1398
|
-
|
|
1388
|
+
// the round that was running may have drained it; then there is nothing to say
|
|
1389
|
+
if (!this.bgExits.length)
|
|
1390
|
+
return;
|
|
1391
|
+
if (this.status === "idle" || this.status === "waiting")
|
|
1399
1392
|
this.start(`background job ${info.id} finished`);
|
|
1400
1393
|
});
|
|
1401
1394
|
}
|