Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: preserve goal context in fidelity follow-ups

[._.]/ Adam Eivy679c75683ac5
diff --git a/server/lib/goalFidelityFollowUp.js b/server/lib/goalFidelityFollowUp.js
index 0d3df879bf..44726432b1 100644
--- a/server/lib/goalFidelityFollowUp.js
+++ b/server/lib/goalFidelityFollowUp.js
@@ -35,6 +35,7 @@
*/
import { firstLine, kebabCase, truncateOnBoundary } from './textUtils.js';
+import { taskObjective } from './goalFidelity.js';
/**
* Which verdicts trigger a follow-up.
@@ -255,6 +256,7 @@ export function buildGoalFidelityIssue({ task, review, fingerprint }) {
*/
export function buildGoalFidelityFollowUpTask({ task, review, fingerprint, issue = null, falsePositiveBlock = null }) {
const subject = firstLine(task?.description) || 'a CoS agent task';
+ const objective = taskObjective(task) || subject;
const header = `[Auto] Reconcile goal-fidelity ${review?.verdict} [${fingerprint}]: ${subject}`;
const claim = issue?.url
? `## If the finding is right\nClaim ${issue.number ? `#${issue.number}` : 'the filed issue'} (${issue.url}) and ship the reconciliation through the project's normal claim flow.`
@@ -262,6 +264,7 @@ export function buildGoalFidelityFollowUpTask({ task, review, fingerprint, issue
return [
header,
`## What happened\nA goal-fidelity review of the finished run for task \`${task?.id || 'unknown'}\` returned **${review?.verdict}**: the diff does not deliver the stated objective.`,
+ `## What was asked\n${objective}`,
`## Named as missing\n${bulletList(review?.missing, '_Nothing specific._')}`,
`## Named as unrequested\n${bulletList(review?.unrequested, '_Nothing specific._')}`,
falsePositiveBlock,
diff --git a/server/lib/goalFidelityFollowUp.test.js b/server/lib/goalFidelityFollowUp.test.js
index c8a42db7d1..b15f2ca427 100644
--- a/server/lib/goalFidelityFollowUp.test.js
+++ b/server/lib/goalFidelityFollowUp.test.js
@@ -256,6 +256,20 @@ describe('buildGoalFidelityFollowUpTask', () => {
expect(body).toContain('task-7');
});
+ it('carries the full bounded task objective into the investigator prompt', () => {
+ const body = buildGoalFidelityFollowUpTask({
+ task: {
+ ...task,
+ description: 'Complete the requested change',
+ metadata: { prompt: 'Also verify the shipped outcome and preserve the existing contract.' },
+ },
+ review: review(),
+ fingerprint,
+ });
+ expect(body).toContain('## What was asked\nComplete the requested change\n\nAlso verify the shipped outcome and preserve the existing contract.');
+ expect(body).toContain('Re-read the task above against what actually shipped');
+ });
+
// The fingerprint rides in the headline for the same reason the investigation
// producer's does: `addTask`'s first-line dedup is what catches a repeat whose
// metadata scan has not landed yet.