teapot-coding-agent 0.37.144 → 0.37.146

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.
@@ -1369,7 +1369,6 @@ export class Agent {
1369
1369
  if (this.bgExits.length > 32)
1370
1370
  this.bgExits.shift();
1371
1371
  bus.emit("update", { kind: "agent-update", agentId: this.opts.id });
1372
- const windingDown = this.status === "running";
1373
1372
  /**
1374
1373
  * A finished GOAL is not woken by a background exit.
1375
1374
  *
@@ -1381,11 +1380,27 @@ export class Agent {
1381
1380
  * start of the next round, so a manual ▶ start (or the operator's own message) still sees every result.
1382
1381
  */
1383
1382
  const workIsDone = this.goal.status === "done";
1384
- if (!this.stopRequested && !workIsDone && (this.status === "idle" || windingDown)) {
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) {
1385
1400
  void this.enqueue(async () => {
1386
1401
  if (this.stopRequested)
1387
1402
  return;
1388
- if (this.status === "idle")
1403
+ if (this.status === "idle" || this.status === "waiting")
1389
1404
  this.start(`background job ${info.id} finished`);
1390
1405
  });
1391
1406
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.144",
3
+ "version": "0.37.146",
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",