mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-18 15:50:25 +02:00
fix(memory): distinguish incomplete reads from missing records
Independent local Codex review PASS at 73b07f8d17, no P0/P1. Independent 66 tests and strict validation of 810 skills passed. CI run 34683976362 passed; all 48 current checks green. Incomplete memory reads fail closed with safe MCP diagnostics; canonical guidance synchronized across harness skill copies. Rollback: revert this squash commit. No deployment or installation claim.
This commit is contained in:
@@ -659,6 +659,11 @@ function readMemoryById(id, options = {}) {
|
||||
? validateSlug(options.targetHarness, 'target harness')
|
||||
: null;
|
||||
const loaded = readMemoryFiles(options);
|
||||
if (loaded.truncated || loaded.invalidFileCount > 0) {
|
||||
const error = new Error('Memory lookup is incomplete. Inspect the authorized vault before retrying.');
|
||||
error.code = 'ECC_MEMORY_INCOMPLETE';
|
||||
throw error;
|
||||
}
|
||||
const matches = loaded.entries
|
||||
.filter(entry => entry.memory.id === memoryId)
|
||||
.filter(entry => (
|
||||
|
||||
+10
-1
@@ -210,6 +210,15 @@ function textResult(payload) {
|
||||
}
|
||||
|
||||
function toolFailure(code, error) {
|
||||
if (code === 'MEMORY_READ_FAILED' && error?.code === 'ECC_MEMORY_INCOMPLETE') {
|
||||
return {
|
||||
...textResult({ error: {
|
||||
code: 'MEMORY_READ_INCOMPLETE',
|
||||
message: 'Memory lookup is incomplete. Inspect the authorized vault before retrying.',
|
||||
} }),
|
||||
isError: true,
|
||||
};
|
||||
}
|
||||
const suspectedSecret = error instanceof Error
|
||||
&& error.message.toLowerCase().includes('suspected secret');
|
||||
const message = suspectedSecret
|
||||
@@ -217,7 +226,7 @@ function toolFailure(code, error) {
|
||||
: {
|
||||
MEMORY_WRITE_REJECTED: 'Memory write was rejected by validation.',
|
||||
MEMORY_SEARCH_FAILED: 'Memory search failed validation.',
|
||||
MEMORY_READ_FAILED: 'Memory was not found or is not visible to this harness.',
|
||||
MEMORY_READ_FAILED: 'Memory could not be read. It may be missing, not visible, or invalid.',
|
||||
MEMORY_DOCTOR_FAILED: 'Memory doctor could not inspect the authorized vault.',
|
||||
}[code] || 'Memory operation failed.';
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user