From 42befd1fadd26ee9ed2da7f0bbecc44f170197c0 Mon Sep 17 00:00:00 2001 From: stranske Date: Wed, 24 Dec 2025 13:42:42 +0000 Subject: [PATCH] fix(keepalive): use skip input instead of job-level condition for reusable 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. --- .github/workflows/agents-keepalive-loop.yml | 2 +- .github/workflows/reusable-codex-run.yml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/agents-keepalive-loop.yml b/.github/workflows/agents-keepalive-loop.yml index 93f67ebcd..4e904798f 100644 --- a/.github/workflows/agents-keepalive-loop.yml +++ b/.github/workflows/agents-keepalive-loop.yml @@ -151,13 +151,13 @@ jobs: name: Keepalive next task needs: - evaluate - if: ${{ always() && needs.evaluate.result == 'success' && needs.evaluate.outputs.action == 'run' }} uses: ./.github/workflows/reusable-codex-run.yml secrets: CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }} WORKFLOWS_APP_ID: ${{ secrets.WORKFLOWS_APP_ID }} WORKFLOWS_APP_PRIVATE_KEY: ${{ secrets.WORKFLOWS_APP_PRIVATE_KEY }} with: + skip: ${{ needs.evaluate.outputs.action != 'run' }} prompt_file: .github/codex/prompts/keepalive_next_task.md mode: keepalive pr_number: ${{ needs.evaluate.outputs.pr_number }} diff --git a/.github/workflows/reusable-codex-run.yml b/.github/workflows/reusable-codex-run.yml index ebd634ce1..076ac1acb 100644 --- a/.github/workflows/reusable-codex-run.yml +++ b/.github/workflows/reusable-codex-run.yml @@ -3,6 +3,11 @@ name: Reusable Codex Run on: workflow_call: inputs: + skip: + description: 'If true, skip execution entirely. Used for conditional calls.' + required: false + default: false + type: boolean prompt_file: description: 'Path to the prompt file that Codex should read.' required: true @@ -62,6 +67,7 @@ jobs: runs-on: ubuntu-latest environment: agent-standard timeout-minutes: ${{ inputs.max_runtime_minutes }} + if: ${{ !inputs.skip }} outputs: final-message: ${{ steps.run_codex.outputs.final-message }} steps: