teapot-coding-agent 0.37.176 → 0.37.178
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.
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is this turn's text JUST an acknowledgement?
|
|
3
|
+
*
|
|
4
|
+
* The system prompt used to end with "…end the turn right after the call (a short "reported." is fine)", so models filed
|
|
5
|
+
* a report and answered "reported." — and some answer "報告済み。" or "了解" without calling the tool at all. The loop
|
|
6
|
+
* answers a filed report (a report is not a stopping point), but a bare acknowledgement is invisible to it: with no goal
|
|
7
|
+
* set, or with auto-continue off, the round simply ends and the work stops mid-task.
|
|
8
|
+
*
|
|
9
|
+
* MEASURED on the operator's own sessions: `report_progress` → "reported." → `round complete`, and the Japanese variant
|
|
10
|
+
* "報告済み。" with no tool call at all.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately narrow: a SHORT single-line message that is nothing but an acknowledgement. "done — the tests pass, next
|
|
13
|
+
* I'll fix the scroll" is a real report (it names work), and treating it as an ack would nudge a working model.
|
|
14
|
+
*/
|
|
15
|
+
const ACK = new RegExp("^(" +
|
|
16
|
+
[
|
|
17
|
+
// English
|
|
18
|
+
"reported",
|
|
19
|
+
"report(ed)? (filed|sent|done)",
|
|
20
|
+
"noted",
|
|
21
|
+
"ack",
|
|
22
|
+
"acknowledged",
|
|
23
|
+
"done",
|
|
24
|
+
"ok",
|
|
25
|
+
"okay",
|
|
26
|
+
"sure",
|
|
27
|
+
"understood",
|
|
28
|
+
"got it",
|
|
29
|
+
// Japanese
|
|
30
|
+
"報告済み",
|
|
31
|
+
"報告しました",
|
|
32
|
+
"報告おわり",
|
|
33
|
+
"報告終わり",
|
|
34
|
+
"了解",
|
|
35
|
+
"了解です",
|
|
36
|
+
"承知",
|
|
37
|
+
"承知しました",
|
|
38
|
+
"完了しました",
|
|
39
|
+
"完了",
|
|
40
|
+
"対応しました",
|
|
41
|
+
"進捗を報告しました",
|
|
42
|
+
].join("|") +
|
|
43
|
+
")([.。!!…\\s]*)$", "i");
|
|
44
|
+
/** Characters of real content beyond which this is a report, not an acknowledgement. */
|
|
45
|
+
const ACK_MAX_CHARS = 24;
|
|
46
|
+
export function isBareAcknowledgement(text) {
|
|
47
|
+
const raw = String(text ?? "");
|
|
48
|
+
const t = raw.replace(/\s+/g, " ").trim();
|
|
49
|
+
if (!t)
|
|
50
|
+
return false;
|
|
51
|
+
if (t.length > ACK_MAX_CHARS)
|
|
52
|
+
return false;
|
|
53
|
+
if (/\n/.test(raw.trim()))
|
|
54
|
+
return false;
|
|
55
|
+
return ACK.test(t);
|
|
56
|
+
}
|
package/dist/agent/agent.js
CHANGED
|
@@ -8,6 +8,7 @@ import { createCatalog } from "./tool-catalog.js";
|
|
|
8
8
|
import { resetToolCatalog, executeTool, toolSpecs, currentSkills, safeJoin, isContextOverflow, isRequestNodeLimit, hasRunningBgShellsFor, killBgShells, runningBgShellCount } from "./tools.js";
|
|
9
9
|
import { effortChoosable } from "./llm.js";
|
|
10
10
|
import { turnAnchor } from "./timing.js";
|
|
11
|
+
import { isBareAcknowledgement } from "./ack.js";
|
|
11
12
|
import { claimsContextLimit, claimsOwnLimit, usageLine } from "./context-claim.js";
|
|
12
13
|
import { compactionNotice } from "./compaction-notice.js";
|
|
13
14
|
import { isDegenerateRepeat } from "./loop-guard.js";
|
|
@@ -175,8 +176,10 @@ Most session state is not injected into prompts — fetch it with tools instead:
|
|
|
175
176
|
missing auth header"), never as alarm ("uh oh", "there seems to be a problem").
|
|
176
177
|
- When you make meaningful progress, call report_progress. Its output is
|
|
177
178
|
shown to the operator directly (rendered as markdown in the progress
|
|
178
|
-
panel) — do NOT also repeat the same content as a chat message
|
|
179
|
-
|
|
179
|
+
panel) — do NOT also repeat the same content as a chat message, and do NOT
|
|
180
|
+
end the round with a bare acknowledgement ("reported.", "報告済み。", "done"):
|
|
181
|
+
a report is not a stopping point, so keep working on the goal and call
|
|
182
|
+
finish() only when it is genuinely met or you are concretely blocked.
|
|
180
183
|
- Be frugal: prefer small precise edits, avoid runaway loops.
|
|
181
184
|
- **Two failures on the same cause is the signal to change approach, not to try
|
|
182
185
|
a third time.** Reread the error, list what you have already ruled out, and
|
|
@@ -1560,6 +1563,15 @@ export class Agent {
|
|
|
1560
1563
|
reportedNudges = 0;
|
|
1561
1564
|
/** consecutive forced continues that produced no work at all: the model is repeating, not progressing */
|
|
1562
1565
|
stalledReportContinues = 0;
|
|
1566
|
+
/**
|
|
1567
|
+
* Did this round call a WORK tool?
|
|
1568
|
+
*
|
|
1569
|
+
* The bare-acknowledgement rule below must not fire for a round that did something: MEASURED as a runaway — a model
|
|
1570
|
+
* that writes a file and then answers "ok" was treated as "acknowledged and stopped", so the loop forced another turn
|
|
1571
|
+
* for ever. The stall guard did not stop it either, because that counter is RESET by work tools — which is exactly what
|
|
1572
|
+
* this round had. It wrote 8GB of chat.jsonl in one test before anything noticed.
|
|
1573
|
+
*/
|
|
1574
|
+
workedThisRound = false;
|
|
1563
1575
|
/** the stream was aborted because the model looped on the same characters (#209) */
|
|
1564
1576
|
degenerateOutput = false;
|
|
1565
1577
|
degenerateStops = 0;
|
|
@@ -1666,7 +1678,29 @@ export class Agent {
|
|
|
1666
1678
|
* that into "the third interval is ignored". What actually needs guarding is the case where the model answers
|
|
1667
1679
|
* and does NOTHING — that is the stall counter below, which measures progress instead of counting reports.
|
|
1668
1680
|
*/
|
|
1669
|
-
|
|
1681
|
+
/**
|
|
1682
|
+
* …and it fires for a bare TEXT acknowledgement too.
|
|
1683
|
+
*
|
|
1684
|
+
* "報告済み。" (or "reported.", "done") with no tool call left `reportedThisRound` false, so a round that ended
|
|
1685
|
+
* on an acknowledgement was treated as an ordinary stop — the work halted mid-task with no note explaining it.
|
|
1686
|
+
* The prompt no longer invites that phrasing, but the loop must not depend on the model having read it.
|
|
1687
|
+
*/
|
|
1688
|
+
/**
|
|
1689
|
+
* …and for a bare TEXT acknowledgement, but only where one is an answer to the harness.
|
|
1690
|
+
*
|
|
1691
|
+
* The rule is deliberately narrow, because widening it is catastrophic in both directions:
|
|
1692
|
+
* - a model that did WORK and then wrote "ok" has simply finished its round; forcing another turn there is an
|
|
1693
|
+
* infinite loop (the stall guard resets on work), MEASURED as 8GB of chat.jsonl and two OOM kills;
|
|
1694
|
+
* - a plain chat turn that answers "ok" is a legitimate final answer, so nudging it makes every conversation
|
|
1695
|
+
* with a short reply gain an extra round (seven test suites noticed immediately).
|
|
1696
|
+
*
|
|
1697
|
+
* What is left is the case that was actually reported: the harness asked for progress (or the model filed one) and
|
|
1698
|
+
* the model answered "報告済み。" — an acknowledgement of a request it did not act on.
|
|
1699
|
+
*/
|
|
1700
|
+
const bareAck = !this.workedThisRound &&
|
|
1701
|
+
(this.reportedThisRound || this.progressRequestedThisRound) &&
|
|
1702
|
+
isBareAcknowledgement(this.lastAssistantText);
|
|
1703
|
+
if (!finished && (this.reportedThisRound || bareAck) &&
|
|
1670
1704
|
// a PAUSED goal means the operator parked this agent; forcing another turn would fight that
|
|
1671
1705
|
this.goal.status !== "paused") {
|
|
1672
1706
|
this.reportedNudges += 1;
|
|
@@ -2261,6 +2295,7 @@ export class Agent {
|
|
|
2261
2295
|
* never fired (MEASURED: the #215 test failed with the per-turn reset).
|
|
2262
2296
|
*/
|
|
2263
2297
|
this.reportedThisRound = false;
|
|
2298
|
+
this.workedThisRound = false;
|
|
2264
2299
|
/**
|
|
2265
2300
|
* …and the nudge BUDGET resets per round too.
|
|
2266
2301
|
*
|
|
@@ -2421,6 +2456,7 @@ export class Agent {
|
|
|
2421
2456
|
* forever instead of once.
|
|
2422
2457
|
*/
|
|
2423
2458
|
if (m.tool_calls?.some((c) => !NON_WORK_TOOLS.has(c.function.name))) {
|
|
2459
|
+
this.workedThisRound = true;
|
|
2424
2460
|
this.contextClaimNudges = 0;
|
|
2425
2461
|
this.blockerAsks = 0;
|
|
2426
2462
|
this.reportedNudges = 0;
|