Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

feat(core): acknowledge only handled external references [C7]

Corey Olson68600e6fbfdf
diff --git a/src/brief.js b/src/brief.js
index 3c66c266..803d93a2 100644
--- a/src/brief.js
+++ b/src/brief.js
@@ -55,6 +55,7 @@ export function briefSections(brief, { references = true } = {}) {
if (current === 'reference') {
sections.reference ??= [];
if (label[2].trim()) sections.reference.push(label[2].trim());
+ current = ''; // Only explicit Reference: lines can opt private text into acknowledgement.
} else sections[current] = label[2].trim() ? [label[2].trim()] : [];
} else if (current && line) {
sections[current].push(line.replace(/^[-*]\s+/, ''));
diff --git a/src/commands/submit.js b/src/commands/submit.js
index 4b510a8f..8a6cde56 100644
--- a/src/commands/submit.js
+++ b/src/commands/submit.js
@@ -89,6 +89,7 @@ import {
import { recordedRecovery } from '../recorded-recovery.js';
import { failureSignatures } from '../main-failure-matches.js';
import { matchingMainFailures } from '../main-failure-matches.js';
+import { submitReferenceReminders } from '../reference-lines.js';
/**
* Submit: a clean tree, nothing untracked, the gate green at HEAD, then the board (V4).
@@ -256,6 +257,7 @@ export async function submitHere(ctx, id, infra) {
// A large submit still goes through; the note only suggests a chain of smaller items (#1162).
const sizeNote = oversizeNote(measuredLines, acceptedMain.config.itemSizeBudget);
if (sizeNote) ctx.io.say(`note: ${sizeNote}`);
+ for (const reminder of submitReferenceReminders(root, held, commit)) ctx.io.err(reminder);
const report = knownMainFailures
? `submission proof red with ${knownMainFailures.failures.length} known main failure(s) at ${knownMainFailures.main}; item check green; no new failures accepted. ${submitGateReport(gate)}`
: waived
diff --git a/src/pr-publish.js b/src/pr-publish.js
index b4a420ce..d6bcfb8b 100644
--- a/src/pr-publish.js
+++ b/src/pr-publish.js
@@ -31,6 +31,7 @@ import {
verificationPulls,
} from './pr-verification.js';
import { Refused } from './refused.js';
+import { handledReferences } from './reference-lines.js';
/** Keep publisher-local transport state distinct from the shared board and legacy push state. */
function statePath(root) { return join(repoInfo(root).commonDir, 'pullboard', 'publish-pr.json'); }
@@ -73,6 +74,7 @@ function releaseEntries(root, board, base, head) {
if (!verdict) throw new Refused('PUBLISH_UNPROVEN', `item #${item.item_id} has no acceptance at its submitted commit; restore its recorded review before publishing`);
return [{ id: item.item_id, merge, commit: item.item_commit, verdict: verdict.verdict_decision,
reviewer: verdict.verdict_by, environment: verdict.environment ?? null,
+ references: handledReferences(item.item_brief),
files: git(root, ['diff', '--name-only', `${merge}^1`, merge]).split('\n').filter(Boolean) }];
});
}
@@ -82,7 +84,9 @@ function receiptBody(head, entries) {
return [`Pullboard publication head: ${head}`, '', 'Accepted item receipts:', ...entries.map(entry => {
const env = entry.environment;
const where = env ? `${env.platform}/${env.arch}, Node ${env.node}` : 'execution environment unknown (historical receipt)';
- return `- #${entry.id}: ${entry.commit}; ${entry.verdict}; reviewer ${entry.reviewer}; ${where}`;
+ const references = (entry.references ?? []).map(reference =>
+ ` Reference: ${reference.target} @${reference.handle}`);
+ return [`- #${entry.id}: ${entry.commit}; ${entry.verdict}; reviewer ${entry.reviewer}; ${where}`, ...references].join('\n');
}), '', 'The whole project gate passed at the publication head before this branch was pushed.',
'Item receipts certify their recorded accepted commits; they do not invent a second-agent verdict on this publication composition.',
'Changes outside those item receipts remain unverified by a second agent.'].join('\n');
diff --git a/src/reference-lines.js b/src/reference-lines.js
index badfb7eb..f5b52fa1 100644
--- a/src/reference-lines.js
+++ b/src/reference-lines.js
@@ -2,6 +2,32 @@
import { briefSections } from './brief.js';
import { Refused } from './refused.js';
import { ID_RE } from './spec.js';
+import { tryGit } from './git.js';
+
+/** Select only the references a maintainer explicitly chose to acknowledge. */
+export function handledReferences(brief) {
+ return referenceLines(brief).filter(reference => reference.handle !== null);
+}
+
+/** Match the target and exact handle on one changelog line, allowing ordinary Markdown links. */
+export function referenceAcknowledged(reference, lines) {
+ return lines.some(line => line.includes(reference.target)
+ && [...line.matchAll(/@([A-Za-z0-9][A-Za-z0-9-]{0,38})/gu)]
+ .some(match => match[1].toLowerCase() === reference.handle.toLowerCase()));
+}
+
+/** A reminder never prevents submission, including when historical Git evidence is unavailable. */
+export function submitReferenceReminders(root, item, commit) {
+ const references = handledReferences(item.item_brief);
+ if (!references.length) return [];
+ const diff = item.item_claim_head
+ ? tryGit(root, ['diff', '--no-ext-diff', '--no-textconv', '--unified=0', item.item_claim_head, commit, '--', 'CHANGELOG.md'])
+ : null;
+ const added = diff?.status === 0 ? diff.stdout.split('\n')
+ .filter(line => line.startsWith('+') && !line.startsWith('+++')).map(line => line.slice(1)) : [];
+ return references.filter(reference => !referenceAcknowledged(reference, added))
+ .map(reference => `changelog reminder: add an acknowledgement for ${reference.target} @${reference.handle}`);
+}
/** Preserve every reference and distinguish an explicit trailing acknowledgement from an incidental @. */
export function referenceLines(brief = '') {