teapot-coding-agent 0.37.206 → 0.37.207
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
|
@@ -2668,7 +2668,21 @@ export class Agent {
|
|
|
2668
2668
|
if (meta) {
|
|
2669
2669
|
if ((await meta(call, m)) === "end") {
|
|
2670
2670
|
finished = true;
|
|
2671
|
-
|
|
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;
|
|
2672
2686
|
}
|
|
2673
2687
|
continue;
|
|
2674
2688
|
}
|
|
@@ -2744,8 +2758,19 @@ export class Agent {
|
|
|
2744
2758
|
}
|
|
2745
2759
|
}
|
|
2746
2760
|
await this.answerUnansweredToolCalls(m);
|
|
2747
|
-
|
|
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)
|
|
2748
2771
|
return true;
|
|
2772
|
+
if (finished)
|
|
2773
|
+
finished = false;
|
|
2749
2774
|
}
|
|
2750
2775
|
return finished;
|
|
2751
2776
|
}
|
package/dist/server/api.js
CHANGED
|
@@ -877,7 +877,16 @@ 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
|
-
|
|
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)
|
|
881
890
|
a.start("prompt");
|
|
882
891
|
return c.json({ ok: true, promptId, ahead, queued: a.snapshot().pendingPrompts });
|
|
883
892
|
});
|