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
39 changes: 36 additions & 3 deletions .github/workflows/agents-keepalive-loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,44 @@ jobs:
core.setOutput(key, value);
}

run-codex:
name: Keepalive next task
preflight:
name: Verify secrets available
needs: evaluate
if: needs.evaluate.outputs.action == 'run'
runs-on: ubuntu-latest
environment: agent-standard
outputs:
secrets_ok: ${{ steps.check.outputs.secrets_ok }}
steps:
- name: Check secrets
id: check
env:
HAS_CODEX_AUTH: ${{ secrets.CODEX_AUTH_JSON != '' }}
HAS_APP_ID: ${{ secrets.WORKFLOWS_APP_ID != '' }}
HAS_APP_KEY: ${{ secrets.WORKFLOWS_APP_PRIVATE_KEY != '' }}
run: |
echo "CODEX_AUTH_JSON present: $HAS_CODEX_AUTH"
echo "WORKFLOWS_APP_ID present: $HAS_APP_ID"
echo "WORKFLOWS_APP_PRIVATE_KEY present: $HAS_APP_KEY"
if [ "$HAS_CODEX_AUTH" = "true" ] || [ "$HAS_APP_ID" = "true" ]; then
echo "secrets_ok=true" >> "$GITHUB_OUTPUT"
else
echo "::error::Neither CODEX_AUTH_JSON nor WORKFLOWS_APP_ID is set. Cannot run Codex."
echo "secrets_ok=false" >> "$GITHUB_OUTPUT"
exit 1

Copilot AI Dec 24, 2025

Copy link

Choose a reason for hiding this comment

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

The preflight job sets secrets_ok=false before exit 1, but this output won't be available to dependent jobs because GitHub Actions doesn't make outputs from failed jobs available. When a job fails (exit 1), its outputs are not propagated to needs.X.outputs in dependent jobs. This means the check in run-codex for needs.preflight.outputs.secrets_ok == 'true' won't work as intended - it will be empty/undefined rather than 'false'.

If you want to use the output value to control flow, the preflight job should succeed (exit 0) in both cases and let the run-codex job decide whether to proceed based on the secrets_ok output.

Suggested change
exit 1

Copilot uses AI. Check for mistakes.
fi

run-codex:
name: Keepalive next task
needs:
- evaluate
- preflight
if: needs.evaluate.outputs.action == 'run' && needs.preflight.outputs.secrets_ok == 'true'

Copilot AI Dec 24, 2025

Copy link

Choose a reason for hiding this comment

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

The condition checking secrets_ok == 'true' is redundant because the preflight job already exits with status 1 when secrets are not available. When preflight fails, needs.preflight.result would be 'failure', which would already prevent run-codex from executing due to the default behavior (jobs don't run when their dependencies fail unless you specify if: always() or check needs.X.result).

The current condition needs.preflight.outputs.secrets_ok == 'true' will never be false in practice because preflight will fail before setting secrets_ok to false makes any difference. Consider simplifying the condition to just needs.evaluate.outputs.action == 'run', or if you want to handle a failed preflight explicitly, check needs.preflight.result == 'success' instead.

Suggested change
if: needs.evaluate.outputs.action == 'run' && needs.preflight.outputs.secrets_ok == 'true'
if: needs.evaluate.outputs.action == 'run'

Copilot uses AI. Check for mistakes.
uses: ./.github/workflows/reusable-codex-run.yml
secrets: inherit
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:
prompt_file: .github/codex/prompts/keepalive_next_task.md
mode: keepalive
Expand All @@ -138,6 +170,7 @@ jobs:
name: Update keepalive summary
needs:
- evaluate
- preflight
- run-codex
Comment on lines +173 to 174

Copilot AI Dec 24, 2025

Copy link

Choose a reason for hiding this comment

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

The summary job now depends on the preflight job, but this dependency will cause the summary job to be skipped when the preflight job is skipped (i.e., when needs.evaluate.outputs.action != 'run'). This breaks the intended behavior where the summary should run regardless of whether the preflight job executes. The summary job has if: always() which should allow it to run in all scenarios to update the keepalive status, but the hard dependency on preflight will prevent execution when preflight is skipped.

Consider removing preflight from the needs list in the summary job, since the summary doesn't actually use any outputs from preflight and should run independently to report the final state.

Suggested change
- preflight
- run-codex

Copilot uses AI. Check for mistakes.
if: always() && needs.evaluate.outputs.pr_number != '' && needs.evaluate.outputs.pr_number != '0'
runs-on: ubuntu-latest
Expand Down
Loading