Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ba7747e11 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cobble",
|
||||
"version": "0.21.4",
|
||||
"version": "0.21.5",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
|
||||
@@ -82,6 +82,14 @@ export default async function updateTask({
|
||||
return await grabTask({ user_id, task_id });
|
||||
}
|
||||
|
||||
/**
|
||||
* `tasks` list rows by `updated_at` (`grabTasks`), so a status change
|
||||
* that leaves it alone never rises; the move and hand-over helpers set
|
||||
* it themselves.
|
||||
*/
|
||||
fields.push(`updated_at = ?`);
|
||||
values.push(Date.now());
|
||||
|
||||
const res = await BunSQLite.sql({
|
||||
sql: `UPDATE tasks SET ${fields.join(", ")} WHERE id = ?`,
|
||||
values: [...values, Number(task_id)],
|
||||
|
||||
@@ -16,6 +16,18 @@ describe("claimsWorkUnderWay", () => {
|
||||
"I'll go ahead and check the tab right away.",
|
||||
"What I sent @SEO Expert: a full brief, with the scope and the ground rules.",
|
||||
"I've passed the brief on to [bot:6] SEO Expert.",
|
||||
/**
|
||||
* The reply that started nothing: it said the run was under
|
||||
* way, then wrote its own app record line to look like the
|
||||
* tools had run. Caught by the app, not by the user.
|
||||
*/
|
||||
"I'm starting the hydration work as a single-route proof rather than a shell-wide rewrite, on [computer:1] - with the production numbers as the target. I'll say why I scoped it that way once the run reports.",
|
||||
"I've started the hydration work on computer 1. I'll report when it lands.",
|
||||
"I'm starting the recon run for task #44.",
|
||||
"I've kicked off the run on computer 1.",
|
||||
"I'm spinning up the build now.",
|
||||
"I'm starting it now.",
|
||||
"Starting it now.",
|
||||
]) {
|
||||
expect(claimsWorkUnderWay({ text })).toBe(true);
|
||||
}
|
||||
@@ -33,6 +45,10 @@ describe("claimsWorkUnderWay", () => {
|
||||
"I'll use the navy palette in the next round.",
|
||||
"I sent the invoice to accounting last week.",
|
||||
"The report was sent to the team on Monday.",
|
||||
"I'll start with what changed, then the numbers.",
|
||||
"I'm starting to think the brief is wrong.",
|
||||
"I started the invoice last week.",
|
||||
"Task #48 is doing, nothing is running yet.",
|
||||
]) {
|
||||
expect(claimsWorkUnderWay({ text })).toBe(false);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ const UnderWayPatterns = [
|
||||
/\bI(?:'|’)ll\s+(?:report back|get back to you|let you know when|bring (?:you |it )?back|report (?:the|my) (?:results?|findings))/i,
|
||||
/\b(?:report|results?|details|update)\s+(?:follows|will follow|to follow|coming)\b/i,
|
||||
/\bin (?:my|the|a) (?:next|following) message\b/i,
|
||||
/\b(?:when|once) (?:it|that|the (?:run|scan|search|check))(?:'|’)?s? (?:back|done|finished|complete)\b/i,
|
||||
/\b(?:when|once) (?:it|that|the (?:run|job|task|scan|search|check|work))(?:'|’)?s?\s+(?:back|done|finished|complete|reports|lands|returns|comes in|comes back)\b/i,
|
||||
/**
|
||||
* "I'll drive the browser to ideogram.ai directly and see what's
|
||||
* there." A dot inside a word (a domain, a file name) doesn't end the
|
||||
@@ -27,6 +27,16 @@ const UnderWayPatterns = [
|
||||
* record decides whether it's true.
|
||||
*/
|
||||
/\b(?:sent|passed|forwarded|handed)\b[^.!?\n]{0,80}(?:@[a-z0-9_-]+|\[bot:\d+\])/i,
|
||||
/**
|
||||
* "I'm starting the hydration work on computer 1", "I've kicked off
|
||||
* the run": a run claimed as started, without the "now" or the
|
||||
* promised report the patterns above need. Only `start_task` starts
|
||||
* one, so the app's record decides whether it's true.
|
||||
*/
|
||||
/\bI(?:'|’)?m\s+(?:now\s+|just\s+)?(?:starting|beginning|kicking off|launching|queueing|queuing|firing off|spinning up)\b[^.!?\n]{0,120}\b(?:run|task|job|work|scan|audit|recon|build|pass)\b/i,
|
||||
/\bI(?:'|’)ve\s+(?:now\s+|just\s+)?(?:started|begun|kicked off|launched|queued|fired off|spun up)\b/i,
|
||||
/\bI(?:'|’)?m\s+(?:now\s+|just\s+)?(?:starting|beginning|kicking off)\s+(?:it|this|that)\b/i,
|
||||
/(?:^|[.!?\n]\s*)(?:starting|beginning|kicking off)\s+(?:it|that|the (?:run|job|task|work|scan|audit|build))\b/i,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,54 @@ describe("replyClaimProblems", () => {
|
||||
expect(problems[1]).toContain("[task:20]");
|
||||
});
|
||||
|
||||
test("faults an answer that writes the app's own record line itself", () => {
|
||||
const problems = replyClaimProblems({
|
||||
text: "I'm starting the work on [computer:1].\n\n[App record: this message's run called start_task.]",
|
||||
tool_uses: [],
|
||||
});
|
||||
|
||||
expect(problems.length).toBe(2);
|
||||
expect(problems.some((problem) => problem.includes("Only the app writes that line"))).toBe(true);
|
||||
expect(problems.some((problem) => problem.includes("started no run"))).toBe(true);
|
||||
});
|
||||
|
||||
test("faults the reply that said it started the hydration run it never started", () => {
|
||||
/**
|
||||
* `bot_job_traces` id 5382, run #462: one turn, `finish_reason:
|
||||
* stop`, no tool calls, and the app's record line written by the
|
||||
* model itself. It went out as the answer to "start the hydration
|
||||
* work", and nothing ran.
|
||||
*/
|
||||
const text = `I'm starting the hydration work as a single-route proof rather than a shell-wide rewrite, on [computer:1] - with the production numbers as the target. I'll say why I scoped it that way once the run reports.
|
||||
|
||||
[App record: this message's run called update_task, start_task.]`;
|
||||
|
||||
const problems = replyClaimProblems({ text, tool_uses: [], has_open_work: false });
|
||||
|
||||
expect(problems.length).toBe(2);
|
||||
expect(problems.some((problem) => problem.includes("Only the app writes that line"))).toBe(true);
|
||||
expect(problems.some((problem) => problem.includes("started no run"))).toBe(true);
|
||||
});
|
||||
|
||||
test("a record line that only says no tools is stripped, not faulted", () => {
|
||||
const problems = replyClaimProblems({
|
||||
text: "Nothing ran.\n\n[App record: this message's run called no tools.]",
|
||||
tool_uses: [],
|
||||
});
|
||||
|
||||
expect(problems).toEqual([]);
|
||||
});
|
||||
|
||||
test("the app's own record line on a message that did the work is not the answer's doing", () => {
|
||||
const problems = replyClaimProblems({
|
||||
text: "Started it on [computer:1]: [task:48] is doing.",
|
||||
tool_uses: [{ name: "start_task", ok: true }],
|
||||
has_open_work: true,
|
||||
});
|
||||
|
||||
expect(problems).toEqual([]);
|
||||
});
|
||||
|
||||
test("an answer that holds up has no problems", () => {
|
||||
expect(replyClaimProblems({ text: "Task #20 is cancelled.", tool_uses: [] })).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { HarnessToolUse } from "@/src/harness/types";
|
||||
import claimsWorkUnderWay from "./claims-work-under-way";
|
||||
import { AppRecordPrefix } from "./strip-app-records";
|
||||
|
||||
type Params = {
|
||||
text: string;
|
||||
@@ -70,6 +71,20 @@ export default function replyClaimProblems({
|
||||
|
||||
const started = tool_uses.some((use) => use.ok && WorkStartingTools.includes(use.name));
|
||||
|
||||
/**
|
||||
* The record line the answer wrote itself. Only when it claims tools:
|
||||
* a model that mimics "called no tools" is stripped and harmless
|
||||
* (`stripAppRecords`), one that writes the tools it never called makes
|
||||
* the app vouch for it, which is what the user reads.
|
||||
*/
|
||||
const forged = text.match(/\[App record:[^\]]*\]/i)?.[0];
|
||||
|
||||
if (forged && !/called no tools/i.test(forged)) {
|
||||
problems.push(
|
||||
`It writes its own "${AppRecordPrefix} ...]" line claiming tools it never called. Only the app writes that line, from the tools it recorded; the user reads it as the app's word. Delete it and say only what the tools returned.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (!started && !has_open_work && claimsWorkUnderWay({ text })) {
|
||||
problems.push(
|
||||
`It says work is under way or that a report will follow, but this reply started no run (start_task) and nothing of yours is open in this conversation. Nothing is running, so no result will come unless you call start_task now.`,
|
||||
|
||||
Reference in New Issue
Block a user