Fail a run whose ai_runs row is saved after the skill timeout
runOnce checked the deadline only before saving the row. The save can wait for the store's single writer, so a run whose work ended in time could return success after its timeout. Check the deadline again once the row is saved and return llm.ErrTimeout when it has passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -186,6 +186,12 @@ func runOnce[In, Out any](ctx context.Context, cfg Config, s Skill[In, Out], tim
|
||||
if err != nil {
|
||||
return zero, err
|
||||
}
|
||||
// The save may wait past the deadline for the store's single writer.
|
||||
// The run has then not ended in time, so it fails, though its row
|
||||
// records the work's outcome as it stood before the save.
|
||||
if !time.Now().Before(deadline) {
|
||||
return zero, expired
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user