teapot-coding-agent 0.37.207 → 0.37.208

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.
@@ -1776,6 +1776,16 @@ export class Agent {
1776
1776
  detail: "the completion audit rejected the same goal repeatedly ? stopping to avoid an unbounded retry loop",
1777
1777
  });
1778
1778
  this.consecutiveAuditRejects = 0;
1779
+ /**
1780
+ * …but a prompt that arrived DURING the audit is still owed an answer.
1781
+ *
1782
+ * This break sits before the `pendingPrompts` check below, so ending the loop here left a prompt queued with nothing
1783
+ * to drain it: `isLive()` reads `pendingPrompts.length > 0`, so the agent showed `waiting` for ever and the operator's
1784
+ * message was never delivered — "audit中にプロンプトを送るとaudit完了してもwaitingステータスが切れずにデッドロック
1785
+ * してそう". The cap is about the AUDIT loop, not about ignoring the operator.
1786
+ */
1787
+ if (this.pendingPrompts.length)
1788
+ continue;
1779
1789
  break;
1780
1790
  }
1781
1791
  if (this.pendingPrompts.length)
@@ -2668,21 +2678,7 @@ export class Agent {
2668
2678
  if (meta) {
2669
2679
  if ((await meta(call, m)) === "end") {
2670
2680
  finished = true;
2671
- /**
2672
- * `end` finishes the ROUND unless something arrived while the handler ran.
2673
- *
2674
- * A `finish(goalComplete)` spends a long time inside its own handler (the completion audit runs there), and a
2675
- * prompt sent during that window is queued in `pendingPrompts`. Returning straight away left it queued for ever:
2676
- * the loop ended, nothing drained it, and the agent stayed `waiting` with work outstanding — "audit中にプロンプトを
2677
- * 送るとaudit完了してもwaitingステータスが切れずにデッドロックしてそう". The remaining calls of this batch are answered
2678
- * first (a tool call must never be left without a result), then the round continues only if there is something
2679
- * to do.
2680
- */
2681
- if (this.pendingPrompts.length === 0 && !this.parkedByTool)
2682
- return true;
2683
- await this.answerUnansweredToolCalls(m);
2684
- finished = false;
2685
- return false;
2681
+ return true;
2686
2682
  }
2687
2683
  continue;
2688
2684
  }
@@ -2758,19 +2754,8 @@ export class Agent {
2758
2754
  }
2759
2755
  }
2760
2756
  await this.answerUnansweredToolCalls(m);
2761
- /**
2762
- * `finish` ends the BATCH, not the round — if something arrived while it was being handled.
2763
- *
2764
- * A `finish(goalComplete)` can take a long time (the completion audit runs inside it), and a prompt sent during that
2765
- * window is queued in `pendingPrompts`. Returning here ended the loop with that prompt still queued, so it was never
2766
- * delivered and the agent sat looking `waiting` with work outstanding — reported as "audit中にプロンプトを送るとaudit完了
2767
- * してもwaitingステータスが切れずにデッドロックしてそう". The batch is over either way; the ROUND continues whenever there is
2768
- * something to do, which is the same rule the top of the loop applies.
2769
- */
2770
- if (finished && this.pendingPrompts.length === 0 && !this.parkedByTool)
2771
- return true;
2772
2757
  if (finished)
2773
- finished = false;
2758
+ return true;
2774
2759
  }
2775
2760
  return finished;
2776
2761
  }
@@ -877,16 +877,7 @@ export function buildApp(master) {
877
877
  * stays for the API's older callers but is not what the row uses any more.
878
878
  */
879
879
  const ahead = a.pendingAheadOf(promptId);
880
- /**
881
- * "running" does not mean "this prompt will be picked up".
882
- *
883
- * A `finish(goalComplete)` holds the run inside its own handler for as long as the completion audit takes, and the loop
884
- * then ENDS when it returns `end` — so a prompt that arrived during the audit sat in the queue with nothing left to drain
885
- * it, and the agent reported `waiting` for ever. Skipping `start()` because the status happened to be `running` is what
886
- * kept it there. `start()` is a no-op while a round really is in flight (it returns early when `status === "running"`
887
- * without a pending stop), so calling it is safe: it only bites when the round has already ended underneath us.
888
- */
889
- if (body.start !== false)
880
+ if (body.start !== false && a.status !== "running")
890
881
  a.start("prompt");
891
882
  return c.json({ ok: true, promptId, ahead, queued: a.snapshot().pendingPrompts });
892
883
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.207",
3
+ "version": "0.37.208",
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",