Skip to content

Self-improving AI Employees for everyone

fix(nodespec): hide Master Skill side panels + auto-bust persisted cache

trohitg9c9489dc6a60
diff --git a/client/src/lib/nodeSpec.ts b/client/src/lib/nodeSpec.ts
index b3382aae..74acb397 100644
--- a/client/src/lib/nodeSpec.ts
+++ b/client/src/lib/nodeSpec.ts
@@ -54,15 +54,37 @@ export async function fetchNodeSpec(
});
}
+const NODESPEC_REVISION_STORAGE_KEY = 'machina-nodespec-revision';
+
/**
* Prefetch every node type the backend knows about, in a single idle
* burst at editor boot. Non-blocking — failures are swallowed so a flaky
* WS doesn't block UI. Matches Activepieces' summary+lazy pattern.
+ *
+ * Self-busts the persisted spec cache when the backend catalogue
+ * changes. The backend returns a content-hash `revision` derived from
+ * the full NodeSpec catalogue (icons, uiHints, handles, schemas);
+ * without this, persisted entries with `staleTime: FOREVER` survive
+ * server deploys and the editor keeps rendering pre-deploy shapes
+ * (e.g. masterSkill missing its `hideInputSection` hint). On revision
+ * mismatch we evict the relevant prefixes before refetching so the
+ * persistor overwrites stale localStorage entries on the next sync.
*/
export async function prefetchAllNodeSpecs(sendRequest: SendRequest): Promise<void> {
try {
const response = await sendRequest('list_node_specs', {});
const nodeTypes: string[] = response?.node_types ?? [];
+ const revision: string | undefined = response?.revision;
+
+ if (revision && typeof window !== 'undefined') {
+ const lastSeen = window.localStorage.getItem(NODESPEC_REVISION_STORAGE_KEY);
+ if (lastSeen !== revision) {
+ queryClient.removeQueries({ queryKey: ['nodeSpec'] });
+ queryClient.removeQueries({ queryKey: ['nodeGroups'] });
+ window.localStorage.setItem(NODESPEC_REVISION_STORAGE_KEY, revision);
+ }
+ }
+
await Promise.all(nodeTypes.map(t => fetchNodeSpec(t, sendRequest)));
} catch {
// Prefetch is best-effort — logged by the WS layer, not us.
diff --git a/server/nodes/skill/master_skill.py b/server/nodes/skill/master_skill.py
index 2a1555b9..f43f86dc 100644
--- a/server/nodes/skill/master_skill.py
+++ b/server/nodes/skill/master_skill.py
@@ -43,7 +43,13 @@ class MasterSkillNode(ActionNode):
{"name": "output-skill", "kind": "output", "position": "top",
"label": "Skill", "role": "skill"},
)
- ui_hints = {"isToolPanel": True, "isMasterSkillEditor": True, "hideRunButton": True}
+ ui_hints = {
+ "isToolPanel": True,
+ "isMasterSkillEditor": True,
+ "hideRunButton": True,
+ "hideInputSection": True,
+ "hideOutputSection": True,
+ }
annotations = {"destructive": False, "readonly": True, "open_world": False}
task_queue = TaskQueue.DEFAULT
diff --git a/server/routers/websocket.py b/server/routers/websocket.py
index 9c0e35d9..b5943455 100644
--- a/server/routers/websocket.py
+++ b/server/routers/websocket.py
@@ -271,11 +271,15 @@ async def handle_get_node_spec(
async def handle_list_node_specs(
data: Dict[str, Any], websocket: WebSocket
) -> Dict[str, Any]:
- """Return the sorted list of node types that have a NodeSpec.
- Editor calls this on boot to prefetch the whole set."""
- from services.node_spec import list_node_types_with_spec
+ """Return the sorted list of node types that have a NodeSpec, plus
+ a content-hash revision the editor uses to invalidate its persisted
+ spec cache when the backend catalogue changes between deploys."""
+ from services.node_spec import list_node_types_with_spec, node_spec_revision
- return {"node_types": list_node_types_with_spec()}
+ return {
+ "node_types": list_node_types_with_spec(),
+ "revision": node_spec_revision(),
+ }
@ws_handler("method")
diff --git a/server/services/node_spec.py b/server/services/node_spec.py
index 21659f18..ef25ef9d 100644
--- a/server/services/node_spec.py
+++ b/server/services/node_spec.py
@@ -24,6 +24,8 @@ This module is the single point that fuses the three sources of truth:
Wave 6 Phase 1 — see C:\\Users\\Tgroh\\.claude\\plans\\typed-splashing-crown.md.
"""
+import hashlib
+import json
from typing import Any, Optional
from models.node_metadata import fallback_metadata, get_node_metadata
@@ -38,6 +40,7 @@ from services.node_output_schemas import (
_spec_cache: dict[str, dict[str, Any]] = {}
+_revision_cache: Optional[str] = None
def get_node_spec(node_type: str) -> Optional[dict[str, Any]]:
@@ -105,6 +108,30 @@ def list_node_types_with_spec() -> list[str]:
)
+def node_spec_revision() -> str:
+ """Content hash of the full NodeSpec catalogue.
+
+ The frontend persists NodeSpec entries in localStorage with
+ ``staleTime: Infinity``; without a revision the persisted cache
+ survives backend deploys that change icons, uiHints, or handles
+ (e.g. masterSkill gaining ``hideInputSection``). The revision is
+ sent alongside ``list_node_specs`` so the editor can detect drift
+ on connect and evict stale entries before refetching.
+
+ Computed once per process and cached — restart busts. Hashes the
+ fully-assembled spec dict for every known type, sorted, so the
+ output is stable regardless of dict-iteration order. First 16 hex
+ chars are plenty to avoid collisions for our scale.
+ """
+ global _revision_cache
+ if _revision_cache is not None:
+ return _revision_cache
+ catalogue = {nt: get_node_spec(nt) for nt in list_node_types_with_spec()}
+ payload = json.dumps(catalogue, sort_keys=True, default=str).encode("utf-8")
+ _revision_cache = hashlib.sha256(payload).hexdigest()[:16]
+ return _revision_cache
+
+
def list_node_groups() -> dict[str, dict[str, Any]]:
"""Per-group index for the component palette.