copilot-operator 0.1.75 → 0.1.80

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.
Files changed (69) hide show
  1. package/dist/src/api/operator.controller.js +7 -4
  2. package/dist/src/api/operator.service.js +73 -20
  3. package/dist/src/config/live.js +122 -0
  4. package/dist/src/exec/commandHeads.js +11 -2
  5. package/dist/src/exec/locations.js +194 -0
  6. package/dist/src/exec/network.js +3 -1
  7. package/dist/src/exec/scriptFiles.js +46 -21
  8. package/dist/src/exec/stops.js +147 -0
  9. package/dist/src/orchestrator/chosenAnswers.js +22 -0
  10. package/dist/src/orchestrator/handoff.js +37 -2
  11. package/dist/src/orchestrator/leadRunner.js +39 -22
  12. package/dist/src/orchestrator/taskRunner.js +129 -50
  13. package/dist/src/plan/kerrigan.js +2 -2
  14. package/dist/src/plan/systemGuide.js +38 -22
  15. package/dist/src/protocol/leadSchema.js +6 -1
  16. package/dist/src/protocol/replySchema.js +6 -0
  17. package/dist/src/queue/queue.js +6 -0
  18. package/dist/src/session/model.js +12 -0
  19. package/dist/src/util/pacing.js +6 -0
  20. package/dist/web/404.html +2 -2
  21. package/dist/web/_next/static/chunks/1024-17c74da39fb738c9.js +1 -0
  22. package/dist/web/_next/static/chunks/1077.ad76ce55c8120db5.js +1 -0
  23. package/dist/web/_next/static/chunks/1548.4dc2e419eee42487.js +1 -0
  24. package/dist/web/_next/static/chunks/2163.9f5c1d052712579f.js +1 -0
  25. package/dist/web/_next/static/chunks/714.3f04498b624bc1a4.js +1 -0
  26. package/dist/web/_next/static/chunks/7220.43612a34a3cb5146.js +1 -0
  27. package/dist/web/_next/static/chunks/7921-df716a0338420836.js +1 -0
  28. package/dist/web/_next/static/chunks/8124-2f07cc63c1494443.js +1 -0
  29. package/dist/web/_next/static/chunks/8584.36fd8289becb2d75.js +1 -0
  30. package/dist/web/_next/static/chunks/895-9c1f0751920e6624.js +1 -0
  31. package/dist/web/_next/static/chunks/9067.eff8198294aec025.js +1 -0
  32. package/dist/web/_next/static/chunks/9747.43e5b7201aa505ba.js +1 -0
  33. package/dist/web/_next/static/chunks/app/layout-b8a1e0075a48b025.js +1 -0
  34. package/dist/web/_next/static/chunks/app/page-4a7cf5d83c000d73.js +1 -0
  35. package/dist/web/_next/static/chunks/app/queue/{page-82f724d0842f4870.js → page-317151444eda8115.js} +1 -1
  36. package/dist/web/_next/static/chunks/app/settings/page-ec85a538fda29964.js +1 -0
  37. package/dist/web/_next/static/chunks/{webpack-f9f820c51a8952c8.js → webpack-a7f5c4d1eda36000.js} +1 -1
  38. package/dist/web/_next/static/css/0e586e29189e8783.css +1 -0
  39. package/dist/web/defaults.html +2 -2
  40. package/dist/web/defaults.txt +8 -8
  41. package/dist/web/index.html +3 -3
  42. package/dist/web/index.txt +9 -9
  43. package/dist/web/queue.html +2 -2
  44. package/dist/web/queue.txt +9 -9
  45. package/dist/web/settings.html +2 -2
  46. package/dist/web/settings.txt +9 -9
  47. package/dist/web/system.html +2 -2
  48. package/dist/web/system.txt +9 -9
  49. package/package.json +4 -3
  50. package/prompts/lead1.md +5 -2
  51. package/prompts/level1.md +8 -2
  52. package/dist/web/_next/static/chunks/1024-67625a65f58057ae.js +0 -1
  53. package/dist/web/_next/static/chunks/1077.14d6c828d8f71111.js +0 -1
  54. package/dist/web/_next/static/chunks/1548.2f75926c6e664f79.js +0 -1
  55. package/dist/web/_next/static/chunks/2163.f9f1ad4af05520cc.js +0 -1
  56. package/dist/web/_next/static/chunks/714.4507656685cb9337.js +0 -1
  57. package/dist/web/_next/static/chunks/7220.9bc9dd9f211b11e4.js +0 -1
  58. package/dist/web/_next/static/chunks/7921-9aaec581982b2329.js +0 -1
  59. package/dist/web/_next/static/chunks/8124-a39d85dff0db6600.js +0 -1
  60. package/dist/web/_next/static/chunks/8584.f2cb3ca81223d626.js +0 -1
  61. package/dist/web/_next/static/chunks/9067.a6cb3b9157a80921.js +0 -1
  62. package/dist/web/_next/static/chunks/9747.15aa40a046d54a2a.js +0 -1
  63. package/dist/web/_next/static/chunks/9929-2e0b1d006ebd5345.js +0 -1
  64. package/dist/web/_next/static/chunks/app/layout-52a2079ffa83c21f.js +0 -1
  65. package/dist/web/_next/static/chunks/app/page-80730838a81da226.js +0 -1
  66. package/dist/web/_next/static/chunks/app/settings/page-4f3c739287d7f32e.js +0 -1
  67. package/dist/web/_next/static/css/63b30b8e1a4aa500.css +0 -1
  68. /package/dist/web/_next/static/{9DmRzBb0M5BZ3dvVpbFMM → NP3hd8WmgkJYg_cn8gcXy}/_buildManifest.js +0 -0
  69. /package/dist/web/_next/static/{9DmRzBb0M5BZ3dvVpbFMM → NP3hd8WmgkJYg_cn8gcXy}/_ssgManifest.js +0 -0
@@ -37,7 +37,8 @@ import { allAboutTheTask, isRepeat, findingId } from '../protocol/reviewSchema.j
37
37
  import { repoState, workingTreePaths } from '../vcs/git.js';
38
38
  import { describeStep, checkAccessRefusal, checkCommandRefusal, commandRefusal } from '../exec/policy.js';
39
39
  import { networkFetchReason } from '../exec/network.js';
40
- import { handoffCard, handoffOutcomeOf, handoffResultMessage, HANDOFF_NOBODY } from './handoff.js';
40
+ import { handoffCard, handoffOutcomeOf, handoffResultMessage, HANDOFF_NOBODY, MAX_SHELL_ENDING_RETURNS, shellEndingLines, shellEndingMessage } from './handoff.js';
41
+ import { chosenSaid } from './chosenAnswers.js';
41
42
  import { gitConfigMessage, watchGitConfig } from '../vcs/gitConfigGuard.js';
