Skip to content

JobMonitor: preserve source metadata from job properties when resubmitting Helix work items#16908

Draft
Copilot wants to merge 5 commits into
mainfrom
copilot/jobmonitor-fix-resubmitted-items
Draft

JobMonitor: preserve source metadata from job properties when resubmitting Helix work items#16908
Copilot wants to merge 5 commits into
mainfrom
copilot/jobmonitor-fix-resubmitted-items

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

Resubmitted Helix jobs from JobMonitor were missing SDK-populated source metadata (Repository, Branch, SourcePrefix, TeamProject). This change aligns resubmission payload construction with Helix SDK submissions by using source metadata from the original job property bag, without parsing Source.

  • Source metadata handling

    • Use the original job property bag values (SourcePrefix, TeamProject, Repository, Branch) when constructing the resubmission JobCreationRequest.
    • Avoid sending both Source and source-component fields together.
  • Compatibility fallback

    • If source metadata is missing from the property bag, keep current behavior by setting Source directly.
  • Targeted test coverage

    • Keep coverage asserting all source-component fields are preserved from properties.
    • Update coverage so that when source metadata properties are missing, resubmission falls back to Source passthrough (no Source parsing fallback).
if (TryGetSourceMetadataFromProperties(details.Properties, out string sourcePrefix, out string teamProject, out string repository, out string branch))
{
    creationRequest.SourcePrefix = sourcePrefix;
    creationRequest.TeamProject = teamProject;
    creationRequest.Repository = repository;
    creationRequest.Branch = branch;
}
else
{
    creationRequest.Source = details.Source;
}

To double check:

Copilot AI review requested due to automatic review settings May 28, 2026 15:00
Copilot AI review requested due to automatic review settings May 28, 2026 15:00
Copilot AI linked an issue May 28, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot May 28, 2026 15:05
Copilot AI changed the title [WIP] Fix missing metadata in resubmitted work items JobMonitor: preserve source metadata when resubmitting Helix work items May 28, 2026
Copilot AI requested a review from mmitche May 28, 2026 15:08
premun
premun previously approved these changes Jun 2, 2026
@mmitche
Copy link
Copy Markdown
Member

mmitche commented Jun 2, 2026

@copilot Look into how job properties are structured. I believe that all of the source properties you're trying to parse are part of the property bag.

Copilot AI review requested due to automatic review settings June 2, 2026 16:30
Copilot AI review requested due to automatic review settings June 2, 2026 16:30
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 16:32
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot Look into how job properties are structured. I believe that all of the source properties you're trying to parse are part of the property bag.

Updated to source these fields from the original job property bag first, then fall back to parsing Source, then to Source passthrough. Addressed in commits 0ac825f and e04b7cb.

Copilot AI changed the title JobMonitor: preserve source metadata when resubmitting Helix work items JobMonitor: preserve source metadata from job properties when resubmitting Helix work items Jun 2, 2026
@mmitche
Copy link
Copy Markdown
Member

mmitche commented Jun 2, 2026

@copilot Do NOT fall back to parsing source.

Copilot AI review requested due to automatic review settings June 2, 2026 16:42
Copilot AI review requested due to automatic review settings June 2, 2026 16:43
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot Do NOT fall back to parsing source.

Addressed in caa8529. I removed the Source parsing fallback from JobMonitor resubmission; it now uses source metadata only from the job property bag, and otherwise falls back to passing Source through unchanged.

};
if (TryGetSourceMetadataFromProperties(details.Properties, out string sourcePrefix, out string teamProject, out string repository, out string branch))
{
creationRequest.SourcePrefix = sourcePrefix;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot Why would the source not also be set here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because Helix rejects requests that include both Source and any of SourcePrefix/TeamProject/Repository/Branch (400). We mirror the SDK behavior here: use the split source fields when available; otherwise set Source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JobMonitor: Resubmitted work items are submitted with missing info

3 participants