fix(routines): propagate job_id to notification metadata (#1321)

Update run.job_id after execute_full_job() links the routine run to the
job, ensuring send_notification receives the actual job ID instead of None
on the normal completion path.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
Zaki
2026-03-28 19:16:03 +00:00
committed by Claude
co-authored by Claude Opus 4.6
parent d45d5977a0
commit 7b884c4a24
+2 -2
View File
@@ -1086,7 +1086,7 @@ struct EngineContext {
}
/// Execute a routine run. Handles both lightweight and full_job modes.
async fn execute_routine(ctx: EngineContext, routine: Routine, run: RoutineRun) {
async fn execute_routine(ctx: EngineContext, routine: Routine, mut run: RoutineRun) {
// Increment running count (atomic: survives panics in the execution below)
ctx.running_count.fetch_add(1, Ordering::Relaxed);
@@ -1255,7 +1255,7 @@ struct FullJobExecutionConfig<'a> {
async fn execute_full_job(
ctx: &EngineContext,
routine: &Routine,
run: &RoutineRun,
run: &mut RoutineRun,
execution: &FullJobExecutionConfig<'_>,
) -> Result<(RunStatus, Option<String>, Option<i32>), RoutineError> {
match ctx.sandbox_readiness {