Skip to content

Commit 2bc5530

Browse files
authored
AC-859: Clean the stale instrument LLM prompt/TODO path (#1223)
* chore(ac-859): delete the unused opt-out prompt and stale Layer 8 TODOs The per-file opt-out tip prompt (spec site 2) was exported from prompts.ts and re-exported through the barrel but never wired: only site 1 (rationale) and site 3 (session summary) reach enhance(). Delete FILE_OPT_OUT_TIP_PROMPT + FileOptOutTipContext, their barrel re-exports, and their test block. The pr-body-renderer TODO(A2-I Layer 8) markers said 'replace with enhancer.enhance(...)', but both sites already call enhance({ defaultNarrative, ... }) with the default template as the fallback, so the hookup is done. Remove the stale TODOs and the header line claiming TODO markers remain; note that site 2 is spec-described but unimplemented. npm run lint passes. * chore(ac-859): finish removing stale Layer 8 commentary (PR #1223 review) Two comments still described the pre-Layer-8 state: the pr-body-renderer section header called these 'the three LLM enhancement sites' (only two are implemented), and the instrument barrel said Layer 8 'lands next; its hooks are wired as no-ops ... with TODO markers.' Layer 8 has landed and the TODOs were removed in this PR. Update both to match. Comment-only.
1 parent 00ca67b commit 2bc5530

5 files changed

Lines changed: 19 additions & 81 deletions

File tree

ts/src/control-plane/instrument/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Public barrel for A2-I `autoctx instrument` tool infrastructure.
33
*
4-
* Layers 1 + 2 + 3 + 4 + 5 + 6 + 7 — contract + scanner + safety + registry +
5-
* planner + pipeline + cli. (Layer 8 — LLM enhancer — lands next; its hooks
6-
* are wired as no-ops in pipeline/pr-body-renderer.ts with TODO markers.)
4+
* Layers 1 through 8: contract, scanner, safety, registry, planner, pipeline,
5+
* cli, and the LLM enhancer. The enhancer wires `enhance()` at the two
6+
* implemented narrative sites in pipeline/pr-body-renderer.ts.
77
*
88
* Name-collision resolution:
99
* - `parseDirectives` is exported from BOTH `safety/` (canonical Buffer form)

ts/src/control-plane/instrument/llm/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
*/
44
export {
55
RATIONALE_PROMPT,
6-
FILE_OPT_OUT_TIP_PROMPT,
76
SESSION_SUMMARY_PROMPT,
87
type RationaleContext,
9-
type FileOptOutTipContext,
108
type SessionSummaryContext,
119
} from "./prompts.js";
1210

ts/src/control-plane/instrument/llm/prompts.ts

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
* `--prompt-template-dir` override (spec §2 deferred items) but NOT shipped
88
* in A2-I.
99
*
10-
* All three sites described in spec §10.1:
10+
* Prompts ship for the two enhancement sites A2-I implements (spec §10.1):
1111
* 1. Per-call-site rationale (italic line under each before/after snippet)
12-
* 2. Per-file opt-out tip (hint box when a file looks unusual)
1312
* 3. Session summary (top-of-`pr-body.md` paragraph)
13+
*
14+
* Site 2 (per-file opt-out tip) is described in the spec but not implemented
15+
* in A2-I; its prompt is intentionally absent rather than shipped unused.
1416
*/
1517

1618
export interface RationaleContext {
@@ -21,13 +23,6 @@ export interface RationaleContext {
2123
readonly afterSnippet: string;
2224
}
2325

24-
export interface FileOptOutTipContext {
25-
readonly filePath: string;
26-
readonly language: string;
27-
/** Heuristic signals detected about this file (e.g. "looks-like-test-file"). */
28-
readonly heuristicSignals: readonly string[];
29-
}
30-
3126
export interface SessionSummaryContext {
3227
readonly filesAffected: number;
3328
readonly callSitesWrapped: number;
@@ -66,42 +61,14 @@ export function RATIONALE_PROMPT(ctx: RationaleContext): string {
6661
].join("\n");
6762
}
6863

69-
/**
70-
* Per-file opt-out tip prompt (spec §10.1 site 2).
71-
*
72-
* Suggests an opt-out path when a file looks unusual (test file not in
73-
* excludes, synthetic-traffic generator, etc). Output is a single short
74-
* hint (one or two sentences) that will surface in a dedicated hint box
75-
* in `pr-body.md`.
76-
*/
77-
export function FILE_OPT_OUT_TIP_PROMPT(ctx: FileOptOutTipContext): string {
78-
const signals = ctx.heuristicSignals.length
79-
? ctx.heuristicSignals.join(", ")
80-
: "none";
81-
return [
82-
"You are a helpful coding assistant reviewing an instrumentation plan.",
83-
`File: ${ctx.filePath}`,
84-
`Language: ${ctx.language}`,
85-
`Heuristic signals: ${signals}`,
86-
"",
87-
"This file looks unusual for instrumentation. Write a single short hint",
88-
"(one or two sentences) suggesting how to opt out if that wasn't intended.",
89-
"Mention both path-level (`.gitignore` or `--exclude`) and file-level",
90-
"(`# autocontext: off-file`) approaches. Keep it actionable and terse.",
91-
"Output only the hint prose — no preamble, no markdown headings.",
92-
].join("\n");
93-
}
94-
9564
/**
9665
* Session summary prompt (spec §10.1 site 3).
9766
*
9867
* Asks for a one-paragraph overview for the top of `pr-body.md`. Highlights
9968
* anything notable (e.g., "two files were skipped due to secret literals").
10069
*/
10170
export function SESSION_SUMMARY_PROMPT(ctx: SessionSummaryContext): string {
102-
const plugins = ctx.registeredPluginIds.length
103-
? ctx.registeredPluginIds.join(", ")
104-
: "(none)";
71+
const plugins = ctx.registeredPluginIds.length ? ctx.registeredPluginIds.join(", ") : "(none)";
10572
return [
10673
"You are writing a one-paragraph summary of an autocontext instrumentation session.",
10774
`Files affected: ${ctx.filesAffected}`,

ts/src/control-plane/instrument/pipeline/pr-body-renderer.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
* the output is machine-parseable by downstream CI-review tooling.
66
*
77
* LLM enhancement discipline (spec §10):
8-
* - Three narrative sites total: per-call-site rationale, per-file opt-out
9-
* tips, session summary.
10-
* - A2-I wires a static default for EACH site. Layer 8 replaces the
11-
* `defaultRationale`/`defaultSummary` calls with LLM-enhanced variants
12-
* when `enhancer.enhance(default, ctx)` returns non-null; on any failure
13-
* the default is used silently.
14-
* - This file contains TODO markers at each site for the Layer 8 hookup.
8+
* - Two narrative sites are implemented: per-call-site rationale and session
9+
* summary. (Spec site 2, the per-file opt-out tip, is not implemented.)
10+
* - Each site computes a static default (`defaultRationale`/`defaultSummary`)
11+
* and passes it to `enhance({ defaultNarrative, ... })`, which returns the
12+
* LLM-enhanced variant when enabled and non-empty, or the default on any
13+
* failure or when disabled.
1514
*
1615
* Byte-determinism (spec §9.4):
1716
* - `pr-body.md` is NOT byte-deterministic when LLM enhancement is enabled.
@@ -281,14 +280,13 @@ export async function renderPrBody(inputs: PrBodyInputs): Promise<string> {
281280
}
282281

283282
// ---------------------------------------------------------------------------
284-
// Default narrative templates (the three LLM enhancement sites)
283+
// Default narrative templates (the two LLM enhancement sites)
285284
// ---------------------------------------------------------------------------
286285

287286
/**
288287
* Default single-paragraph session summary. Grouping by SDK keeps readers
289-
* oriented when multiple plugins ran in one invocation.
290-
*
291-
* TODO(A2-I Layer 8): replace with `enhancer.enhance(defaultSummary(ctx), ctx)`.
288+
* oriented when multiple plugins ran in one invocation. Used as the
289+
* `defaultNarrative` fallback for the session-summary enhancement site.
292290
*/
293291
function defaultSummary(inputs: PrBodyInputs): string {
294292
const sdkCounts = new Map<string, number>();
@@ -307,9 +305,8 @@ function defaultSummary(inputs: PrBodyInputs): string {
307305

308306
/**
309307
* Default per-call-site rationale. Spec §10.4 says narrative explains what
310-
* the change does + why; the default is terse-but-accurate.
311-
*
312-
* TODO(A2-I Layer 8): replace with `enhancer.enhance(defaultRationale(ctx), ctx)`.
308+
* the change does + why; the default is terse-but-accurate. Used as the
309+
* `defaultNarrative` fallback for the per-call-site rationale enhancement site.
313310
*/
314311
function defaultRationale(file: PerFileDetailedEdits, edit: EditDescriptor): string {
315312
const sdk = file.sdkBreakdown[0]?.sdkName ?? "LLM client";

ts/tests/control-plane/instrument/llm/prompts.test.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { describe, test, expect } from "vitest";
22
import {
33
RATIONALE_PROMPT,
4-
FILE_OPT_OUT_TIP_PROMPT,
54
SESSION_SUMMARY_PROMPT,
65
} from "../../../../src/control-plane/instrument/llm/prompts.js";
76

@@ -34,29 +33,6 @@ describe("RATIONALE_PROMPT", () => {
3433
});
3534
});
3635

37-
describe("FILE_OPT_OUT_TIP_PROMPT", () => {
38-
test("includes heuristic signals and mentions both opt-out mechanisms", () => {
39-
const out = FILE_OPT_OUT_TIP_PROMPT({
40-
filePath: "tests/test_llm.py",
41-
language: "python",
42-
heuristicSignals: ["looks-like-test-file"],
43-
});
44-
expect(out).toContain("tests/test_llm.py");
45-
expect(out).toContain("looks-like-test-file");
46-
expect(out).toMatch(/\.gitignore|--exclude/);
47-
expect(out).toMatch(/autocontext: off/);
48-
});
49-
50-
test("handles empty heuristic signals list", () => {
51-
const out = FILE_OPT_OUT_TIP_PROMPT({
52-
filePath: "x.py",
53-
language: "python",
54-
heuristicSignals: [],
55-
});
56-
expect(out).toContain("none");
57-
});
58-
});
59-
6036
describe("SESSION_SUMMARY_PROMPT", () => {
6137
test("includes counts and plugin list", () => {
6238
const out = SESSION_SUMMARY_PROMPT({

0 commit comments

Comments
 (0)