@yagni-app/code-staging 1.2.7-staging.2059.1 → 1.2.7-staging.2062.1

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.
@@ -557,6 +557,15 @@ export async function runHeadlessGo(argv, deps = {}) {
557
557
  const baseSha = startTree?.head ?? "";
558
558
  const preRunDirt = startTree ? parseChangedPaths(startTree.status) : [];
559
559
  const onBase = baseSha ? { base: baseSha } : {};
560
+ // Its reviewer reads the change from that commit too (YAG-1041). A
561
+ // continuation starts past the attempt's earlier commits, so its start is
562
+ // not where the change begins: its reviewer keeps the bare `git diff`.
563
+ const reviewLane = lane && baseSha && !continuation
564
+ ? {
565
+ ...lane,
566
+ stages: lane.stages.map((s) => (s.id === "review" ? { ...s, diffBase: baseSha } : s)),
567
+ }
568
+ : lane;
560
569
  let gate;
561
570
  let lastVerify;
562
571
  // A cloud session's gate also runs the host's secret and binary scans on
@@ -606,7 +615,7 @@ export async function runHeadlessGo(argv, deps = {}) {
606
615
  ...(budget ? { budget } : {}),
607
616
  ...(deps.stages ? { stages: deps.stages } : {}),
608
617
  grounded: deps.grounded ?? grounding,
609
- ...(lane ? { lane } : {}),
618
+ ...(reviewLane ? { lane: reviewLane } : {}),
610
619
  ...(mission ? { mission } : {}),
611
620
  ...(runVerify ? { runVerify } : {}),
612
621
  ...(baseline ? { runWorkstreamCheck: makeWorkstreamCheck({ baseline }) } : {}),
@@ -50,10 +50,11 @@ export declare function builderPersonaClause(workstream?: PartitionWorkstream, s
50
50
  * Resolve the system-prompt body for a stage. For non-review stages this is the
51
51
  * role body; for the review stage it appends the lens-specific clause (or, with
52
52
  * no lens, the one-reviewer clause covering all three) and the required
53
- * findings output contract so the reviewer's output parses. A stage carrying a
54
- * `personaClause` (the fan-out builders) gets it appended last, and one
55
- * carrying a `persona` (the cloud plan stage's host persona) runs with that in
56
- * place of its agent's body.
53
+ * findings output contract so the reviewer's output parses. A review carrying
54
+ * a `diffBase` (a cloud session's) diffs from that commit in its first step. A
55
+ * stage carrying a `personaClause` (the fan-out builders) gets it appended
56
+ * last, and one carrying a `persona` (the cloud plan stage's host persona)
57
+ * runs with that in place of its agent's body.
57
58
  *
58
59
  * `grounded` defaults true (every real /go stage). The M6 eval passes
59
60
  * `grounded: false` to select the grounding-free bodies + lens clauses for the
@@ -86,12 +86,22 @@ What was done.
86
86
  Any record_decision calls you made, and why.
87
87
  ## Notes
88
88
  Anything the reviewer should know (exact file paths, key functions touched).`;
89
+ /** The reviewer's first step, which a stage's `diffBase` rewrites (see `personaBody`). */
90
+ const REVIEWER_DIFF_STEP = "1. `git diff` to see the change.";
91
+ /**
92
+ * The reviewer's first step on a change read from `base`, the commit a cloud
93
+ * session started on: its model may have committed its work, which a bare
94
+ * `git diff` no longer shows (YAG-1041).
95
+ */
96
+ function reviewerDiffStepFrom(base) {
97
+ return `1. \`git diff ${base}\` to see the change: everything this session changed since its base commit ${base}, committed or not (a bare \`git diff\` shows only what is not committed yet). \`git log ${base}..HEAD\` lists its commits, and \`git status\` lists new files git does not track yet.`;
98
+ }
89
99
  const REVIEWER_BODY = `You are a senior, adversarial code reviewer. Analyze the change for real problems, not style nits. Bash is read-only here (\`git diff\`, \`git log\`, \`git show\`); do NOT modify files or run builds.
90
100
 
91
101
  You are grounded in how THIS company works — that context is your edge over a repo-only reviewer.
92
102
 
93
103
  Strategy:
94
- 1. \`git diff\` to see the change.
104
+ ${REVIEWER_DIFF_STEP}
95
105
  2. Read the modified files and their surroundings.
96
106
  3. Judge the change through your assigned lens (below).`;
97
107
  const ADVISOR_BODY = `You are a senior advisor, brought in on ONE hard call by an agent that is already working the problem. You are the strongest model in this system and you are expensive, so you are consulted, not driven — the caller does the work, you supply the judgment.
@@ -300,7 +310,7 @@ Anything the reviewer should know (exact file paths, key functions touched).`;
300
310
  const REVIEWER_BLIND = `You are a senior, adversarial code reviewer. Analyze the change for real problems, not style nits. Bash is read-only here (\`git diff\`, \`git log\`, \`git show\`); do NOT modify files or run builds.
301
311
 
302
312
  Strategy:
303
- 1. \`git diff\` to see the change.
313
+ ${REVIEWER_DIFF_STEP}
304
314
  2. Read the modified files and their surroundings.
305
315
  3. Judge the change through your assigned lens (below).`;
306
316
  const ADVISOR_BLIND = `You are a senior advisor, brought in on ONE hard call by an agent that is already working the problem. You are the strongest model in this system and you are expensive, so you are consulted, not driven — the caller does the work, you supply the judgment.
@@ -428,10 +438,11 @@ export function builderPersonaClause(workstream, siblings = []) {
428
438
  * Resolve the system-prompt body for a stage. For non-review stages this is the
429
439
  * role body; for the review stage it appends the lens-specific clause (or, with
430
440
  * no lens, the one-reviewer clause covering all three) and the required
431
- * findings output contract so the reviewer's output parses. A stage carrying a
432
- * `personaClause` (the fan-out builders) gets it appended last, and one
433
- * carrying a `persona` (the cloud plan stage's host persona) runs with that in
434
- * place of its agent's body.
441
+ * findings output contract so the reviewer's output parses. A review carrying
442
+ * a `diffBase` (a cloud session's) diffs from that commit in its first step. A
443
+ * stage carrying a `personaClause` (the fan-out builders) gets it appended
444
+ * last, and one carrying a `persona` (the cloud plan stage's host persona)
445
+ * runs with that in place of its agent's body.
435
446
  *
436
447
  * `grounded` defaults true (every real /go stage). The M6 eval passes
437
448
  * `grounded: false` to select the grounding-free bodies + lens clauses for the
@@ -443,7 +454,10 @@ export function personaBody(stage, opts = {}) {
443
454
  const base = stage.persona?.trim() || bodies[stage.agent];
444
455
  if (!base)
445
456
  throw new Error(`No persona body for agent "${stage.agent}"`);
446
- const parts = [base];
457
+ const diffBase = stage.diffBase;
458
+ const parts = [
459
+ diffBase ? base.replace(REVIEWER_DIFF_STEP, () => reviewerDiffStepFrom(diffBase)) : base,
460
+ ];
447
461
  if (stage.id === "review") {
448
462
  const clauses = grounded ? LENS_CLAUSES : BLIND_LENS_CLAUSES;
449
463
  if (stage.lens)
@@ -72,6 +72,12 @@ export interface PipelineStage {
72
72
  * plan stage takes the host's `plan-persona.md` (Reeve's persona) here.
73
73
  */
74
74
  persona?: string;
75
+ /**
76
+ * The commit a review reads the change from (a cloud session's start,
77
+ * YAG-1041): its first step is `git diff <diffBase>`, since a model that
78
+ * commits its work leaves a bare `git diff` empty. Absent: `git diff`.
79
+ */
80
+ diffBase?: string;
75
81
  /**
76
82
  * The stage's own clock, in milliseconds (`stageClock.ts`). Past it the
77
83
  * child refuses every tool call, so the model writes its answer from what it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagni-app/code-staging",
3
- "version": "1.2.7-staging.2059.1",
3
+ "version": "1.2.7-staging.2062.1",
4
4
  "description": "YAGNI Code: a terminal coding agent that already knows your company. One YAGNI login routes the model and grounds the agent in your team's context.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "YAGNI, Inc. <jack@yagni.app> (https://yagni.app)",
@@ -58,5 +58,5 @@
58
58
  "turndown": "^7.2.4",
59
59
  "typebox": "^1.3.15"
60
60
  },
61
- "yagniSourceSha": "6e9cbb06e7ae4d5b15b14fecc749fb5fbab2e93b"
61
+ "yagniSourceSha": "a52f06325dd8542ceb7055b6fc9a7c965c8c77bd"
62
62
  }