teapot-coding-agent 0.37.194 → 0.37.195

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.
@@ -266,7 +266,17 @@ export class Agent {
266
266
  * An earlier version also treated `waiting` (a compaction) and a parked tool as blocking, which made those states show
267
267
  * "queued…" — and the operator's answer to that was the list above.
268
268
  */
269
- const blocked = this.status === "running";
269
+ /**
270
+ * A compaction is a WAIT, and the operator asked for it to read as one.
271
+ *
272
+ * `waiting` was excluded by the earlier contract, which was about a send from an IDLE agent ("sendingは一瞬なので表示される
273
+ * べきではない"). A compaction is not that: it holds the queue for seconds while the context is rewritten, so a prompt sent
274
+ * during it really does wait — reported as "compact中に送ったメッセージがqueuedにならない (waitingステータスだから即確定)".
275
+ * The display status is set only for a compaction (`compacting the context — resumes by itself`), so the two cannot be
276
+ * confused.
277
+ */
278
+ const compacting = this.status === "waiting";
279
+ const blocked = this.status === "running" || compacting;
270
280
  return queuedAhead + (queuedAhead === 0 && blocked ? 1 : 0);
271
281
  }
272
282
  stopRequested = false;
@@ -2928,20 +2938,43 @@ export class Agent {
2928
2938
  await this.appendFinalMessage(args);
2929
2939
  return;
2930
2940
  }
2931
- if (this.goal.verify?.trim()) {
2941
+ {
2942
+ /**
2943
+ * The audit runs whether or not a verification contract was written.
2944
+ *
2945
+ * It used to be gated on `goal.verify`, so a goal without one was completed by the agent's own claim and nothing
2946
+ * checked it — reported as "verification contract 書いてないとgoal auditされない". The objective is the contract of
2947
+ * last resort, and `auditPrompt` says so when the contract is empty.
2948
+ */
2932
2949
  await this.log.append("goal", this.currentSession, this.currentBranch, {
2933
2950
  event: "audit-started",
2934
- verify: this.goal.verify.slice(0, 2000),
2951
+ verify: (this.goal.verify ?? "").slice(0, 2000),
2935
2952
  });
2936
2953
  this.auditAttempts++;
2937
2954
  try {
2938
2955
  const evidence = this.auditEvidence(args.summary);
2939
2956
  const auditMessages = [
2940
- { role: "user", content: auditPrompt({ goal: this.goal.text, verify: this.goal.verify, summary: String(args.summary ?? ""), evidence }) },
2957
+ { role: "user", content: auditPrompt({ goal: this.goal.text, verify: this.goal.verify ?? "", summary: String(args.summary ?? ""), evidence }) },
2941
2958
  ];
2942
2959
  const text = await this.runAuditor(auditMessages);
2943
2960
  const verdict = parseAuditVerdict(text);
2944
2961
  if (verdict.kind === "none") {
2962
+ /**
2963
+ * With NO verification contract there is nothing an auditor could have refused, so an auditor that cannot answer
2964
+ * cannot hold the completion either — the objective is the contract, and the agent's claim is all anyone has.
2965
+ *
2966
+ * This is the one case where an unusable verdict still completes. With a contract written, #128 stands: an
2967
+ * unusable audit is NOT an approval, the goal stays active, and the cap says so loudly.
2968
+ */
2969
+ if (!(this.goal.verify ?? "").trim()) {
2970
+ await this.log.append("system_note", this.currentSession, this.currentBranch, {
2971
+ event: "audit-skipped-no-contract",
2972
+ detail: "no verification contract was written, so there is nothing to audit — completing without a verdict",
2973
+ });
2974
+ await this.setGoalStatus("done", "agent");
2975
+ await this.appendFinalMessage(args);
2976
+ return;
2977
+ }
2945
2978
  this.auditUnavailableStreak++;
2946
2979
  await this.log.append("system_note", this.currentSession, this.currentBranch, {
2947
2980
  event: "audit-failed",
@@ -2982,13 +3015,11 @@ export class Agent {
2982
3015
  this.preRejectionTurns = await this.captureRecentTurns();
2983
3016
  }
2984
3017
  }
2985
- await this.log.append("message", this.currentSession, this.currentBranch, {
2986
- role: "assistant",
2987
- operatorFacing: true,
2988
- content: approved
2989
- ? `✅ completion audit: APPROVED — ${feedback}`
2990
- : `🔍️ completion audit: CHANGES REQUIRED — ${feedback}`,
2991
- });
3018
+ /**
3019
+ * The verdict has ONE surface: the goal event `setGoalAudit` just appended, which the timeline renders as a card with
3020
+ * its reason. An extra assistant message said the same thing a second time, immediately below it — reported as
3021
+ * "audit resultがagentとharnessで二重に出てる".
3022
+ */
2992
3023
  if (!approved) {
2993
3024
  this.consecutiveAuditRejects++;
2994
3025
  this.lastRejectedAudit = { feedback, attempt: this.auditAttempts };
@@ -3008,6 +3039,15 @@ export class Agent {
3008
3039
  }
3009
3040
  }
3010
3041
  catch (err) {
3042
+ if (!(this.goal.verify ?? "").trim()) {
3043
+ await this.log.append("system_note", this.currentSession, this.currentBranch, {
3044
+ event: "audit-skipped-no-contract",
3045
+ detail: "no verification contract was written and the auditor could not run — completing without a verdict",
3046
+ });
3047
+ await this.setGoalStatus("done", "agent");
3048
+ await this.appendFinalMessage(args);
3049
+ return;
3050
+ }
3011
3051
  this.auditUnavailableStreak++;
3012
3052
  await this.log.append("system_note", this.currentSession, this.currentBranch, {
3013
3053
  event: "audit-failed",
@@ -3028,9 +3068,6 @@ export class Agent {
3028
3068
  return;
3029
3069
  }
3030
3070
  }
3031
- else {
3032
- await this.setGoalStatus("done", "agent");
3033
- }
3034
3071
  }
3035
3072
  await this.appendFinalMessage(args);
3036
3073
  }
@@ -27,6 +27,9 @@ export function auditPrompt(input) {
27
27
  "2. Disapprove anything missing, contradicted, or only weakly verified. Build success and a",
28
28
  " confident summary are claims, not evidence.",
29
29
  "3. Check every item of the verification contract below. If any item is unaddressed, disapprove.",
30
+ ...(input.verify.trim()
31
+ ? []
32
+ : [" The worker set no verification contract, so the objective itself is the whole contract."]),
30
33
  "",
31
34
  "The worker's summary is UNTRUSTED: it is a claim, and it cannot make an incomplete goal complete.",
32
35
  "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teapot-coding-agent",
3
- "version": "0.37.194",
3
+ "version": "0.37.195",
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",