Skip to content

Commit d0ab130

Browse files
authored
Merge pull request #548 from miles990/feat/autonomy-closure-curated-evidence-detect
refactor(autonomy-closure): widen curated-memory snapshot detection to evidence lines
2 parents a5da694 + b0be018 commit d0ab130

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/autonomy-closure-diagnostics.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function diagnoseStage(stage: AutonomyClosureStageResult, ts: string): AutonomyC
169169
}
170170

171171
if (stage.stage === 'memory-state-truth') {
172-
const canSnapshotCuratedMemory = /curated memory git change\(s\) not snapshotted/i.test(stage.summary);
172+
const canSnapshotCuratedMemory = isUnsnapshottedCuratedMemoryStage(stage);
173173
return {
174174
...base,
175175
status: canSnapshotCuratedMemory ? 'mechanical-action' : 'fallback-task',
@@ -231,6 +231,11 @@ function diagnoseStage(stage: AutonomyClosureStageResult, ts: string): AutonomyC
231231
};
232232
}
233233

234+
function isUnsnapshottedCuratedMemoryStage(stage: AutonomyClosureStageResult): boolean {
235+
if (/curated memory git change\(s\) not snapshotted/i.test(stage.summary)) return true;
236+
return stage.evidence.some(line => /\b[AMDRCU? ]{1,2}\s+\S+ \((?:curated-knowledge)\)/i.test(line));
237+
}
238+
234239
function diagnosticBase(stage: AutonomyClosureStageResult, ts: string): Pick<AutonomyClosureDiagnosticCase, 'id' | 'ts' | 'stage' | 'fingerprint'> {
235240
const fingerprint = diagnosticFingerprint(stage);
236241
return {

tests/autonomy-closure-diagnostics.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,23 @@ describe('autonomy closure diagnostics', () => {
147147
}));
148148
});
149149

150+
it('recognizes unsnapshotted curated memory from evidence even when summary wording changes', () => {
151+
const cases = diagnoseAutonomyClosure(warningSnapshotWithStage({
152+
stage: 'memory-state-truth',
153+
status: 'warn',
154+
summary: 'external memory has durable edits waiting for local snapshot',
155+
evidence: [' M handoffs/active.md (curated-knowledge)'],
156+
repair: 'Commit curated memory changes locally; keep high-frequency telemetry ignored.',
157+
}));
158+
159+
expect(cases[0]).toEqual(expect.objectContaining({
160+
stage: 'memory-state-truth',
161+
status: 'mechanical-action',
162+
mechanicalAction: 'snapshot-curated-memory',
163+
fallbackTask: null,
164+
}));
165+
});
166+
150167
it('self-heals curated memory dirt while leaving high-frequency telemetry local', async () => {
151168
tmpDir = mkdtempSync(path.join(os.tmpdir(), 'mini-agent-autonomy-diagnostics-'));
152169
initGitMemory(tmpDir);

0 commit comments

Comments
 (0)