teapot-coding-agent 0.37.192 → 0.37.194

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/master.js CHANGED
@@ -263,6 +263,15 @@ export class Master {
263
263
  tasks = [];
264
264
  childWaiters = new Map();
265
265
  reportedRunning = new Set();
266
+ /**
267
+ * Children that have already delivered a final report.
268
+ *
269
+ * `finish` logs its final message BEFORE the loop ends and the status turns `idle`, so by the time
270
+ * `onControlStatusChange` sees `idle` the parent has the result. Announcing "idle without having called finish()" on top
271
+ * of it is a contradiction the parent cannot resolve. Cleared when the child starts a new task, so a later silent exit is
272
+ * still reported.
273
+ */
274
+ finishedChildren = new Set();
266
275
  startedAt = Date.now();
267
276
  config;
268
277
  configPath;
@@ -743,9 +752,17 @@ export class Master {
743
752
  bus.emit("update", { kind: "event", agentId: e.agent, event: e });
744
753
  this.onChildEvent(ac, e);
745
754
  };
746
- agent.onControlStatusChange = (agentId, status) => {
755
+ agent.onControlStatusChange = (_agentId, status) => {
747
756
  if (!ac.parent)
748
757
  return;
758
+ /**
759
+ * The id comes from the closure, not from the callback argument.
760
+ *
761
+ * `Agent.setStatus` passes `this.opts.id`, which the master does not set, so the argument is `undefined` — the note
762
+ * said "@undefined is now idle" and the reported/finished bookkeeping below keyed on `undefined`, which made every
763
+ * child share one entry.
764
+ */
765
+ const agentId = ac.id;
749
766
  const parent = this.agents.get(ac.parent);
750
767
  if (!parent)
751
768
  return;
@@ -758,13 +775,18 @@ export class Master {
758
775
  * "サブエージェントがエラー落ちしたときの親への通知がびみょい" (#245). The generic note exists for statuses that have
759
776
  * no event of their own (`idle`, `stopped`, `waiting`).
760
777
  */
761
- if (this.reportedRunning.has(agentId) && SETTLED.has(status) && status !== "error")
778
+ if (this.reportedRunning.has(agentId) &&
779
+ SETTLED.has(status) &&
780
+ status !== "error" &&
781
+ !this.finishedChildren.has(agentId))
762
782
  parent.enqueuePrompt(`[harness] Sub-agent @${agentId} is now ${status} without having called finish(), so it has not reported a result.` +
763
783
  (status === "stopped"
764
784
  ? ` It may have been stopped mid-task; message it to resume, or re-spawn it.`
765
785
  : ` If you expected a result, message it or re-spawn it.`), "harness");
766
- if (status === "running")
786
+ if (status === "running") {
767
787
  this.reportedRunning.add(agentId);
788
+ this.finishedChildren.delete(agentId);
789
+ }
768
790
  else if (SETTLED.has(status))
769
791
  this.reportedRunning.delete(agentId);
770
792
  };
@@ -1044,6 +1066,7 @@ When this task is done (or truly blocked), call finish() with a summary for @${p
1044
1066
  if (!parent)
1045
1067
  return;
1046
1068
  if (e.type === "message" && e.data.final) {
1069
+ this.finishedChildren.add(ac.id);
1047
1070
  const d = e.data;
1048
1071
  const summary = String(d.content ?? "").trim();
1049
1072
  let report = summary;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.192",
3
+ "version": "0.37.194",
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",