copilot-operator 0.1.96 → 0.1.99
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/src/api/apiLock.js +82 -0
- package/dist/src/api/folderPicker.js +22 -22
- package/dist/src/api/main.js +5 -0
- package/dist/src/api/operator.controller.js +37 -11
- package/dist/src/api/operator.service.js +493 -86
- package/dist/src/api/server.js +10 -0
- package/dist/src/config/exportHome.js +52 -10
- package/dist/src/config/home.js +27 -11
- package/dist/src/config/schema.js +13 -0
- package/dist/src/exec/authorizer.js +11 -4
- package/dist/src/exec/commandHeads.js +25 -0
- package/dist/src/exec/confinement.js +50 -4
- package/dist/src/exec/network.js +11 -1
- package/dist/src/exec/npmScripts.js +33 -0
- package/dist/src/exec/policy.js +79 -24
- package/dist/src/exec/processes.js +24 -5
- package/dist/src/exec/programs.js +21 -0
- package/dist/src/exec/reportFile.js +2 -1
- package/dist/src/exec/runner.js +31 -9
- package/dist/src/exec/scriptFiles.js +133 -6
- package/dist/src/orchestrator/handoff.js +3 -3
- package/dist/src/orchestrator/kerriganRunner.js +14 -6
- package/dist/src/orchestrator/leadRunner.js +43 -23
- package/dist/src/orchestrator/review.js +66 -10
- package/dist/src/orchestrator/taskRunner.js +73 -14
- package/dist/src/plan/kerrigan.js +253 -253
- package/dist/src/plan/schema.js +3 -13
- package/dist/src/plan/systemGuide.js +28 -28
- package/dist/src/protocol/kerriganSchema.js +5 -1
- package/dist/src/protocol/replySchema.js +2 -2
- package/dist/src/queue/queue.js +93 -0
- package/dist/src/session/compose.js +14 -10
- package/dist/src/session/locatorFailures.js +32 -12
- package/dist/src/session/model.js +23 -0
- package/dist/src/session/store.js +47 -0
- package/dist/src/session/workspace.js +20 -5
- package/dist/src/transport/copilotTransport.js +82 -62
- package/dist/src/util/zip.js +147 -44
- package/dist/src/vcs/newBranch.js +24 -2
- package/dist/src/vcs/operatorGit.js +9 -10
- package/dist/src/vcs/referenceGuard.js +9 -4
- package/dist/web/404.html +2 -2
- package/dist/web/_next/static/chunks/1024-c0eee3ec374816d1.js +1 -0
- package/dist/web/_next/static/chunks/1077.a4fe6ae48f3d3ff9.js +1 -0
- package/dist/web/_next/static/chunks/1548.765d6eed5325bd01.js +1 -0
- package/dist/web/_next/static/chunks/2163.e8d6c85412d5d411.js +1 -0
- package/dist/web/_next/static/chunks/6240-8ba644c53ffab87d.js +1 -0
- package/dist/web/_next/static/chunks/714.f2dcd6b41b58d1a7.js +1 -0
- package/dist/web/_next/static/chunks/7220.652a8a339c1e7401.js +1 -0
- package/dist/web/_next/static/chunks/7921-9cf1ece94fc89bb3.js +1 -0
- package/dist/web/_next/static/chunks/8584.7c438425140f1d8d.js +1 -0
- package/dist/web/_next/static/chunks/9067.8c4e6a64620a45d9.js +1 -0
- package/dist/web/_next/static/chunks/9747.43d25bdff8737d09.js +1 -0
- package/dist/web/_next/static/chunks/app/{layout-2364903896c2c175.js → layout-97259931ed97e20d.js} +1 -1
- package/dist/web/_next/static/chunks/app/page-26e4ea30eb076e6b.js +1 -0
- package/dist/web/_next/static/chunks/app/queue/page-7228e045f8ea10c4.js +1 -0
- package/dist/web/_next/static/chunks/app/settings/page-c915d61553e1025b.js +1 -0
- package/dist/web/_next/static/chunks/app/system/page-4d24f44eb9077fb7.js +1 -0
- package/dist/web/_next/static/chunks/{webpack-3f144d13be3516c2.js → webpack-31db88c3d5781520.js} +1 -1
- package/dist/web/_next/static/css/{523d11041085f836.css → 87999096d96266fd.css} +1 -1
- package/dist/web/defaults.html +2 -2
- package/dist/web/defaults.txt +26 -25
- package/dist/web/index.html +3 -3
- package/dist/web/index.txt +26 -25
- package/dist/web/queue.html +2 -2
- package/dist/web/queue.txt +26 -25
- package/dist/web/settings.html +2 -2
- package/dist/web/settings.txt +26 -25
- package/dist/web/system.html +2 -2
- package/dist/web/system.txt +26 -25
- package/package.json +3 -2
- package/prompts/kerrigan1.md +2 -1
- package/prompts/lead1.md +2 -1
- package/prompts/level1.md +6 -1
- package/prompts/review1.md +7 -4
- package/dist/web/_next/static/chunks/1024-214ded25b9048526.js +0 -1
- package/dist/web/_next/static/chunks/1077.161de82f740d47f0.js +0 -1
- package/dist/web/_next/static/chunks/1548.f2688468bf946e13.js +0 -1
- package/dist/web/_next/static/chunks/2163.b8ada3b7bde69f03.js +0 -1
- package/dist/web/_next/static/chunks/714.d1489788e598833b.js +0 -1
- package/dist/web/_next/static/chunks/7220.b85c8d105f394389.js +0 -1
- package/dist/web/_next/static/chunks/7921-00ebbcc6f65fbe35.js +0 -1
- package/dist/web/_next/static/chunks/8124-1dba8babfcfbc6e2.js +0 -1
- package/dist/web/_next/static/chunks/8584.a678bfced1cea938.js +0 -1
- package/dist/web/_next/static/chunks/9067.6da03ae052877b19.js +0 -1
- package/dist/web/_next/static/chunks/9747.ba29e64e97e8a15b.js +0 -1
- package/dist/web/_next/static/chunks/app/page-d031bf326e401246.js +0 -1
- package/dist/web/_next/static/chunks/app/queue/page-9cfc8f78d536cfb6.js +0 -1
- package/dist/web/_next/static/chunks/app/settings/page-9c2b961beb8b3dce.js +0 -1
- package/dist/web/_next/static/chunks/app/system/page-3466496814a70b62.js +0 -1
- /package/dist/web/_next/static/{kNfJ9jSwlboc-1sFBBfuI → n8n-2FmbL8PhXulu4hTV5}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{kNfJ9jSwlboc-1sFBBfuI → n8n-2FmbL8PhXulu4hTV5}/_ssgManifest.js +0 -0
|
@@ -22,7 +22,8 @@ import { readFile, writeFile, mkdir } from 'node:fs/promises';
|
|
|
22
22
|
import { join } from 'node:path';
|
|
23
23
|
import { installLayout } from '../config/layout.js';
|
|
24
24
|
import { ChatLost, WindowClosed } from '../transport/chatTransport.js';
|
|
25
|
-
import { parseReview,
|
|
25
|
+
import { parseReview, findLikelyDamage, damageGuidance } from '../protocol/parser.js';
|
|
26
|
+
import { CHECK_EXPECTS } from '../plan/schema.js';
|
|
26
27
|
import { describeFindings, findingId, isGrounded } from '../protocol/reviewSchema.js';
|
|
27
28
|
import { runStep } from '../exec/runner.js';
|
|
28
29
|
import { effectiveShell, preferredShell, refusalForChat, resolveShell, shellNote } from '../exec/shells.js';
|
|
@@ -32,9 +33,41 @@ import { writeReport } from '../exec/reportFile.js';
|
|
|
32
33
|
import { mergeRedactions } from '../exec/redaction.js';
|
|
33
34
|
import { trackedRepoOf } from '../vcs/taskVcs.js';
|
|
34
35
|
import { buildCoveringMessage, assertSendable } from '../protocol/reporter.js';
|
|
35
|
-
import { planForReviewer } from './planMode.js';
|
|
36
|
+
import { describePlan, planForReviewer } from './planMode.js';
|
|
36
37
|
import { inScope } from '../vcs/scope.js';
|
|
37
38
|
import { gitConfigMessage, watchGitConfig } from '../vcs/gitConfigGuard.js';
|
|
39
|
+
/**
|
|
40
|
+
* What a reviewer is told when its reply did not match its contract (third hunt, 2026-11-20): its own statuses and its own
|
|
41
|
+
* example. It was given the implementer's message, whose example ends with "done", "blocked" or "ask" — none of them a
|
|
42
|
+
* review's — and a check with a guessed `expect` made the whole verdict invalid; when the retries ran out the work was
|
|
43
|
+
* accepted unreviewed.
|
|
44
|
+
*/
|
|
45
|
+
export function reviewFormatErrorMessage(fail, attempt, maxAttempts) {
|
|
46
|
+
return [
|
|
47
|
+
`Your last reply did not match the review's format (format retry ${attempt} of ${maxAttempts}).`,
|
|
48
|
+
fail.reason === 'no-json-block' ? 'There was no fenced json code block in it.' : `The json block did not validate: ${fail.detail}`,
|
|
49
|
+
'A review\'s "status" is "continue" (with the steps to run), "pass" or "fail" (each with its "summary"; "fail" with its "findings") — ' +
|
|
50
|
+
'never "done", "blocked" or "ask", which are the implementer\'s. A finding\'s "check", when it has one, has "expect" set to one of: ' +
|
|
51
|
+
`${CHECK_EXPECTS.join(', ')}.`,
|
|
52
|
+
'Only the format is wrong. Nothing from that reply was run. Send the same answer again, reformatted, as exactly one fenced code block ' +
|
|
53
|
+
'tagged json — do not start over and do not change what it says. For example:',
|
|
54
|
+
'```json',
|
|
55
|
+
'{"status": "continue", "notes": "what this round looks at", "steps": [{"id": 1, "type": "command", "cmd": "npm test"}], "summary": "", "findings": []}',
|
|
56
|
+
'```',
|
|
57
|
+
'or {"status": "pass", "steps": [], "summary": "several sentences: what you ran and what came back", "findings": []}',
|
|
58
|
+
'or {"status": "fail", "steps": [], "summary": "…", "findings": [{"what": "…", "evidence": "…", "basis": "the sentence of the task it rests on", "where": "file and place", "about": "work", "check": {"name": "…", "expect": "exit-zero", "run": "npm test"}}]}',
|
|
59
|
+
].join('\n');
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A refusal as the reviewer is told it (third hunt, 2026-11-20): the gate's words are the implementer's, and told to "end
|
|
63
|
+
* blocked" — a status a review has not got — a reviewer that did so spent a format retry on it. Its own words instead.
|
|
64
|
+
*/
|
|
65
|
+
export function forTheReviewer(reason) {
|
|
66
|
+
return reason
|
|
67
|
+
.replace(/\bend `?blocked`? and say in (?:`|")?(?:needed|notes)(?:`|")?/gi, 'say in a finding')
|
|
68
|
+
.replace(/\s+and end `?blocked`?/gi, '')
|
|
69
|
+
.replace(/\bin `notes`/g, 'in a finding');
|
|
70
|
+
}
|
|
38
71
|
/** The sentence both sides get when a review left something listening. */
|
|
39
72
|
function leftoverNote(leftovers) {
|
|
40
73
|
const listening = leftovers.filter((l) => l.ports.length > 0);
|
|
@@ -57,7 +90,9 @@ export function deliverableFor(task, summary, tracked, changedFiles) {
|
|
|
57
90
|
}
|
|
58
91
|
export function reviewBrief(session, task, changedFiles, cwd, deviations = [], previous, disputes = [], derivedFailing = [], earlier = [], deliverable,
|
|
59
92
|
/** The approved plan, in plan mode: see `planForReviewer`. */
|
|
60
|
-
plan
|
|
93
|
+
plan,
|
|
94
|
+
/** The operator's notes the implementer was given (`ReviewDeps.notes`). */
|
|
95
|
+
notes = []) {
|
|
61
96
|
// The same repository the runner branched and read the changed files from, however it is named.
|
|
62
97
|
const repo = trackedRepoOf(session);
|
|
63
98
|
// Each file marked against the task's scope, and the scope said: the reviewer was shown side effects as
|
|
@@ -80,6 +115,16 @@ plan) {
|
|
|
80
115
|
'## The project instructions that applied',
|
|
81
116
|
'',
|
|
82
117
|
task.level2.trim() || '(none)',
|
|
118
|
+
/*
|
|
119
|
+
* The skill the task was sent with, and the operator's notes about it (third hunt, 2026-11-20): the implementer
|
|
120
|
+
* worked to them, and a reviewer without them judged the work against the prompt alone.
|
|
121
|
+
*/
|
|
122
|
+
...(task.skill?.text.trim()
|
|
123
|
+
? ['', `## The skill the task was sent with: ${task.skill.name}`, '', ...(task.skill.description.trim() ? [`For: ${task.skill.description.trim()}`, ''] : []), task.skill.text.trim()]
|
|
124
|
+
: []),
|
|
125
|
+
...(notes.length > 0
|
|
126
|
+
? ['', "## The operator's notes about this task", '', 'Sent to the implementer while it worked; where a note and the task disagree, the note wins.', '', ...notes.map((n) => `- ${n.trim().replace(/\n/g, '\n ')}`)]
|
|
127
|
+
: []),
|
|
83
128
|
...(plan ? ['', planForReviewer(plan)] : []),
|
|
84
129
|
...(earlier.length > 0
|
|
85
130
|
? [
|
|
@@ -251,8 +296,19 @@ export async function runReview(transport, session, task, deps) {
|
|
|
251
296
|
let derivedRetried = false;
|
|
252
297
|
/** A finding whose basis is not in the task is sent back once; after that it is dropped. */
|
|
253
298
|
let groundingRetried = false;
|
|
254
|
-
/**
|
|
255
|
-
|
|
299
|
+
/**
|
|
300
|
+
* What a finding may quote: this task, its instructions, the earlier tasks it was shown — and, since the third hunt
|
|
301
|
+
* (2026-11-20), the skill, the operator's notes, and the approved plan with what the operator added to it. The reviewer
|
|
302
|
+
* is told a stage left out of the plan is a finding, and such a finding was dropped as "invented".
|
|
303
|
+
*/
|
|
304
|
+
const groundingSources = [
|
|
305
|
+
task.prompt,
|
|
306
|
+
task.level2,
|
|
307
|
+
...(deps.earlier ?? []).map((e) => e.prompt),
|
|
308
|
+
task.skill?.text ?? '',
|
|
309
|
+
...(deps.notes ?? []),
|
|
310
|
+
...(deps.plan ? [describePlan(deps.plan), deps.plan.approved?.note ?? ''] : []),
|
|
311
|
+
].filter((x) => x.trim());
|
|
256
312
|
const saveReply = async (label, markdown) => {
|
|
257
313
|
await writeFile(join(dir, `${label}.md`), markdown, 'utf8').catch(() => undefined);
|
|
258
314
|
};
|
|
@@ -263,14 +319,14 @@ export async function runReview(transport, session, task, deps) {
|
|
|
263
319
|
// The machine's shells, when they are not what the contract's example assumes — the same note
|
|
264
320
|
// the implementer's conversation opens with, for a conversation working to the same example.
|
|
265
321
|
const machineNote = shellNote(undefined, defaultShell);
|
|
266
|
-
let before = await transport.sendAndConfirm(machineNote ? `${contract}
|
|
267
|
-
|
|
322
|
+
let before = await transport.sendAndConfirm(machineNote ? `${contract}
|
|
323
|
+
|
|
268
324
|
${machineNote}` : contract);
|
|
269
325
|
await transport.waitForReply(before);
|
|
270
326
|
await pacer.throttleSend();
|
|
271
327
|
// The brief is saved as sent. Until it was, whether a later round had been told what the
|
|
272
328
|
// earlier one found could not be checked from the run folder at all.
|
|
273
|
-
const brief = reviewBrief(session, task, deps.changedFiles, deps.cwd, deps.deviations, deps.previous, deps.disputes, deps.derivedFailing, deps.earlier, deps.deliverable, deps.plan);
|
|
329
|
+
const brief = reviewBrief(session, task, deps.changedFiles, deps.cwd, deps.deviations, deps.previous, deps.disputes, deps.derivedFailing, deps.earlier, deps.deliverable, deps.plan, deps.notes ?? []);
|
|
274
330
|
await saveReply('00-brief', brief);
|
|
275
331
|
await deps.record(`REVIEW ${round} BRIEF`, brief);
|
|
276
332
|
before = await transport.sendAndConfirm(brief);
|
|
@@ -296,7 +352,7 @@ ${machineNote}` : contract);
|
|
|
296
352
|
return { verdict: 'error', findings: [], stepsRun, iterations, problem: `the reviewer would not keep its output contract: ${parsed.detail}` };
|
|
297
353
|
}
|
|
298
354
|
await pacer.throttleSend();
|
|
299
|
-
const b = await transport.sendAndConfirm(
|
|
355
|
+
const b = await transport.sendAndConfirm(reviewFormatErrorMessage(parsed, formatRetries, cfg.limits.maxFormatRetries));
|
|
300
356
|
markdown = (await transport.waitForReply(b)).markdown;
|
|
301
357
|
continue;
|
|
302
358
|
}
|
|
@@ -479,7 +535,7 @@ ${machineNote}` : contract);
|
|
|
479
535
|
confinement: { roots: deps.roots, cwd: deps.cwd, workStartedAt: deps.workStartedAt },
|
|
480
536
|
});
|
|
481
537
|
if (decision.action !== 'run') {
|
|
482
|
-
results.push(refused(step.id, decision.reason, step.cmd, step.shell, decision.by === 'operator' ? 'operator' : 'runner'));
|
|
538
|
+
results.push(refused(step.id, forTheReviewer(decision.reason), step.cmd, step.shell, decision.by === 'operator' ? 'operator' : 'runner'));
|
|
483
539
|
if (decision.action === 'abort')
|
|
484
540
|
break;
|
|
485
541
|
continue;
|
|
@@ -38,6 +38,7 @@ import { allAboutTheTask, isRepeat, findingId } from '../protocol/reviewSchema.j
|
|
|
38
38
|
import { repoState, workingTreePaths } from '../vcs/git.js';
|
|
39
39
|
import { describeStep, checkAccessRefusal, checkCommandRefusal, commandRefusal } from '../exec/policy.js';
|
|
40
40
|
import { networkFetchReason } from '../exec/network.js';
|
|
41
|
+
import { npmHooksNote } from '../exec/npmScripts.js';
|
|
41
42
|
import { handoffCard, handoffOutcomeOf, handoffResultMessage, HANDOFF_NOBODY, MAX_SHELL_ENDING_RETURNS, shellEndingLines, shellEndingMessage } from './handoff.js';
|
|
42
43
|
import { chosenSaid } from './chosenAnswers.js';
|
|
43
44
|
import { gitConfigMessage, watchGitConfig } from '../vcs/gitConfigGuard.js';
|
|
@@ -58,7 +59,7 @@ import { composeHandoff } from '../session/handoff.js';
|
|
|
58
59
|
import { ProgressWatch } from './progress.js';
|
|
59
60
|
import { contractConflicts, readsTreeClean } from './contract.js';
|
|
60
61
|
import { commitFiles, treeFingerprint } from '../vcs/git.js';
|
|
61
|
-
import { isContinuable, withProblemAt } from '../session/model.js';
|
|
62
|
+
import { approvedPlanOf, isContinuable, withProblemAt } from '../session/model.js';
|
|
62
63
|
import { prepareForTask, commitTaskResult, commitShortfall, repoDirOf, trackedRepoOf, whereLeft } from '../vcs/taskVcs.js';
|
|
63
64
|
import { protectInputs, inputsMessage, inputsAtCommit, untrackedInputs, blobOfFile } from '../vcs/inputs.js';
|
|
64
65
|
import { artifactPatterns, artifactState, keepArtifacts } from '../vcs/artifacts.js';
|
|
@@ -584,8 +585,13 @@ export async function enterSessionConversation(transport, session, opts) {
|
|
|
584
585
|
if (!byName) {
|
|
585
586
|
if (opts.closeOnFailure)
|
|
586
587
|
await transport.close();
|
|
587
|
-
|
|
588
|
-
|
|
588
|
+
/*
|
|
589
|
+
* A stop, as any conversation the window cannot be put back on (second bug hunt, 2026-11-19): a plain error ended
|
|
590
|
+
* the lead's message, or Kerrigan's, "failed" when the window went back to it from another conversation, telling
|
|
591
|
+
* the operator to start a new session, which the chat has none of. Continue tries it again.
|
|
592
|
+
*/
|
|
593
|
+
throw new ChatLost(session.chat.chatId, 'neither its address nor its name in the sidebar', `The conversation "${session.chat.name}" could not be opened again, by its address or by its name in Copilot's sidebar: ` +
|
|
594
|
+
'it may have been deleted in Copilot. Nothing was sent to it. Carried on with "Continue", or sent again, it is tried again; a new chat starts a fresh conversation.');
|
|
589
595
|
}
|
|
590
596
|
}
|
|
591
597
|
}
|
|
@@ -993,14 +999,6 @@ const CHAT_NOTE = [
|
|
|
993
999
|
'never rewrite history; the runner refuses those. The operator can put the folder back to before any message.',
|
|
994
1000
|
].join('\n');
|
|
995
1001
|
/** Runs one task to completion inside an already-open transport. */
|
|
996
|
-
/** The approved plan a task works to: its own attempt's, else, for a continuation, the latest one before it. */
|
|
997
|
-
function approvedPlanOf(task) {
|
|
998
|
-
if (task.plan?.approved)
|
|
999
|
-
return task.plan;
|
|
1000
|
-
if (!task.continuing)
|
|
1001
|
-
return undefined;
|
|
1002
|
-
return [...(task.attempts ?? [])].reverse().find((a) => a.plan?.approved)?.plan;
|
|
1003
|
-
}
|
|
1004
1002
|
export async function runTask(transport, session, task, deps) {
|
|
1005
1003
|
const { cfg, store, bus, authorizer, signal } = deps;
|
|
1006
1004
|
// Every attempt gets its own folder. The first keeps the original name, so nothing that
|
|
@@ -1282,9 +1280,13 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1282
1280
|
const reap = async (since, by) => {
|
|
1283
1281
|
if (!since)
|
|
1284
1282
|
return [];
|
|
1285
|
-
const result = await reapLeftovers(work.cwd, since, tracker).catch(() =>
|
|
1286
|
-
|
|
1283
|
+
const result = await reapLeftovers(work.cwd, since, tracker).catch((e) => ({ killed: [], failed: [], notOurs: [], unread: e.message }));
|
|
1284
|
+
// Not read is not "nothing left" (third hunt, 2026-11-20): said, on the record and in the run.
|
|
1285
|
+
if (result.unread) {
|
|
1286
|
+
sink.event('processes-unread', { by, why: result.unread }, `what ${by} left running could not be looked at: ${result.unread}. A server it started may still be running and holding its port.`, 'warn');
|
|
1287
|
+
await record(`LEFT RUNNING BY ${by.toUpperCase()}: NOT KNOWN`, `${result.unread}. Nothing was stopped; a server it started may still be running.`);
|
|
1287
1288
|
return [];
|
|
1289
|
+
}
|
|
1288
1290
|
if (result.notOurs.length > 0) {
|
|
1289
1291
|
sink.event('processes-not-ours', { by, count: result.notOurs.length, pids: result.notOurs.map((l) => l.pid) }, `${result.notOurs.length} new process(es) in the project folder were not started by the bot, so they were left running: ` +
|
|
1290
1292
|
result.notOurs.map((l) => `${l.name} pid ${l.pid}${l.ports.length > 0 ? ` (port ${l.ports.join(', ')})` : ''}`).join('; '), 'info');
|
|
@@ -1340,6 +1342,19 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1340
1342
|
await record(`ENDING: ${status.toUpperCase()}`, [summary ?? '', reason ? `Reason: ${reason}` : ''].filter(Boolean).join('\n\n') || '(no details)');
|
|
1341
1343
|
// The net under the plan's own checks: whatever the task left running is stopped and named.
|
|
1342
1344
|
await reap(processesBefore, 'the task');
|
|
1345
|
+
/*
|
|
1346
|
+
* The projects for reference looked at once more, after what the task left running is stopped (third hunt,
|
|
1347
|
+
* 2026-11-20): a step stopped by the operator ended the round before its look, and a server left running kept writing
|
|
1348
|
+
* after the last one — what they changed stayed changed.
|
|
1349
|
+
*/
|
|
1350
|
+
if (reference?.active) {
|
|
1351
|
+
const touched = await reference.check().catch(() => []);
|
|
1352
|
+
if (touched.length > 0) {
|
|
1353
|
+
const all = touched.every((c) => c.putBack);
|
|
1354
|
+
sink.event('reference-put-back', { end: true, changes: touched }, `at the end of the task, a project for reference only had changed, ${all ? 'put back' : 'NOT all put back'}: ${touched.map((c) => `${c.name}: ${describeChange(c)}`).join('; ')}`, all ? 'warn' : 'error');
|
|
1355
|
+
await record('REFERENCE PUT BACK AT THE END', referenceMessage(touched));
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1343
1358
|
await reference?.close().catch(() => undefined);
|
|
1344
1359
|
reference = null;
|
|
1345
1360
|
/*
|
|
@@ -1951,6 +1966,8 @@ export async function runTask(transport, session, task, deps) {
|
|
|
1951
1966
|
const openingNotes = await store.takeUnsentNotes(session.id, task.id).catch(() => []);
|
|
1952
1967
|
const opening = composeOpening({
|
|
1953
1968
|
level1,
|
|
1969
|
+
// Nothing is committed in the operator's chat: a carry-on there is not told its changes were (third hunt, 2026-11-20).
|
|
1970
|
+
...(session.vcs?.enabled ? {} : { noCommits: true }),
|
|
1954
1971
|
level2: task.level2,
|
|
1955
1972
|
prompt: task.prompt,
|
|
1956
1973
|
taskTitle: task.title,
|
|
@@ -2162,6 +2179,13 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2162
2179
|
const ran = await runChecks(checks, checkOptions);
|
|
2163
2180
|
for (const o of ran)
|
|
2164
2181
|
lastGate.set(o.check.name, { passed: o.passed, detail: o.detail });
|
|
2182
|
+
// What the checks changed in a project for reference is put back now, not blamed on the next step (third hunt, 2026-11-20).
|
|
2183
|
+
const touchedByChecks = reference?.active ? await reference.check().catch(() => []) : [];
|
|
2184
|
+
if (touchedByChecks.length > 0) {
|
|
2185
|
+
const all = touchedByChecks.every((c) => c.putBack);
|
|
2186
|
+
sink.event('reference-put-back', { checks: true, changes: touchedByChecks }, `the checks changed a project for reference only, ${all ? 'put back' : 'NOT all put back'}: ${touchedByChecks.map((c) => `${c.name}: ${describeChange(c)}`).join('; ')}`, all ? 'warn' : 'error');
|
|
2187
|
+
runnerNotes.push(referenceMessage(touchedByChecks, 'checks'));
|
|
2188
|
+
}
|
|
2165
2189
|
/*
|
|
2166
2190
|
* The operator stopped the run, which is not a verdict on the work. The check in flight was
|
|
2167
2191
|
* killed and the ones after it never ran, so what this round "found" is only the Stop: it is
|
|
@@ -2479,6 +2503,8 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2479
2503
|
deliverable,
|
|
2480
2504
|
deviations,
|
|
2481
2505
|
disputes,
|
|
2506
|
+
// The operator's notes the implementer was given, for the reviewer to judge the work by them too (third hunt, 2026-11-20).
|
|
2507
|
+
notes: ((await store.getSession(session.id).catch(() => null))?.tasks.find((x) => x.id === task.id)?.notes ?? []).filter((n) => n.sentAt).map((n) => n.text),
|
|
2482
2508
|
/*
|
|
2483
2509
|
* The approved plan, for the review to hold the work to (plan mode, 2026-10-13): this attempt's, or —
|
|
2484
2510
|
* carried on in its chat — the one the attempt it continues worked to.
|
|
@@ -2729,6 +2755,29 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2729
2755
|
* recorded as skipped. Ended `aborted` "before the review", it named a review that did not
|
|
2730
2756
|
* exist, and a batch that stops on a failure counted it as one and skipped the sessions after.
|
|
2731
2757
|
*/
|
|
2758
|
+
/*
|
|
2759
|
+
* The operator's notes not sent yet, sent before a "done" is accepted (third hunt, 2026-11-20): they went out only with
|
|
2760
|
+
* the opening and with a round's report, so a note written while the chat wrote its "done", or during the checks or
|
|
2761
|
+
* the review, was never sent once the review passed — and "where it and the task disagree, this wins". True when some
|
|
2762
|
+
* went, with the chat's answer to them in `lastMarkdown` for the loop to read.
|
|
2763
|
+
*/
|
|
2764
|
+
const sendLateNotes = async () => {
|
|
2765
|
+
const late = await store.takeUnsentNotes(session.id, task.id).catch(() => []);
|
|
2766
|
+
if (late.length === 0)
|
|
2767
|
+
return false;
|
|
2768
|
+
const message = `${operatorNotesSection(late, true)}\n\n` +
|
|
2769
|
+
'The operator wrote this before your "done" was accepted. If the work already does what it asks, say "done" again; if not, ' +
|
|
2770
|
+
'carry on with status "continue".';
|
|
2771
|
+
sink.event('operator-note-sent', { notes: late.length, with: 'before done', iteration: iterations }, `${late.length} note(s) from the operator go out before the "done" is accepted`);
|
|
2772
|
+
await record('OPERATOR NOTES BEFORE DONE — MESSAGE SENT', message);
|
|
2773
|
+
await pacer.throttleSend();
|
|
2774
|
+
const before = await transport.sendAndConfirm(message);
|
|
2775
|
+
const next = await transport.waitForReply(before);
|
|
2776
|
+
await saveReply(`notes-before-done-${iterations}`, next);
|
|
2777
|
+
lastMarkdown = next.markdown;
|
|
2778
|
+
await pacer.settle();
|
|
2779
|
+
return true;
|
|
2780
|
+
};
|
|
2732
2781
|
const settleDone = async (summary) => {
|
|
2733
2782
|
const verdict = await gateOnChecks();
|
|
2734
2783
|
if (verdict === 'stopped')
|
|
@@ -2755,8 +2804,12 @@ export async function runTask(transport, session, task, deps) {
|
|
|
2755
2804
|
const reviewed = await gateOnReview(summary);
|
|
2756
2805
|
if (reviewed === 'stopped')
|
|
2757
2806
|
return await finish('aborted', 'stopped by the operator during the review', summary, lastMarkdown);
|
|
2758
|
-
if (reviewed === 'accept')
|
|
2807
|
+
if (reviewed === 'accept') {
|
|
2808
|
+
// A note written during the checks or the review goes out, and the work is judged again on the chat's answer.
|
|
2809
|
+
if (await sendLateNotes())
|
|
2810
|
+
return null;
|
|
2759
2811
|
return await finish('done', undefined, summary, lastMarkdown);
|
|
2812
|
+
}
|
|
2760
2813
|
if (reviewed === 'give-up')
|
|
2761
2814
|
return await finish('blocked', reviewBlockedReason(), summary, lastMarkdown);
|
|
2762
2815
|
return null;
|
|
@@ -3203,6 +3256,8 @@ export async function runTask(transport, session, task, deps) {
|
|
|
3203
3256
|
return await finish('blocked', sentences(blockedReason(reply.tried, reply.needed), early), reply.summary, lastMarkdown);
|
|
3204
3257
|
}
|
|
3205
3258
|
if (done && reply.steps.length === 0) {
|
|
3259
|
+
if (await sendLateNotes())
|
|
3260
|
+
continue;
|
|
3206
3261
|
const ended = await settleDone(reply.summary);
|
|
3207
3262
|
if (ended)
|
|
3208
3263
|
return ended;
|
|
@@ -3392,6 +3447,10 @@ export async function runTask(transport, session, task, deps) {
|
|
|
3392
3447
|
sink.event('step-environment', { id: step.id, requested: result.requestedShell ?? null, available: result.shellProblem.available }, result.shellProblem.message, 'error');
|
|
3393
3448
|
break;
|
|
3394
3449
|
}
|
|
3450
|
+
// npm's "pre" and "post" scripts, left out with scripts off: said with the step's output (third hunt, 2026-11-20).
|
|
3451
|
+
const hooks = result.outcome === 'refused' ? null : npmHooksNote(step.cmd, work.cwd, effectiveShell(step.shell));
|
|
3452
|
+
if (hooks)
|
|
3453
|
+
result.stderr = `${result.stderr}${result.stderr.endsWith('\n') || !result.stderr ? '' : '\n'}[runner] ${hooks}\n`;
|
|
3395
3454
|
/*
|
|
3396
3455
|
* A project for reference only changed: put back as it was, the chat told with the step's own output, and
|
|
3397
3456
|
* the rest of the round not run — a step after it could build on what was just undone.
|