Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

chore(trust): keep importFromContent within its size ratchets (compact CEO-21 no-op view)

garrytan5fbc8068fbae
diff --git a/src/core/import-file.ts b/src/core/import-file.ts
index 71449fa296..1d6f8c8496 100644
--- a/src/core/import-file.ts
+++ b/src/core/import-file.ts
@@ -474,9 +474,7 @@ export async function importFromContent(
// formula (byte-parity pinned by test/content-hash-parity-3694.test.ts).
// Sort tags in place first to preserve the pre-#3694 downstream behavior
// (parsedPage.tags was sorted by the old inline `.sort()` mutation).
- // #5575 CEO-21: prepareFrontmatter may stamp the server's lower-only trust_tier marker; whether the write is a
- // no-op is decided on the caller's own frontmatter, so an unchanged round trip stays an unstamped no-op.
- const suppliedTrustMarker = parsed.frontmatter.trust_tier;
+ const suppliedTrustMarker = parsed.frontmatter.trust_tier; // CEO-21: the no-op check also reads the caller's own marker
if (opts.prepare) opts.prepareFrontmatter?.(parsed);
parsed.tags.sort();
const hash = contentHash({
@@ -528,9 +526,8 @@ export async function importFromContent(
&& !trustMarkerChanged(existing.frontmatter, page.frontmatter) && (existing.content_hash === hash
? !opts.prepare || sameCanonicalImport(existingSnapshot, page)
: !legacyHashMatch && await sameContentAnyKeyOrder(engine, existing, existingSnapshot?.tags ?? null, page, sourceId ?? 'default'));
- // Unchanged as stamped (the stored page already carries the marker), or as the caller sent it (the marker would be new).
- const suppliedPage: ParsedPage = { ...parsedPage, frontmatter: suppliedTrustMarkerView(parsed.frontmatter, suppliedTrustMarker) };
- const unchanged = await unchangedAs(parsedPage) || (suppliedTrustMarker !== parsed.frontmatter.trust_tier && await unchangedAs(suppliedPage));
+ const unchanged = await unchangedAs(parsedPage) || (suppliedTrustMarker !== parsed.frontmatter.trust_tier
+ && await unchangedAs({ ...parsedPage, frontmatter: suppliedTrustMarkerView(parsed.frontmatter, suppliedTrustMarker) }));
if (existing && unchanged) {
// #5050: unchanged content chunked before the safe-chunk fence is re-sealed
// projection-only; the canonical write stays a no-op.