teapot-coding-agent 0.37.146 → 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.
@@ -1370,36 +1370,24 @@ export class Agent {
1370
1370
  this.bgExits.shift();
1371
1371
  bus.emit("update", { kind: "agent-update", agentId: this.opts.id });
1372
1372
  /**
1373
- * A finished GOAL is not woken by a background exit.
1373
+ * Wake the agent, but NEVER for a round with nothing to report.
1374
1374
  *
1375
- * Each exit used to start a round, so a session that had launched a sweep of eleven jobs (bg32…bg42) ran eleven
1376
- * rounds AFTER its finish was accepted — every one of them one turn of "完了済みです。追加の作業はありません。" and
1377
- * then a stop, which reads as a loop ("こいつなんで終了時にループしてんの?").
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
- * Nothing is lost: the exit stays in `bgExits` and `drainBackgroundExits()` puts it in front of the model at the
1380
- * start of the next round, so a manual ▶ start (or the operator's own message) still sees every result.
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
- const workIsDone = this.goal.status === "done";
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
- /**
1395
- * `waiting` is the PARKED state — a tool is blocked on this very job (`parkForTool`), so that agent must be woken.
1396
- * Only `running` is excluded, because a round in flight drains the exit itself at its next turn.
1397
- */
1398
- const canWake = this.status === "idle" || this.status === "waiting";
1399
- if (!this.stopRequested && !workIsDone && canWake) {
1384
+ if (!this.stopRequested && (this.status === "idle" || this.status === "waiting" || this.status === "running")) {
1400
1385
  void this.enqueue(async () => {
1401
1386
  if (this.stopRequested)
1402
1387
  return;
1388
+ // the round that was running may have drained it; then there is nothing to say
1389
+ if (!this.bgExits.length)
1390
+ return;
1403
1391
  if (this.status === "idle" || this.status === "waiting")
1404
1392
  this.start(`background job ${info.id} finished`);
1405
1393
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.146",
3
+ "version": "0.37.147",
4
4
  "description": "A lightweight, always-on multi-agent harness for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",