Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ func (c *Controller) Process(ctx context.Context, item reconcile.Item) (reconcil
agentType := dispatchCtx.JobAgent.Type
span.SetAttributes(attribute.String("agent.type", agentType))

if len(result.AgentState) == 0 {
if checkErr := MaybeUpdateTargetCheck(ctx, c.getter, resultID); checkErr != nil {
span.RecordError(checkErr)
}
}
Comment on lines +77 to +81
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This initial MaybeUpdateTargetCheck call can run concurrently for multiple results belonging to the same target (worker maxConcurrency > 1 and targets can have multiple agent results). Since MaybeUpdateTargetCheck upserts via “list-by-name then create”, concurrent starts can race and create duplicate check runs / extra GitHub API traffic, and later updates may hit a non-deterministic check run ID when multiple exist. Consider adding an idempotency mechanism (e.g., persist the check_run_id per target+sha, or add a per-target lock/serialized updater, or retry create by re-listing on create failure) to ensure only one check run is created per target.

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +81
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New behavior (posting the initial in-progress GitHub check when AgentState is empty) isn’t covered by the existing unit tests in this package. Consider adding a test that asserts the “check update” path is exercised on the first Process call (e.g., have the mock Getter count calls to GetTargetContextByResultID / ListDeploymentPlanTargetResultsByTargetID and assert they’re invoked when AgentState is nil/empty).

Copilot uses AI. Check for mistakes.

planCtx, cancel := context.WithTimeout(ctx, planTimeout)
defer cancel()

Expand Down
Loading