42
43
  import { scriptsNote } from '../exec/scriptKinds.js';
43
44
  import { collectPolicyManifest, describePolicyManifest } from '../exec/policyManifest.js';
@@ -56,7 +57,7 @@ import { composeHandoff } from '../session/handoff.js';
56
57
  import { ProgressWatch } from './progress.js';
57
58
  import { contractConflicts, readsTreeClean } from './contract.js';
58
59
  import { commitFiles, treeFingerprint } from '../vcs/git.js';
59
- import { isContinuable } from '../session/model.js';
60
+ import { isContinuable, withProblemAt } from '../session/model.js';
60
61
  import { prepareForTask, commitTaskResult, commitShortfall, repoDirOf, trackedRepoOf, whereLeft } from '../vcs/taskVcs.js';
61
62
  import { protectInputs, inputsMessage, inputsAtCommit, untrackedInputs, blobOfFile } from '../vcs/inputs.js';
62
63
  import { artifactPatterns, artifactState, keepArtifacts } from '../vcs/artifacts.js';
@@ -69,6 +70,11 @@ import { runLeadTask } from './leadRunner.js';
69
70
  * conflict decided before any message was retried twice in fresh chats).
70
71
  */
71
72
  export const NOT_THE_CHATS = ['contract-conflict', 'environment', 'invalid-check'];
73
+ /** The Settings each step is judged by: the chat is told when a save changes one under it (2026-11-03). */
74
+ const LIVE_RULES = new Set([
75
+ 'execution.allowedPrograms', 'execution.readOnlyPrograms', 'execution.runWithoutAsking', 'execution.scripts',
76
+ 'execution.writtenScripts', 'execution.networkFetch', 'execution.denyPatterns', 'execution.isolation',
77
+ ]);
72
78
  /**
73
79
  * Records a model the page offers under a new name where it was chosen — the session, or Settings — and
74
80
  * the line-up read on the way. Returns the sentence that says so, or ''.
@@ -967,6 +973,8 @@ export async function runTask(transport, session, task, deps) {
967
973
  return;
968
974
  log.event(e.type, { ...(e.data ?? {}), ...(e.message ? { message: e.message } : {}), mirrored: true }, undefined, e.level);
969
975
  });
976
+ // No longer hearing of Settings saved, once the task ends (see `tookSettings`).
977
+ let unlive = () => undefined;
970
978
  const pacer = new Pacer({
971
979
  enabled: cfg.pacing.enabled,
972
980
  settleMs: cfg.pacing.settleMs,
@@ -1049,14 +1057,19 @@ export async function runTask(transport, session, task, deps) {
1049
1057
  };
1050
1058
  transport = holdsWhilePaused(transport, () => holdHere('message'));
1051
1059
  // No message longer than Settings allow as text: the rest goes attached (2026-10-22, see `limitsMessageLength`).
1060
+ // The limit and the patterns as Settings have them when each message goes (2026-11-03: a save takes effect at once).
1052
1061
  transport = limitsMessageLength(transport, {
1053
- max: cfg.limits.maxMessageChars,
1062
+ get max() {
1063
+ return cfg.limits.maxMessageChars;
1064
+ },
1054
1065
  dir: log.path('messages'),
1055
1066
  onLong: ({ chars, max, file }) => sink.event('message-long', { chars, max, file }, `a message of ${chars} characters is over the ${max} sent as text: its beginning is sent, the whole of it attached as ${file}`, 'warn'),
1056
1067
  });
1057
1068
  // Nothing goes to the chat with a secret in it, whatever made the message (audit, 2026-10-27).
1058
1069
  transport = redactsMessages(transport, {
1059
- patterns: cfg.report.redactPatterns,
1070
+ get patterns() {
1071
+ return cfg.report.redactPatterns;
1072
+ },
1060
1073
  onRedacted: (hits) => sink.event('message-redacted', { redactions: hits }, `secrets taken out of a message before it was sent: ${hits.map((h) => `${h.name} ×${h.count}`).join(', ')}`, 'warn'),
1061
1074
  });
1062
1075
  let iterations = 0;
@@ -1076,6 +1089,8 @@ export async function runTask(transport, session, task, deps) {
1076
1089
  /** The handoff's revision, and whether the last one was sent back for a correction (2026-10-27). */
1077
1090
  let handoffRevision = 0;
1078
1091
  let handoffSentBack = false;
1092
+ // Handoffs sent back in a row because a line would end the operator's terminal (2026-11-03).
1093
+ let shellEndingReturns = 0;
1079
1094
  /**
1080
1095
  * Each handoff as it was shown and answered, kept in the run folder, so the conversation shows every revision, the
1081
1096
  * note it was sent back with and what the operator's own run printed (`session/story.ts`).
@@ -1094,15 +1109,22 @@ export async function runTask(transport, session, task, deps) {
1094
1109
  * How many different approaches "blocked" needs, from Settings, never below the format's own two.
1095
1110
  * A "blocked" with fewer is sent back; after `MAX_EARLY_BLOCKS` of them in a row with nothing tried
1096
1111
  * in between the verdict is accepted, so a chat that cannot think of anything else does not spend
1097
- * the rest of the iterations saying so.
1112
+ * the rest of the iterations saying so. Read when it is asked, as the limits below are, so a change
1113
+ * saved in Settings while the task runs is the one it goes by (2026-11-03).
1098
1114
  */
1099
- const minApproaches = Math.max(MIN_TRIED_APPROACHES, cfg.limits.minApproachesBeforeBlocked ?? MIN_TRIED_APPROACHES);
1115
+ const minApproaches = () => Math.max(MIN_TRIED_APPROACHES, cfg.limits.minApproachesBeforeBlocked ?? MIN_TRIED_APPROACHES);
1100
1116
  const MAX_EARLY_BLOCKS = 3;
1101
1117
  let earlyBlocks = 0;
1102
1118
  /** What went wrong on the way, counted for the register's figures. See `TaskStats`. */
1103
1119
  const stats = { formatErrors: 0, doneRejected: 0, repeatsRefused: 0, stepsRefused: 0, operatorStops: 0, reviewRejections: 0, scopeReverts: 0 };
1104
1120
  /** Loops the older guards do not see; see `progress.ts`. */
1105
- const progress = new ProgressWatch({ noProgress: Math.max(2, cfg.limits.maxNoProgressRounds ?? 3), oscillations: 2 });
1121
+ const progress = new ProgressWatch({
1122
+ // As Settings have it when it is asked (2026-11-03).
1123
+ get noProgress() {
1124
+ return Math.max(2, cfg.limits.maxNoProgressRounds ?? 3);
1125
+ },
1126
+ oscillations: 2,
1127
+ });
1106
1128
  /** Set when a check round shows no progress; the give-up then ends the task blocked with it. */
