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

project worktreeChangesExpected onto the archived agent so the backfill can read it (#3273)

[._.]/ Adam Eivydd721826df3f
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.js
index a9aff203b1..07b9d3147b 100644
--- a/server/services/agentLifecycle.js
+++ b/server/services/agentLifecycle.js
@@ -447,6 +447,16 @@ async function runAgentSpawn(task) {
// the proposal's domain. agent.metadata is a hand-picked projection of
// task.metadata (not a full spread), so this must be listed explicitly.
taskLiProposal: task.metadata?.liProposal || null,
+ // Same reason as taskLiProposal — a hand-picked projection, so this must be
+ // listed explicitly. `declaresNoCommitCriterion` (taskTypeHooks.js) reads it
+ // to decide whether a run declared a `[task-<id>]` commit criterion at all,
+ // and taskLearning's history backfill re-processes the ARCHIVED agent shape
+ // through that same predicate. Without the projection an archived
+ // tracker-filing run (reference-watch/ux on a github/gitlab/jira app) looks
+ // like a committing task during backfill, so its stale `validationPassed:
+ // false` fossil survives the sanitizer (#3273). `?? null` — not `|| null` —
+ // because `false` is the load-bearing value here.
+ worktreeChangesExpected: task.metadata?.worktreeChangesExpected ?? null,
taskAppName: resolvedAppName,
selfImprovementType: task.metadata?.selfImprovementType || null,
jobId: task.metadata?.jobId || null,
diff --git a/server/services/taskLearning/lifecycle.test.js b/server/services/taskLearning/lifecycle.test.js
index d9733501fc..07680de786 100644
--- a/server/services/taskLearning/lifecycle.test.js
+++ b/server/services/taskLearning/lifecycle.test.js
@@ -63,6 +63,34 @@ describe('backfillFromHistory — stale coordinator verdict (#2696)', () => {
expect(recordTaskCompletion.mock.calls[0][0].result.validationPassed).toBeNull();
});
+ it('strips the fossil for an archived tracker-filing run on a forge tracker (#3273)', async () => {
+ // A reference-watch/ux run on a github/gitlab/jira app files issues out of band
+ // and makes no commit, so its persisted `validationPassed: false` is a fossil of
+ // the same #2696 artifact. This is the ARCHIVED shape agentLifecycle projects —
+ // `taskAnalysisType` plus the explicitly-projected `worktreeChangesExpected`
+ // (a hand-picked projection: if that field ever stops being projected, this
+ // fails and the backfill silently stops stripping these).
+ agentsStore.list = ['reference-watch', 'ux'].map((t, i) => ({
+ status: 'completed', taskId: `t${i}`,
+ result: { success: true, duration: 100, validationPassed: false },
+ metadata: { taskAnalysisType: t, taskType: 'internal', worktreeChangesExpected: false },
+ }));
+ await backfillFromHistory();
+ for (const call of recordTaskCompletion.mock.calls) {
+ expect(call[0].result.validationPassed).toBeNull();
+ }
+ });
+
+ it('keeps the fossil for a tracker-filing run on a PLAN.md tracker — it really does commit', async () => {
+ agentsStore.list = [{
+ status: 'completed', taskId: 't1',
+ result: { success: true, duration: 100, validationPassed: false },
+ metadata: { taskAnalysisType: 'ux', taskType: 'internal', worktreeChangesExpected: true },
+ }];
+ await backfillFromHistory();
+ expect(recordTaskCompletion.mock.calls[0][0].result.validationPassed).toBe(false);
+ });
+
it('passes a committing type through UNTOUCHED — its commit verdict is real', async () => {
// accessibility genuinely commits; a persisted false is a real miss, not a fossil.
agentsStore.list = [completed('t1', 'accessibility', false)];