Store response.<node_id> in context after each LLM node

Downstream nodes in multi-model pipelines reference response.<node_id>
context keys in their prompts. The codergen handler was only storing
last_response (truncated) and last_stage, so these references resolved
to nothing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-02-23 22:12:29 -05:00
parent 28cdefec67
commit 7222da1230

View file

@ -246,6 +246,10 @@ impl Handler for CodergenHandler {
"last_response".to_string(),
serde_json::json!(truncate(&response_text, 200)),
);
outcome.context_updates.insert(
format!("response.{}", node.id),
serde_json::json!(&response_text),
);
// 7b. Parse routing directives from response text
extract_status_fields(&response_text, &mut outcome);
@ -375,6 +379,10 @@ mod tests {
Some(&serde_json::json!("step"))
);
assert!(outcome.context_updates.contains_key("last_response"));
assert_eq!(
outcome.context_updates.get("response.step"),
Some(&serde_json::json!("[Simulated] Response for stage: step"))
);
}
#[test]