From 6ace4ab60dc9cbe04025c5f8519726b191232a57 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 27 Mar 2025 00:13:26 +0100 Subject: [PATCH] Expire jobs if context is canceled --- core/agent/agent.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/agent/agent.go b/core/agent/agent.go index 0e3558f..cdb01f7 100644 --- a/core/agent/agent.go +++ b/core/agent/agent.go @@ -391,6 +391,13 @@ func (a *Agent) processUserInputs(job *types.Job, role string, conv Messages) Me } func (a *Agent) consumeJob(job *types.Job, role string) { + + + if err := job.GetContext().Err(); err != nil { + job.Result.Finish("expired")) + return + } + a.Lock() paused := a.pause a.Unlock()