[Bug]: Edge condition context lets buffer keys shadow the result/true/false builtins, causing wrong graph routing
EdgeSpec._evaluate_condition() in core/framework/orchestrator/edge.py builds the evaluation context for a CONDITIONAL edge, then unpacks the data buffer into it last:
context = {
"output": output,
"buffer": buffer_data,
"result": output.get("result"),
"true": True,
"false": False,
**buffer_data, # unpacked last, so buffer keys override everything above
}Because **buffer_data comes last, any buffer key with the same name as a framework builtin silently overrides it. result is the common case: nodes routinely emit a result into the buffer, so a later edge that references result gets the buffer's (possibly stale) value instead of the current node's output, which is what the explicit "result": output.get("result") line just above is trying to provide. A buffer key named true, false, output, or buffer breaks those too.
Repro:
output = {"result": "NEW"}
buffer_data = {"result": "OLD", "true": 0}
context = {"output": output, "buffer": buffer_data, "result": output.get("result"),
"true": True, "false": False, **buffer_data}
assert context["result"] == "OLD" # not "NEW": current output shadowed by buffer
assert context["true"] == 0 # the True builtin clobbered
# so an edge condition `result == "NEW"` evaluates False and the edge is skippedExpected: the framework builtins (output, buffer, result, true, false) take precedence; buffer keys stay directly accessible but cannot clobber the reserved names.
Actual: a buffer key of the same name overrides the builtin, so conditional edges route on stale or wrong values.
Fix: unpack **buffer_data first, then set the five builtins after it.
Source: aden-hive/hive