fix(keepalive): use skip input to control reusable workflow execution#111
fix(keepalive): use skip input to control reusable workflow execution#111
Conversation
…sable workflow GitHub Actions does not properly evaluate job-level conditions for reusable workflow calls when those conditions depend on outputs from dependent jobs. The condition is evaluated at workflow startup time before the outputs are available. Solution: Always call the reusable workflow but pass a 'skip' input that controls whether the job inside the reusable workflow runs: - Added 'skip' input to reusable-codex-run.yml (default: false) - Added 'if: !inputs.skip' to the codex job inside - Keepalive loop passes skip: (action != 'run') This ensures the job graph is always created, while actual execution is controlled by the skip input which is evaluated at runtime.
Automated Status SummaryHead SHA: 355dae5
Coverage Overview
Coverage Trend
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a GitHub Actions limitation where reusable workflow jobs with if conditions dependent on output values from previous jobs fail to be created in the workflow execution graph. The solution moves the conditional logic from the workflow call level into the reusable workflow itself using a skip input parameter.
Key Changes
- Added a
skipboolean input parameter to the reusable Codex workflow that controls whether the job executes - Removed the
ifcondition from therun-codexjob call in the keepalive loop workflow - The reusable workflow job is now always created in the workflow graph, but internal execution is controlled at runtime based on the
skipparameter value
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/workflows/reusable-codex-run.yml |
Added skip input parameter and if: !inputs.skip condition to the codex job to control execution from within the reusable workflow |
.github/workflows/agents-keepalive-loop.yml |
Removed conditional if statement from run-codex job call and added skip parameter passing needs.evaluate.outputs.action != 'run' |
The changes are minimal, focused, and correctly implement the described solution. The logic properly inverts the condition (skip when action is NOT 'run'), and the implementation follows GitHub Actions best practices for working around the reusable workflow evaluation timing issue.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Problem
Reusable workflow jobs with
if:conditions that depend on outputs from dependency jobs are not being created. GitHub Actions evaluates the condition at workflow startup before outputs are available.Attempts that failed
always()in condition - job still not createdEvidence
Run 20487293650 shows:
action: 'run',reason: 'ready'Keepalive next taskreferenced_workflowsshows reusable workflow IS referencedRoot Cause
GitHub Actions evaluates
if:conditions for reusable workflow calls at a different time than regular jobs. The condition cannot useneeds.*.outputs.*reliably because those are resolved before the dependent job runs.Solution
Move the conditional logic INTO the reusable workflow:
Add
skipinput toreusable-codex-run.yml:Add
if: ```{{ inputs.skip }}to thecodexjob inside the reusable workflowKeepalive loop passes:
This ensures the reusable workflow call is ALWAYS created in the job graph, while the actual execution is controlled by the skip input evaluated at runtime inside the reusable workflow.
Automated Status Summary
Scope
Tasks
Acceptance criteria
Head SHA: 42befd1
Latest Runs: ✅ success — Gate
Required: gate: ✅ success