fix: StepNode schema change breaks backward compat with old CAS nodes #429

Closed
opened 2026-05-23 09:41:36 +00:00 by xingyue · 1 comment
Owner

Problem

PR #427 added edgePrompt to STEP_NODE_SCHEMA. Since CAS schema hash is content-addressed, the new schema produces a different hash than the old one.

Old StepNode CAS nodes have type pointing to the old schema hash. When walkChain compares node.type !== schemas.stepNode, old nodes fail the check because schemas.stepNode is now the new hash.

This means any thread with steps created before #427 will fail to load.

Root Cause

context.ts walkChain uses strict equality node.type !== schemas.stepNode to identify step nodes. When schema evolves, old nodes become unreadable.

Fix Options

  1. Register both old and new schema, accept either hash — maintain a list of known StepNode schema hashes
  2. Use schema title matching instead of hash equality — check node.type resolves to a schema with title: "StepNode"
  3. Schema migration — rewrite old nodes with new schema (destructive, breaks CAS immutability)

Option 1 is simplest and preserves CAS integrity.

Related

  • PR #427 introduced the schema change
  • Reported by @xiaomo in PR #427 review
## Problem PR #427 added `edgePrompt` to STEP_NODE_SCHEMA. Since CAS schema hash is content-addressed, the new schema produces a different hash than the old one. Old StepNode CAS nodes have `type` pointing to the old schema hash. When `walkChain` compares `node.type !== schemas.stepNode`, old nodes fail the check because `schemas.stepNode` is now the new hash. This means **any thread with steps created before #427 will fail to load**. ## Root Cause `context.ts` walkChain uses strict equality `node.type !== schemas.stepNode` to identify step nodes. When schema evolves, old nodes become unreadable. ## Fix Options 1. **Register both old and new schema, accept either hash** — maintain a list of known StepNode schema hashes 2. **Use schema title matching instead of hash equality** — check `node.type` resolves to a schema with `title: "StepNode"` 3. **Schema migration** — rewrite old nodes with new schema (destructive, breaks CAS immutability) Option 1 is simplest and preserves CAS integrity. ## Related - PR #427 introduced the schema change - Reported by @xiaomo in PR #427 review
Author
Owner

Won't fix — internal development, no backward compat needed. Old threads can be cleaned up.

Won't fix — internal development, no backward compat needed. Old threads can be cleaned up.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#429