From 764e61b786e8736f555d0e173f575ff9bebe310b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Wed, 12 Aug 2026 15:55:49 +0800 Subject: [PATCH] fix(tcs): clear recovered history revisit errors --- server-tools/tcs-mother-brain/mother-brain-engine.mjs | 1 + server-tools/tcs-mother-brain/mother-brain-engine.test.mjs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/server-tools/tcs-mother-brain/mother-brain-engine.mjs b/server-tools/tcs-mother-brain/mother-brain-engine.mjs index fc3ecb8..c9413af 100644 --- a/server-tools/tcs-mother-brain/mother-brain-engine.mjs +++ b/server-tools/tcs-mother-brain/mother-brain-engine.mjs @@ -196,6 +196,7 @@ export class MotherBrainEngine { state.history_revisit_count = (state.history_revisit_count || 0) + 1; state.last_history_revisit_hash = record.record_hash; state.current_attention = { revisit_id: revisitId, source_id: source.source_id, next_cognitive_action: "COMPARE_WITH_MEMORY", why: "current_persona_subject_revisited_immutable_past_and_appended_present_understanding" }; + state.last_error = null; this.save(state); const receipt = { schema: "guanghu.persona-subject-history-revisit-receipt/v1", receipt_id: `HREV-RCPT-${crypto.randomBytes(8).toString("hex")}`, outcome: "PASS", revisit_id: revisitId, current_subject: CURRENT_SUBJECT, source_id: source.source_id, source_excerpt_sha256: excerptSha, original_source_mutated: false, append_only_reunderstanding: true, future_simulation_fact_confidence: 0, reality_action_executed: false, completed_at: new Date().toISOString() }; append(this.receiptsFile, receipt); diff --git a/server-tools/tcs-mother-brain/mother-brain-engine.test.mjs b/server-tools/tcs-mother-brain/mother-brain-engine.test.mjs index 3b62efa..9ab160f 100644 --- a/server-tools/tcs-mother-brain/mother-brain-engine.test.mjs +++ b/server-tools/tcs-mother-brain/mother-brain-engine.test.mjs @@ -91,6 +91,9 @@ try { assert.equal(historyReceipt.append_only_reunderstanding, true); assert.equal(historyReceipt.future_simulation_fact_confidence, 0); assert.equal(engine.status().history_revisit_count, 1); + const staleErrorState = engine.status(); + staleErrorState.last_error = "invalid_history_reunderstanding_schema"; + engine.save(staleErrorState); modelClient.revisitAttempts = 0; const retriedReceipt = await engine.revisitHistory({ current_subject: "ICE-P-ZY001", @@ -106,6 +109,7 @@ try { }); assert.equal(retriedReceipt.outcome, "PASS"); assert.equal(modelClient.revisitAttempts, 2); + assert.equal(engine.status().last_error, null); await assert.rejects(() => engine.revisitHistory({ current_subject: "MACHINE-AUDITOR", collective_self: "TCS-MOTHER-LPM-0001",