Skip to content

Add background step deferral infrastructure and metadata plumbing - #4479

Merged
lokesh755 merged 2 commits into
mainfrom
lokesh755-flush-deferred-data
Jun 4, 2026
Merged

Add background step deferral infrastructure and metadata plumbing#4479
lokesh755 merged 2 commits into
mainfrom
lokesh755-flush-deferred-data

Conversation

@lokesh755

@lokesh755lokesh755 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the deferral mechanism and metadata plumbing needed for background step execution. Background steps buffer their outputs, environment variables, and path changes instead of writing to shared state directly — these are flushed to the job context at wait time on the main thread.

Changes

  • ExecutionContext.cs — Adds DeferredOutputs, DeferredEnvironmentVariables, DeferredPrependPath, DeferOutcomeConclusion properties with corresponding FlushDeferred*() methods. Adds SetBackgroundStepMetadata() for timeline record metadata. Guards UpdateGlobalStepsContext behind DeferOutcomeConclusion flag.
  • FileCommandManager.csGITHUB_OUTPUT, GITHUB_ENV, and GITHUB_PATH file commands check for deferred collections and buffer writes when running as a background step.
  • JobServerQueue.csMergeTimelineRecords preserves background step metadata fields (IsBackground, BackgroundControlType, BackgroundControlStepIds, ParallelGroupId).

Related to https://github.com/github/c2c-actions/issues/9534

CopilotAI review requested due to automatic review settings June 4, 2026 21:25
@lokesh755
lokesh755 requested a review from a team as a code ownerJune 4, 2026 21:25
Comment threadsrc/Runner.Worker/ExecutionContext.cs
Comment threadsrc/Runner.Worker/FileCommandManager.cs

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds infrastructure to support “background step” execution by deferring side effects (outputs, env vars, PATH changes, and outcome/conclusion propagation) and by plumbing background-step metadata through timeline record merging and step result reporting.

Changes:

  • Introduces deferred collections and FlushDeferred*() APIs on IExecutionContext/ExecutionContext, and gates UpdateGlobalStepsContext() behind DeferOutcomeConclusion.
  • Updates GITHUB_OUTPUT, GITHUB_ENV, and GITHUB_PATH file commands to buffer into deferred collections when present.
  • Updates timeline record merge logic to preserve background-step metadata fields.
Show a summary per file
FileDescription
src/Runner.Worker/FileCommandManager.csBuffers output/env/path file-command effects into deferred collections when running in a background-step context.
src/Runner.Worker/ExecutionContext.csAdds deferral properties and flush APIs; defers global steps context updates; attempts to emit background metadata in StepResult.
src/Runner.Common/JobServerQueue.csPreserves background-step metadata when merging multiple timeline record updates.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment threadsrc/Runner.Worker/ExecutionContext.cs
Comment threadsrc/Runner.Worker/ExecutionContext.cs
Comment threadsrc/Runner.Worker/ExecutionContext.cs
@lokesh755
lokesh755 merged commit fb78489 into mainJun 4, 2026
12 checks passed
@lokesh755
lokesh755 deleted the lokesh755-flush-deferred-data branch June 4, 2026 21:45
Sign up for freeto 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.

3 participants

@lokesh755@TingluoHuang