teapot-coding-agent 0.37.112 → 0.37.113
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
|
@@ -252,6 +252,22 @@ export class Agent {
|
|
|
252
252
|
* clock in there would invalidate the cache on every request. Reported as "AIが時間把握するのが極めて下手"
|
|
253
253
|
* — a five minute exploit and a device reboot read exactly like an instant in the transcript.
|
|
254
254
|
*/
|
|
255
|
+
/**
|
|
256
|
+
* The answer to a "the context window made me stop" claim — the same words whether it arrived as prose
|
|
257
|
+
* (#201) or inside `finish(goalComplete=false)`'s summary, which is how it actually arrived three times in
|
|
258
|
+
* `mediapad-t5-root-attempt-2-2601e254` (#200 is the same event seen as a stopping habit).
|
|
259
|
+
*/
|
|
260
|
+
contextClaimAnswer(where) {
|
|
261
|
+
return (`${this.timeAnchor()}\n[harness] ` +
|
|
262
|
+
(where === "finish"
|
|
263
|
+
? "That finish() was refused: its summary gives the context window as the blocker, and the window is not yours to run out of."
|
|
264
|
+
: "You stopped because of the context window.") +
|
|
265
|
+
` The numbers above are measured, not estimated — the harness compacts automatically and has just done so.` +
|
|
266
|
+
`\nContinue the task. If this is a FALSE POSITIVE (you were quoting that phrase in a report rather than ` +
|
|
267
|
+
`stopping for it), say so and carry on, or call finish() with your summary if the work is actually done. ` +
|
|
268
|
+
`If you are genuinely blocked, finish(goalComplete=false) with a blocker that is NOT the context size — and ` +
|
|
269
|
+
`weigh it against the current goal first: a goal that is met is finish(goalComplete=true), not a stop.`);
|
|
270
|
+
}
|
|
255
271
|
timeAnchor() {
|
|
256
272
|
const clock = turnAnchor({
|
|
257
273
|
now: Date.now(),
|
|
@@ -1443,13 +1459,7 @@ export class Agent {
|
|
|
1443
1459
|
detail: "the agent stopped because of the context window — compaction is the harness's job, so it compacted and told the agent to continue (#201)",
|
|
1444
1460
|
});
|
|
1445
1461
|
await this.maybeCompact(true);
|
|
1446
|
-
const msg =
|
|
1447
|
-
`measured, not estimated: the harness compacts automatically and has just done so, so running out ` +
|
|
1448
|
-
`of window is not something you can decide. Continue the task.\n` +
|
|
1449
|
-
`If this is a FALSE POSITIVE — you were quoting that phrase in a report rather than stopping for it — ` +
|
|
1450
|
-
`say so and carry on, or call finish() with your summary if the work is actually done. If you are ` +
|
|
1451
|
-
`genuinely blocked, finish(goalComplete=false) with a blocker that is NOT the context size, and weigh ` +
|
|
1452
|
-
`it against the current goal first: a goal that is met is finish(goalComplete=true), not a stop.`;
|
|
1462
|
+
const msg = this.contextClaimAnswer("stop");
|
|
1453
1463
|
await this.log.append("prompt", this.currentSession, this.currentBranch, {
|
|
1454
1464
|
source: "harness",
|
|
1455
1465
|
text: msg,
|
|
@@ -1571,6 +1581,32 @@ export class Agent {
|
|
|
1571
1581
|
}
|
|
1572
1582
|
metaHandlers = {
|
|
1573
1583
|
finish: async (call, m) => {
|
|
1584
|
+
/**
|
|
1585
|
+
* A `finish(goalComplete=false)` whose summary blames the context window is not a blocker (#200/#201).
|
|
1586
|
+
*
|
|
1587
|
+
* MEASURED in `mediapad-t5-root-attempt-2-2601e254`: the stopping turns were NOT prose without tool calls —
|
|
1588
|
+
* they were `finish(goalComplete=false)` calls whose summary read "コンテキスト上限のため停止します".
|
|
1589
|
+
* Handling only the prose path would have missed every real occurrence.
|
|
1590
|
+
*/
|
|
1591
|
+
const fin = safeParse(call.function.arguments);
|
|
1592
|
+
if (fin.goalComplete !== true &&
|
|
1593
|
+
!this.awaitingUser &&
|
|
1594
|
+
this.contextClaimNudges < 2 &&
|
|
1595
|
+
claimsContextLimit(String(fin.summary ?? ""))) {
|
|
1596
|
+
this.contextClaimNudges += 1;
|
|
1597
|
+
await this.log.append("system_note", this.currentSession, this.currentBranch, {
|
|
1598
|
+
event: "context-claim-answered",
|
|
1599
|
+
attempt: this.contextClaimNudges,
|
|
1600
|
+
via: "finish",
|
|
1601
|
+
detail: "a finish(goalComplete=false) blamed the context window — refused, compacted, and told to continue (#201)",
|
|
1602
|
+
});
|
|
1603
|
+
await this.maybeCompact(true);
|
|
1604
|
+
const msg = this.contextClaimAnswer("finish");
|
|
1605
|
+
await this.log.append("prompt", this.currentSession, this.currentBranch, { source: "harness", text: msg });
|
|
1606
|
+
this.messages.push({ role: "user", content: msg });
|
|
1607
|
+
await this.answerMeta(call, "(finish refused: the context window is the harness's to manage)");
|
|
1608
|
+
return "next";
|
|
1609
|
+
}
|
|
1574
1610
|
this.pendingSubReport = "";
|
|
1575
1611
|
await this.answerMeta(call, "(completion submitted for audit)");
|
|
1576
1612
|
await this.handleFinish(call.function.arguments);
|