Skip to content

Commit 14c8340

Browse files
committed
Fix: config cache corruption when filtering workflows by source repo
The loadAndMatchWorkflows function was mutating the cached YAMLConfig by replacing its Workflows slice with only the matching workflows. This caused subsequent webhook handlers for different source repos to see an incomplete config (only workflows from the first request). Fix: Create a shallow copy of the config before modifying the Workflows slice, preserving the cached original for future requests.
1 parent dedce1a commit 14c8340

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

services/webhook_handler_new.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,10 @@ func loadAndMatchWorkflows(ctx context.Context, config *configs.Config, containe
550550
"matching_count": len(matching),
551551
})
552552

553-
yamlConfig.Workflows = matching
554-
return yamlConfig, nil
553+
// Return a shallow copy with only matching workflows to avoid mutating the cached config
554+
filteredConfig := *yamlConfig
555+
filteredConfig.Workflows = matching
556+
return &filteredConfig, nil
555557
}
556558

557559
// fetchChangedFiles retrieves the files changed in a PR, logging and notifying on error.

0 commit comments

Comments
 (0)