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

address review (claude): guard upsertWithId with isValidId for parity

[._.]/ Adam Eivy03843c1de67d
diff --git a/server/services/brainStorage.js b/server/services/brainStorage.js
index 2fc8ceb0da..e66c4b3a9b 100644
--- a/server/services/brainStorage.js
+++ b/server/services/brainStorage.js
@@ -394,6 +394,9 @@ export async function updateWith(type, id, fn) {
*/
export async function upsertWithId(type, id, recordData, { emitEvent = true } = {}) {
const store = storeFor(type);
+ // A malformed id can't name a valid per-record dir — mirror the other write
+ // paths and no-op rather than letting the store's write-queue assertion throw.
+ if (!store.isValidId(id)) return null;
// Resolve our instance id outside the queue (independent read); the existing
// record's origin is preferred inside the queue when one is present.
const fallbackOrigin = await getInstanceId();