1107
1129
  let noProgressReason = null;
1108
1130
  /** The scope as enforced on the task's own branch, once known; `finish` holds the commit to it too. */
@@ -1365,7 +1387,8 @@ export async function runTask(transport, session, task, deps) {
1365
1387
  }
1366
1388
  }
1367
1389
  else {
1368
- afterCommitResults = outcomes.map((o) => ({ name: `${o.check.name} (after the commit)`, passed: o.passed, detail: o.detail }));
1390
+ const at = new Date().toISOString();
1391
+ afterCommitResults = outcomes.map((o) => ({ name: `${o.check.name} (after the commit)`, passed: o.passed, detail: o.detail, at }));
1369
1392
  for (const o of outcomes) {
1370
1393
  sink.event(o.passed ? 'check-passed' : 'check-failed', { name: o.check.name, detail: o.detail, afterCommit: true }, `${o.passed ? 'passed' : 'FAILED'} after the commit: ${o.check.name} — ${o.detail}`, o.passed ? 'info' : 'warn');
1371
1394
  }
@@ -1406,7 +1429,7 @@ export async function runTask(transport, session, task, deps) {
1406
1429
  }
1407
1430
  await setTask((t) => {
1408
1431
  if (vcsAfter)
1409
- t.vcs = vcsAfter;
1432
+ t.vcs = withProblemAt(t.vcs, vcsAfter);
1410
1433
  t.status = status;
1411
1434
  delete t.acting;
1412
1435
  t.iterations = iterations;
@@ -1449,6 +1472,7 @@ export async function runTask(transport, session, task, deps) {
1449
1472
  await record(`TASK ${status.toUpperCase()}`, reason ? `Reason: ${reason}` : '(no reason: it ended as reported)');
1450
1473
  sink.event('task-finished', { status, reason, iterations }, `task "${task.title}" ${status}${reason ? `: ${reason}` : ''}`);
1451
1474
  unmirror();
1475
+ unlive();
1452
1476
  await log.close();
1453
1477
  /*
1454
1478
  * An attempt that did not end done leaves its plan, work and runner views in its own folder,
@@ -1592,8 +1616,9 @@ export async function runTask(transport, session, task, deps) {
1592
1616
  for (const concern of isolation.warnings) {
1593
1617
  sink.event('isolation', { claim: isolation.claim, elevated: isolation.signals.elevated }, concern, 'warn');
1594
1618
  }
1595
- const manifest = collectPolicyManifest({
1596
- isolation,
1619
+ // The rules in force as Settings have them now: at the start, and again whenever a save changes them.
1620
+ const policyManifestNow = (assessed = isolation) => collectPolicyManifest({
1621
+ isolation: assessed,
1597
1622
  confinedTo: confinement.roots,
1598
1623
  mode: deps.currentMode?.() ?? cfg.execution.mode,
1599
1624
  networkFetch: cfg.execution.networkFetch,
@@ -1606,10 +1631,34 @@ export async function runTask(transport, session, task, deps) {
1606
1631
  cwd: work.cwd,
1607
1632
  lock: cfg.policyLock,
1608
1633
  });
1634
+ const manifest = policyManifestNow();
1609
1635
  await writeFile(log.path('policy.json'), JSON.stringify(manifest, null, 2), 'utf8').catch(() => undefined);
1610
1636
  await record('POLICY', describePolicyManifest(manifest));
1611
1637
  sink.event('policy', { mode: manifest.mode, allowlist: manifest.allowlist.enforced, allowlistDigest: manifest.allowlist.digest }, `policy: ${manifest.mode}, allowlist ${manifest.allowlist.enforced ? `${manifest.allowlist.count} programs (${manifest.allowlist.digest})` : 'NOT ENFORCED'}, ` +
1612
1638
  'the chat cannot supply files', manifest.mode === 'unattended' || !manifest.allowlist.enforced ? 'warn' : 'info');
1639
+ /*
1640
+ * Settings saved while this message is at work (operator, 2026-11-03: "when I change a setting, if it can be, let it
1641
+ * take effect at once, even while a task is running"). `cfg` has taken what can change under a message already
1642
+ * (`config/live.ts`), and every part of the task reads it where it uses it. Here the record says so, the pauses are
1643
+ * set again, the rules in force are written beside the first ones, and the chat is told with the next message — a
1644
+ * step refused before may run now, and one that ran may be refused.
1645
+ */
1646
+ let policyRevision = 1;
1647
+ const tookSettings = async (change) => {
1648
+ pacer.retune({ enabled: cfg.pacing.enabled, settleMs: cfg.pacing.settleMs, maxMessagesPerHour: cfg.pacing.maxMessagesPerHour, gapMs: gapFrom(cfg.pacing) });
1649
+ const later = [...change.next, ...change.window];
1650
+ sink.event('settings-changed', change, `Settings saved while this message runs: ${change.now.join(', ')} in force from now${later.length ? `; ${later.join(', ')} from the next message, or the next time the chat window opens` : ''}`);
1651
+ const rules = change.now.filter((name) => LIVE_RULES.has(name));
1652
+ if (rules.length === 0)
1653
+ return;
1654
+ policyRevision += 1;
1655
+ const again = policyManifestNow(assessIsolation(cfg.execution.isolation, readIsolationSignals()));
1656
+ await writeFile(log.path(`policy-${policyRevision}.json`), JSON.stringify(again, null, 2), 'utf8').catch(() => undefined);
1657
+ await record(`POLICY CHANGED (${policyRevision})`, describePolicyManifest(again));
1658
+ runnerNotes.push(`The operator changed Settings while this task runs: ${rules.map((name) => name.replace(/^execution\./, '')).join(', ')}. Every step is judged by ` +
1659
+ 'them as they are now: a step refused before for them may run now — send it again if the work needs it — and one that ran before may be refused.');
1660
+ };
1661
+ unlive = deps.live?.onChange((change) => void tookSettings(change).catch(() => undefined)) ?? unlive;
1613
1662
  // Not when the project is this runner's own checkout: every process of the runner would
1614
1663
  // then look like a leftover.
1615
1664
  processesBefore = work.ownCheckout ? null : await snapshotProcesses(work.cwd).catch(() => null);
@@ -1620,13 +1669,13 @@ export async function runTask(transport, session, task, deps) {
1620
1669
  }, () => store.listSessions());
1621
1670
  if (prepared.refuse) {
1622
1671
  await setTask((t) => {
1623
- t.vcs = prepared.vcs;
1672
+ t.vcs = withProblemAt(t.vcs, prepared.vcs);
1624
1673
  });
1625
1674
  return await finish('failed', prepared.refuse);
1626
1675
  }
1627
1676
  if (prepared.vcs.branch || prepared.vcs.problem) {
1628
1677
  await setTask((t) => {
1629
- t.vcs = prepared.vcs;
1678
+ t.vcs = withProblemAt(t.vcs, prepared.vcs);
1630
1679
  });
1631
1680
  await record('VERSION CONTROL', prepared.vcs.problem
1632
1681
  ? `not active: ${prepared.vcs.problem}`
@@ -1822,8 +1871,8 @@ export async function runTask(transport, session, task, deps) {
1822
1871
  ? `## Outputs\n\nThis task is to produce: ${(task.outputs ?? []).map((o) => `\`${o}\``).join(', ')}. What it creates or changes there is kept with the run's record as its evidence.`
1823
1872
  : '',
1824
1873
  ].filter(Boolean).join('\n\n'),
1825
- approachesNote: minApproaches > MIN_TRIED_APPROACHES
1826
- ? `## Giving up\n\nThis task may end with status "blocked" only after at least ${minApproaches} genuinely different approaches, ` +
1874
+ approachesNote: minApproaches() > MIN_TRIED_APPROACHES
1875
+ ? `## Giving up\n\nThis task may end with status "blocked" only after at least ${minApproaches()} genuinely different approaches, ` +
1827
1876
  `each listed in "tried". With fewer, the runner asks you for another approach instead of accepting it.`
1828
1877
  : undefined,
1829
1878
  shellNote: shellNote(shells, defaultShell),
@@ -1925,7 +1974,7 @@ export async function runTask(transport, session, task, deps) {
1925
1974
  // refresh the object this function is holding, so reading it back would give the state
1926
1975
  // before the checks ran and the reason would come out empty.
1927
1976
  let lastOutcomes = [];
1928
- const maxCheckRounds = Math.max(1, cfg.limits.maxCheckRounds ?? 3);
1977
+ const maxCheckRounds = () => Math.max(1, cfg.limits.maxCheckRounds ?? 3);
1929
1978
  /*
1930
1979
  * The runner's own check, when there is going to be a commit.
1931
1980
  *
@@ -2064,8 +2113,9 @@ export async function runTask(transport, session, task, deps) {
2064
2113
  pointedOut.set(o.check.expect, shown);
2065
2114
  }
2066
2115
  }
2116
+ const checkedAt = new Date().toISOString();
2067
2117
  await setTask((t) => {
2068
- t.checkResults = outcomes.map((o) => ({ name: o.check.name, passed: o.passed, detail: o.detail }));
2118
+ t.checkResults = outcomes.map((o) => ({ name: o.check.name, passed: o.passed, detail: o.detail, at: checkedAt }));
2069
2119
  });
2070
2120
  /*
2071
2121
  * The machine, not the work.
@@ -2140,7 +2190,7 @@ export async function runTask(transport, session, task, deps) {
2140
2190
  sink.event('no-progress', { kind: 'checks' }, stuck, 'warn');
2141
2191
  return 'give-up';
2142
2192
  }
2143
- if (checkRounds > maxCheckRounds) {
2193
+ if (checkRounds > maxCheckRounds()) {
2144
2194
  /*
2145
2195
  * Only checks from earlier reviews are failing. A reviewer's check is outranked by the
2146
2196
  * next reviewer's judgement, not by a counter: they are suspended, the work goes to
@@ -2153,11 +2203,11 @@ export async function runTask(transport, session, task, deps) {
2153
2203
  t.reviewChecks = reviewChecks;
2154
2204
  });
2155
2205
  derivedStillFailing = failed.map((o) => ({ name: o.check.name, detail: o.detail }));
2156
- sink.event('checks-derived-deferred', { rounds: checkRounds - 1, checks: failed.map((o) => o.check.name) }, `${failed.length} check(s) from earlier reviews still fail after ${maxCheckRounds} attempt(s); the work goes to the reviewer with them named`, 'warn');
2206
+ sink.event('checks-derived-deferred', { rounds: checkRounds - 1, checks: failed.map((o) => o.check.name) }, `${failed.length} check(s) from earlier reviews still fail after ${maxCheckRounds()} attempt(s); the work goes to the reviewer with them named`, 'warn');
2157
2207
  return 'accept';
2158
2208
  }
2159
- limitHit = { setting: 'maxCheckRounds', value: maxCheckRounds };
2160
- sink.event('checks-exhausted', { rounds: checkRounds - 1 }, `${failed.length} check(s) still failing after ${maxCheckRounds} attempt(s); the task is closed as failed`, 'warn');
2209
+ limitHit = { setting: 'maxCheckRounds', value: maxCheckRounds() };
2210
+ sink.event('checks-exhausted', { rounds: checkRounds - 1 }, `${failed.length} check(s) still failing after ${maxCheckRounds()} attempt(s); the task is closed as failed`, 'warn');
2161
2211
  return 'give-up';
2162
2212
  }
2163
2213
  // A Stop that came after every check had run: the round stands, and nothing more is sent.
@@ -2175,7 +2225,7 @@ export async function runTask(transport, session, task, deps) {
2175
2225
  const checkReport = failureReport(outcomes, cfg.report.redactPatterns);
2176
2226
  await writeFile(path, checkReport, 'utf8');
2177
2227
  await record(`CHECKS ${checkRounds}`, checkReport);
2178
- const message = failureMessage(outcomes, checkRounds, maxCheckRounds, cfg.report.redactPatterns);
2228
+ const message = failureMessage(outcomes, checkRounds, maxCheckRounds(), cfg.report.redactPatterns);
2179
2229
  await record(`CHECKS ${checkRounds} MESSAGE SENT`, message);
2180
2230
  // Said as a step report's redaction is, so a checks round that hid something is not silent.
2181
2231
  const redactions = failureRedactions(outcomes, cfg.report.redactPatterns);
@@ -2214,10 +2264,10 @@ export async function runTask(transport, session, task, deps) {
2214
2264
  /** What the previous review's own steps left running, told to both sides. */
2215
2265
  let previousLeftovers = [];
2216
2266
  const reviewWanted = task.reviewEnabled ?? session.review?.enabled ?? true;
2217
- const maxReviewRounds = Math.max(1, cfg.limits.maxReviewRounds ?? 2);
2267
+ const maxReviewRounds = () => Math.max(1, cfg.limits.maxReviewRounds ?? 2);
2218
2268
  const saveReview = async (review) => {
2219
2269
  await setTask((t) => {
2220
- t.review = review;
2270
+ t.review = { ...review, at: new Date().toISOString() };
2221
2271
  });
2222
2272
  };
2223
2273
  /**
@@ -2260,7 +2310,7 @@ export async function runTask(transport, session, task, deps) {
2260
2310
  // the reviewer is given it — as claims to test. See `Deliverable` in review.ts.
2261
2311
  const deliverable = deliverableFor(task, closing, repoDir !== '' || chatChanged !== null, changedFiles);
2262
2312
  await actingNow('review', { round: reviewRounds });
2263
- sink.event('review-started', { round: reviewRounds, model: model || '(the session model)', files: changedFiles.length, deliverable: deliverable?.why }, `an independent review is opening a fresh conversation (round ${reviewRounds} of ${maxReviewRounds})` +
2313
+ sink.event('review-started', { round: reviewRounds, model: model || '(the session model)', files: changedFiles.length, deliverable: deliverable?.why }, `an independent review is opening a fresh conversation (round ${reviewRounds} of ${maxReviewRounds()})` +
2264
2314
  (deliverable ? `; the closing summary goes with it as the product (${deliverable.why})` : ''));
2265
2315
  // What is running before the review, so that what the review leaves is its own.
2266
2316
  const beforeReview = processesBefore ? await snapshotProcesses(work.cwd, processesBefore.since).catch(() => null) : null;
@@ -2495,9 +2545,9 @@ export async function runTask(transport, session, task, deps) {
2495
2545
  * was then blocked quoting that finding as "still there" without anybody having looked
2496
2546
  * at the fix. It had been fixed.
2497
2547
  */
2498
- if (reviewRounds > maxReviewRounds) {
2499
- limitHit = { setting: 'maxReviewRounds', value: maxReviewRounds };
2500
- sink.event('review-exhausted', { rounds: maxReviewRounds, findings: outcome.findings.length }, `the review still has findings after ${maxReviewRounds} round(s) of fixing; the task is closed as blocked`, 'warn');
2548
+ if (reviewRounds > maxReviewRounds()) {
2549
+ limitHit = { setting: 'maxReviewRounds', value: maxReviewRounds() };
2550
+ sink.event('review-exhausted', { rounds: maxReviewRounds(), findings: outcome.findings.length }, `the review still has findings after ${maxReviewRounds()} round(s) of fixing; the task is closed as blocked`, 'warn');
2501
2551
  return 'give-up';
2502
2552
  }
2503
2553
  sink.event('review-failed', { round: reviewRounds, findings: outcome.findings.length }, `the review found ${outcome.findings.length} problem(s); sending them back to be fixed`, 'warn');
@@ -2507,7 +2557,7 @@ export async function runTask(transport, session, task, deps) {
2507
2557
  await pacer.throttleSend();
2508
2558
  // The reviewer quotes output in its evidence, so the message gets the same treatment.
2509
2559
  // Recorded as sent, because what reached the chat is what the next question is about.
2510
- const findingsSent = redactSecrets(findingsMessage(outcome, reviewRounds, maxReviewRounds, repeatedNamed, roundLeftovers), cfg.report.redactPatterns);
2560
+ const findingsSent = redactSecrets(findingsMessage(outcome, reviewRounds, maxReviewRounds(), repeatedNamed, roundLeftovers), cfg.report.redactPatterns);
2511
2561
  await writeFile(log.path('review', String(reviewRounds), 'findings-sent.md'), findingsSent, 'utf8').catch(() => undefined);
2512
2562
  await record(`REVIEW ${reviewRounds} FINDINGS SENT`, findingsSent);
2513
2563
  const before = await transport.sendAndConfirm(findingsSent);
@@ -2529,7 +2579,7 @@ export async function runTask(transport, session, task, deps) {
2529
2579
  ? `an independent review found ${findings.length} problem(s) with the task itself rather than with the work, ` +
2530
2580
  `so there was nothing to send back for fixing: ${listed}`
2531
2581
  : `an independent review found ${findings.length} problem(s) that were still there after ` +
2532
- `${maxReviewRounds} round(s) of fixing: ${listed}`;
2582
+ `${maxReviewRounds()} round(s) of fixing: ${listed}`;
2533
2583
  };
2534
2584
  /**
2535
2585
  * What a reported "done" comes to: the checks, then the review, either of which may end the
@@ -2589,8 +2639,8 @@ export async function runTask(transport, session, task, deps) {
2589
2639
  * in a circle, and the thing that turns into a task that ends rather than a task that times
2590
2640
  * out.
2591
2641
  */
2592
- const maxCommandRepeats = Math.max(1, cfg.limits.maxCommandRepeats ?? 3);
2593
- const maxStalledIterations = Math.max(1, cfg.limits.maxStalledIterations ?? 2);
2642
+ const maxCommandRepeats = () => Math.max(1, cfg.limits.maxCommandRepeats ?? 3);
2643
+ const maxStalledIterations = () => Math.max(1, cfg.limits.maxStalledIterations ?? 2);
2594
2644
  /**
2595
2645
  * Per command: how many times in a row it has returned exactly the same thing.
2596
2646
  *
@@ -2733,7 +2783,29 @@ export async function runTask(transport, session, task, deps) {
2733
2783
  * agreement or not: only their own run of it has anything to say. With nobody to ask, the chat is told so. What
2734
2784
  * they printed, or that they did not run it, goes back, and the work goes on.
2735
2785
  */
2786
+ if (reply.status !== 'handoff')
2787
+ shellEndingReturns = 0;
2736
2788
  if (reply.status === 'handoff' && reply.handoff) {
2789
+ /*
2790
+ * A line that would end the terminal it is typed in — `exit`, the chat's habit for passing on an exit code — goes
2791
+ * back to the chat before the operator sees it (2026-11-03): typed into their open terminal, it closed it, and what
2792
+ * it printed with it. Twice at most; then the card shows it, marked, and the operator decides.
2793
+ */
2794
+ const ending = shellEndingLines(reply.handoff);
2795
+ if (ending.length > 0 && shellEndingReturns < MAX_SHELL_ENDING_RETURNS) {
2796
+ shellEndingReturns += 1;
2797
+ sink.event('handoff-ends-shell', { lines: ending.map((l) => l.n), time: shellEndingReturns }, `the commands handed over would close the operator's terminal (line ${ending.map((l) => l.n).join(', ')}): sent back to the chat, ${shellEndingReturns}/${MAX_SHELL_ENDING_RETURNS}`, 'warn');
2798
+ const message = shellEndingMessage(ending);
2799
+ await record('HANDOFF SENT BACK — IT WOULD CLOSE THE TERMINAL', message);
2800
+ await pacer.throttleSend();
2801
+ const before = await transport.sendAndConfirm(message);
2802
+ const next = await transport.waitForReply(before);
2803
+ await saveReply(`handoff-ends-shell-${shellEndingReturns}`, next);
2804
+ lastMarkdown = next.markdown;
2805
+ await pacer.settle();
2806
+ continue;
2807
+ }
2808
+ shellEndingReturns = 0;
2737
2809
  // The next revision of the one sent back for a correction; otherwise the first of a new one (2026-10-27).
2738
2810
  handoffRevision = handoffSentBack ? handoffRevision + 1 : 1;
2739
2811
  handoffSentBack = false;
@@ -2790,6 +2862,8 @@ export async function runTask(transport, session, task, deps) {
2790
2862
  const options = reply.options;
2791
2863
  const agree = cfg.execution.questions === 'agree' || !deps.askQuestion;
2792
2864
  let answer = options[0].answer;
2865
+ // A question of several answers (2026-11-02): the ones the operator chose, and what they wrote besides.
2866
+ let many;
2793
2867
  if (agree) {
2794
2868
  sink.event('question-agreed', { question, answer, why: cfg.execution.questions === 'agree' ? 'settings' : 'nobody to ask' }, `the chat asked: ${question} — answered as it recommends (${cfg.execution.questions === 'agree' ? 'Settings agree with what the bot proposes' : 'nobody is there to ask'}): ${answer}`);
2795
2869
  }
@@ -2805,6 +2879,7 @@ export async function runTask(transport, session, task, deps) {
2805
2879
  ...(reply.why?.trim() ? { why: reply.why.trim() } : {}),
2806
2880
  options: options.map((o) => o.answer),
2807
2881
  commands: options.map((o) => o.run ?? null),
2882
+ ...(reply.multiple ? { multiple: true } : {}),
2808
2883
  actor: planning ? 'plan' : 'worker',
2809
2884
  });
2810
2885
  await setTask((t) => {
@@ -2813,10 +2888,12 @@ export async function runTask(transport, session, task, deps) {
2813
2888
  if (got === 'stop' || signal?.aborted)
2814
2889
  return await finish('aborted', 'stopped by the operator at its question', undefined, lastMarkdown);
2815
2890
  answer = got.answer;
2816
- sink.event('question-answered', { question, answer }, `the operator answered: ${answer}`);
2891
+ if (got.chosen)
2892
+ many = { chosen: got.chosen, ...(got.written ? { written: got.written } : {}) };
2893
+ sink.event('question-answered', { question, answer, ...(many ? { chosen: many.chosen } : {}) }, `the operator answered: ${answer}`);
2817
2894
  }
2818
2895
  await record('QUESTION', `${question}\n\nAnswer${agree ? ' (as the chat recommends)' : ''}: ${answer}`);
2819
- const chosen = options.find((o) => o.answer === answer);
2896
+ const chosen = many ? undefined : options.find((o) => o.answer === answer);
2820
2897
  if (chosen?.run) {
2821
2898
  // Run as this reply's one step: through the step loop below, its output reported as any step's.
2822
2899
  chosenRun = agree && deps.askQuestion === undefined ? null : chosen.run.trim();
@@ -2827,8 +2904,10 @@ export async function runTask(transport, session, task, deps) {
2827
2904
  'The runner ran the command that answer carries — step 1 below, its output with it. Go on from there.');
2828
2905
  }
2829
2906
  else {
2830
- const message = `${agree ? 'The runner took your recommended answer' : 'The operator answered your question'} ("${question}"): "${answer}".\n\n` +
2831
- 'Go on with the work from here, in the same format.';
2907
+ const message = many
2908
+ ? `The operator answered your question ("${question}"), ${chosenSaid(many)}\n\nGo on with the work from here, in the same format.`
2909
+ : `${agree ? 'The runner took your recommended answer' : 'The operator answered your question'} ("${question}"): "${answer}".\n\n` +
2910
+ 'Go on with the work from here, in the same format.';
2832
2911
  await record('ANSWER', message);
2833
2912
  await pacer.throttleSend();
2834
2913
  const before = await transport.sendAndConfirm(message);
@@ -2957,7 +3036,7 @@ export async function runTask(transport, session, task, deps) {
2957
3036
  await pacer.settle();
2958
3037
  continue;
2959
3038
  }
2960
- if (blocked && reply.tried.length < minApproaches && earlyBlocks < MAX_EARLY_BLOCKS) {
3039
+ if (blocked && reply.tried.length < minApproaches() && earlyBlocks < MAX_EARLY_BLOCKS) {
2961
3040
  /*
2962
3041
  * Too early to give up, by the operator's own measure (Settings → Execution). Sent back as a
2963
3042
  * request for another approach rather than accepted: the format only knows that two is the
@@ -2965,8 +3044,8 @@ export async function runTask(transport, session, task, deps) {
2965
3044
  */
2966
3045
  earlyBlocks += 1;
2967
3046
  stats.blockedTooEarly = (stats.blockedTooEarly ?? 0) + 1;
2968
- sink.event('blocked-too-early', { tried: reply.tried.length, needed: minApproaches, time: earlyBlocks }, `"blocked" after ${reply.tried.length} approach(es); Settings ask for ${minApproaches}, so the chat is asked for another`, 'warn');
2969
- const message = `Not yet. This task is given up only after at least ${minApproaches} genuinely different approaches, and your reply lists ` +
3047
+ sink.event('blocked-too-early', { tried: reply.tried.length, needed: minApproaches(), time: earlyBlocks }, `"blocked" after ${reply.tried.length} approach(es); Settings ask for ${minApproaches()}, so the chat is asked for another`, 'warn');
3048
+ const message = `Not yet. This task is given up only after at least ${minApproaches()} genuinely different approaches, and your reply lists ` +
2970
3049
  `${reply.tried.length}: ${reply.tried.map((x, i) => `(${i + 1}) ${x}`).join(' ')}. Try a different approach now — not one of ` +
2971
3050
  'these again, and not the same command reworded — and send its steps with status "continue". If it fails too, add it to ' +
2972
3051
  '"tried" and try another. Nothing you listed is lost: the runner keeps what has been tried.';
@@ -2981,8 +3060,8 @@ export async function runTask(transport, session, task, deps) {
2981
3060
  }
2982
3061
  if (blocked) {
2983
3062
  sink.event('task-blocked', { tried: reply.tried, needed: reply.needed }, `the task was given up as blocked after ${reply.tried.length} approach(es)`, 'warn');
2984
- const early = reply.tried.length < minApproaches
2985
- ? `It gave up after ${reply.tried.length} of the ${minApproaches} approaches Settings ask for, having been asked ${earlyBlocks} time(s) for another.`
3063
+ const early = reply.tried.length < minApproaches()
3064
+ ? `It gave up after ${reply.tried.length} of the ${minApproaches()} approaches Settings ask for, having been asked ${earlyBlocks} time(s) for another.`
2986
3065
  : '';
2987
3066
  return await finish('blocked', sentences(blockedReason(reply.tried, reply.needed), early), reply.summary, lastMarkdown);
2988
3067
  }
@@ -3060,7 +3139,7 @@ export async function runTask(transport, session, task, deps) {
3060
3139
  const key = fingerprint(step);
3061
3140
  const last = seen.get(key);
3062
3141
  let ran = last?.sameInARow ?? 0;
3063
- if (ran >= maxCommandRepeats && last) {
3142
+ if (ran >= maxCommandRepeats() && last) {
3064
3143
  // Something changed since it last ran — the tree, or (without a tree to compare) another step ran: not a repeat.
3065
3144
  const nowTree = await treeNow();
3066
3145
  const changed = last.tree !== null && nowTree !== null ? last.tree !== nowTree : stepsRunThisAttempt > last.stepNo;
@@ -3069,11 +3148,11 @@ export async function runTask(transport, session, task, deps) {
3069
3148
  ran = 0;
3070
3149
  }
3071
3150
  }
3072
- if (ran >= maxCommandRepeats) {
3151
+ if (ran >= maxCommandRepeats()) {
3073
3152
  repeatsRefused += 1;
3074
3153
  stats.repeatsRefused += 1;
3075
- sink.event('step-repeated', { id: step.id, count: ran, limit: maxCommandRepeats, command: describeStep(step) }, `step ${step.id} refused: already run ${ran} time(s) in this task with the same result`, 'warn');
3076
- results.push(refusedResult(step, repeatRefusal(ran, maxCommandRepeats)));
3154
+ sink.event('step-repeated', { id: step.id, count: ran, limit: maxCommandRepeats(), command: describeStep(step) }, `step ${step.id} refused: already run ${ran} time(s) in this task with the same result`, 'warn');
3155
+ results.push(refusedResult(step, repeatRefusal(ran, maxCommandRepeats())));
3077
3156
  continue;
3078
3157
  }
3079
3158
  await setTask((t) => {
@@ -3153,7 +3232,7 @@ export async function runTask(transport, session, task, deps) {
3153
3232
  const previous = seen.get(key);
3154
3233
  const sameInARow = previous && previous.signature === signature ? previous.sameInARow + 1 : 1;
3155
3234
  // The tree is read only for a command at the limit, the one case it is asked about.
3156
- seen.set(key, { signature, sameInARow, tree: sameInARow >= maxCommandRepeats ? await treeNow() : null, stepNo: stepsRunThisAttempt });
3235
+ seen.set(key, { signature, sameInARow, tree: sameInARow >= maxCommandRepeats() ? await treeNow() : null, stepNo: stepsRunThisAttempt });
3157
3236
  sink.event('step-finished', { id: step.id, outcome: result.outcome, exitCode: result.exitCode, durationMs: result.durationMs, shell: result.shell, requestedShell: result.requestedShell ?? null, shellPath: result.shellPath ?? '' }, `step ${step.id}: ${result.outcome}, exit ${result.exitCode}, ${(result.durationMs / 1000).toFixed(1)}s`);
3158
3237
  /*
3159
3238
  * Stopped while it ran. The signal is looked at before each step, and after the last one
@@ -3313,10 +3392,10 @@ export async function runTask(transport, session, task, deps) {
3313
3392
  const allNamedAMissingShell = repeatsRefused === 0;
3314
3393
  if (reply.steps.length > 0 && refusedEverything === reply.steps.length) {
3315
3394
  stalled += 1;
3316
- sink.event('iteration-stalled', { stalled, limit: maxStalledIterations }, `every step this iteration ${allRepeats ? 'was a repeat' : allNamedAMissingShell ? 'named a shell this machine has not got' : 'was a repeat or named a shell this machine has not got'} (${stalled}/${maxStalledIterations})`, 'warn');
3317
- if (stalled >= maxStalledIterations) {
3395
+ sink.event('iteration-stalled', { stalled, limit: maxStalledIterations() }, `every step this iteration ${allRepeats ? 'was a repeat' : allNamedAMissingShell ? 'named a shell this machine has not got' : 'was a repeat or named a shell this machine has not got'} (${stalled}/${maxStalledIterations()})`, 'warn');
3396
+ if (stalled >= maxStalledIterations()) {
3318
3397
  const repeated = [...seen.entries()]
3319
- .filter(([, v]) => v.sameInARow >= maxCommandRepeats)
3398
+ .filter(([, v]) => v.sameInARow >= maxCommandRepeats())
3320
3399
  .map(([cmd]) => cmd.slice(0, 120));
3321
3400
  return await finish('blocked', allRepeats
3322
3401
  ? `the same command(s) were sent again after being refused for repetition, ${stalled} iteration(s) running, ` +
@@ -3351,7 +3430,7 @@ export async function runTask(transport, session, task, deps) {
3351
3430
  if (repeatsRefused > 0) {
3352
3431
  covering +=
3353
3432
  `\n\n${repeatsRefused} of the ${reply.steps.length} step(s) were not run: they repeat a command ` +
3354
- `that has already run ${maxCommandRepeats} time(s) in this task with the same result. ` +
3433
+ `that has already run ${maxCommandRepeats()} time(s) in this task with the same result. ` +
3355
3434
  'Change the approach rather than the wording. If nothing else is left to try, end with ' +
3356
3435
  'status "blocked" and say in "tried" what you attempted.';
3357
3436
  }
@@ -192,7 +192,7 @@ These are the program's foundations. They come with it, the program holds Copilo
192
192
 
193
193
  ## Two chats: a lead and a worker
194
194
 
195
- It is a choice, not the new way: without it the chat works as it always has, one conversation doing the work, which is enough for most messages. With ${Q('chat.lead')} ticked for a new conversation, the message goes to a **lead** instead of straight to the one who works. The lead is a Copilot conversation that runs nothing itself. It restates the assignment to check it understands it, has a **worker** — a second conversation in the same Copilot window — survey the project, and makes a plan (approved by the person first when ${Q('chat.planMode')} is ticked). Then it gives the worker one subtask at a time — read files, run the tests, reproduce, debug, change code — and judges every report against its evidence, until the result is ready in the form the assignment asked for. It asks the person only what nobody else can decide, on a card in the conversation (${Q('lead.send')}), and the work waits for the answer. It may give at most ${n(f.maxSubtasks ?? 20)} subtasks for one message. A subtask cut off for a technical reason — the chat broke off, a command could not be started — is tried again under the same number, as Settings say under "Retrying an interrupted subtask": by default a card asks, with ${Q('retry.same')}, ${Q('retry.fresh')} and ${Q('retry.accept')}; one that may have changed files half way is never tried again without asking, and work that was not done goes back to the lead. After ${Q('chat.stop')} nothing restarts by itself: under the subtask that did not finish, ${Q('retry.same')} carries the message on from it, with the plan and the subtasks done kept. Use it for a complex task that should go as far as it can without a person. It works only as well as the assignment says what is wanted, so help them write it in full:
195
+ It is a choice, not the new way: without it the chat works as it always has, one conversation doing the work, which is enough for most messages. With ${Q('chat.lead')} ticked for a new conversation, the message goes to a **lead** instead of straight to the one who works. The lead is a Copilot conversation that runs nothing itself. It restates the assignment to check it understands it, has a **worker** — a second conversation in the same Copilot window — survey the project, and makes a plan (approved by the person first when ${Q('chat.planMode')} is ticked). Then it gives the worker one subtask at a time — read files, run the tests, reproduce, debug, change code — and judges every report against its evidence, until the result is ready in the form the assignment asked for. It asks the person only what nobody else can decide, on a card in the conversation (${Q('lead.send')}; ${Q('chat.sendChosen')} when it lets more than one answer be chosen), and the work waits for the answer. It may give at most ${n(f.maxSubtasks ?? 20)} subtasks for one message. A subtask cut off for a technical reason — the chat broke off, a command could not be started — is tried again under the same number, as Settings say under "Retrying an interrupted subtask": by default a card asks, with ${Q('retry.same')}, ${Q('retry.fresh')} and ${Q('retry.accept')}; one that may have changed files half way is never tried again without asking, and work that was not done goes back to the lead. After ${Q('chat.stop')} nothing restarts by itself: under the subtask that did not finish, ${Q('retry.same')} carries the message on from it, with the plan and the subtasks done kept. Use it for a complex task that should go as far as it can without a person. It works only as well as the assignment says what is wanted, so help them write it in full:
196
196
 
197
197
  - **Goal** — what is to be achieved, and why.
198
198
  - **The result, and its exact form** — every field, in order, and what each holds. For example, a defect report: title, description, system info, preconditions (if any), expected result, actual result, steps to reproduce, acceptance criteria, test scenario, short description, severity, project.
@@ -286,7 +286,7 @@ function bgText(f) {
286
286
 
287
287
  ## Два чата: ръководител и изпълнител
288
288
 
289
- Това е избор, а не новият начин: без него чатът работи както винаги — един разговор, който върши работата, и това стига за повечето съобщения. Когато за нов разговор е отметнато ${Q('chat.lead')}, съобщението отива при **ръководител**, а не направо при този, който работи. Ръководителят е разговор в Copilot, който сам не изпълнява нищо. Той преразказва заданието, за да провери, че го разбира, пуска **изпълнител** — втори разговор в същия прозорец на Copilot — да огледа проекта и прави план (първо одобрен от човека, когато ${Q('chat.planMode')} е отметнат). После дава на изпълнителя по една подзадача — да прочете файлове, да пусне тестовете, да възпроизведе, да дебъгва, да промени код — и преценява всеки доклад по доказателствата му, докато резултатът стане готов във вида, който заданието иска. Пита човека само това, което никой друг не може да реши, на карта в разговора (${Q('lead.send')}), и работата чака отговора. Може да даде най-много ${n(f.maxSubtasks ?? 20)} подзадачи за едно съобщение. Подзадача, прекъсната по техническа причина — чатът прекъснал, команда, която не е могла да започне, — се опитва отново под същия номер, както казват Настройки в „Повторение на прекъсната подзадача“: по подразбиране пита карта, с ${Q('retry.same')}, ${Q('retry.fresh')} и ${Q('retry.accept')}; такава, която може да е променила файлове по средата, никога не се повтаря без питане, а несвършената работа отива при ръководителя. След ${Q('chat.stop')} нищо не се рестартира само: под незавършилата подзадача ${Q('retry.same')} продължава съобщението от нея, като планът и завършените подзадачи се пазят. Ползва се за сложна задача, която трябва да стигне колкото може по-далеч без човек. Работи толкова добре, колкото заданието казва какво се иска, затова помогни то да се напише изцяло:
289
+ Това е избор, а не новият начин: без него чатът работи както винаги — един разговор, който върши работата, и това стига за повечето съобщения. Когато за нов разговор е отметнато ${Q('chat.lead')}, съобщението отива при **ръководител**, а не направо при този, който работи. Ръководителят е разговор в Copilot, който сам не изпълнява нищо. Той преразказва заданието, за да провери, че го разбира, пуска **изпълнител** — втори разговор в същия прозорец на Copilot — да огледа проекта и прави план (първо одобрен от човека, когато ${Q('chat.planMode')} е отметнат). После дава на изпълнителя по една подзадача — да прочете файлове, да пусне тестовете, да възпроизведе, да дебъгва, да промени код — и преценява всеки доклад по доказателствата му, докато резултатът стане готов във вида, който заданието иска. Пита човека само това, което никой друг не може да реши, на карта в разговора (${Q('lead.send')}; ${Q('chat.sendChosen')}, когато позволява да се избере повече от един отговор), и работата чака отговора. Може да даде най-много ${n(f.maxSubtasks ?? 20)} подзадачи за едно съобщение. Подзадача, прекъсната по техническа причина — чатът прекъснал, команда, която не е могла да започне, — се опитва отново под същия номер, както казват Настройки в „Повторение на прекъсната подзадача“: по подразбиране пита карта, с ${Q('retry.same')}, ${Q('retry.fresh')} и ${Q('retry.accept')}; такава, която може да е променила файлове по средата, никога не се повтаря без питане, а несвършената работа отива при ръководителя. След ${Q('chat.stop')} нищо не се рестартира само: под незавършилата подзадача ${Q('retry.same')} продължава съобщението от нея, като планът и завършените подзадачи се пазят. Ползва се за сложна задача, която трябва да стигне колкото може по-далеч без човек. Работи толкова добре, колкото заданието казва какво се иска, затова помогни то да се напише изцяло:
290
290
 
291
291
  - **Цел** — какво трябва да се постигне и защо.
292
292
  - **Резултатът и точният му вид** — всяко поле, по реда му, и какво съдържа. Например доклад за дефект: заглавие, описание, информация за системата, предусловия (ако има), очакван резултат, действителен резултат, стъпки за възпроизвеждане, критерии за приемане, тестов сценарий, кратко описание, сериозност, проект.