From 7efc19c8124faba73ef8fd91333cd87f756fb4ce Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 18 Jun 2026 09:25:02 +0530 Subject: [PATCH] fix: merge initial context during update workflow run --- api/db/workflow_run_client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/db/workflow_run_client.py b/api/db/workflow_run_client.py index 0389a891..3e5137f7 100644 --- a/api/db/workflow_run_client.py +++ b/api/db/workflow_run_client.py @@ -376,7 +376,12 @@ class WorkflowRunClient(BaseDBClient): if cost_info: run.cost_info = cost_info if initial_context: - run.initial_context = initial_context + # Merge initial context patches so independent call-start/runtime + # writers do not erase keys stored earlier in the run lifecycle. + run.initial_context = { + **(run.initial_context or {}), + **initial_context, + } if gathered_context: # Lets merge the incoming gathered context keys with the existing ones run.gathered_context = {