Skip to content

feat: Add neutral job conclusion via allow-failure property#4405

Draft
atkinsonm wants to merge 1 commit intoactions:mainfrom
atkinsonm:feat/allow-failure-neutral-conclusion
Draft

feat: Add neutral job conclusion via allow-failure property#4405
atkinsonm wants to merge 1 commit intoactions:mainfrom
atkinsonm:feat/allow-failure-neutral-conclusion

Conversation

@atkinsonm
Copy link
Copy Markdown

Summary

  • Adds TaskResult.Neutral (value 6) and ActionResult.Neutral (value 4) enum values
  • Adds AllowFailure boolean property to AgentJobRequestMessage
  • When a job fails and allow-failure is set, the runner reports Neutral instead of Failed
  • Includes ACTIONS_ALLOW_FAILURE env var fallback for testing without server changes
  • Adds unit tests covering merge behavior, return code translation, and the override logic

Why

The Checks API supports a neutral conclusion (renders as a grey dash icon), but GitHub Actions provides no way for a job to report it. This means non-critical checks (linting, spell-checking, advisory security scans) must either pass or fail — there's no "warning" state.

This PR implements the runner-side support for a neutral conclusion via a job-level allow-failure property, similar in spirit to Travis CI's allow_failures matrix config. When the server populates AllowFailure = true on the job message, the runner converts FailedNeutral at job completion time.

Related: #2347

Server-side requirements (out of scope for this PR)

For end-to-end functionality, the server needs to:

  1. Parse allow-failure: true from workflow YAML
  2. Set AllowFailure = true on AgentJobRequestMessage
  3. Accept TaskResult.Neutral (value 6) and map it to Checks API conclusion: neutral
  4. Treat neutral as non-blocking for downstream needs: dependencies

Design decisions

  • Override location: CompleteJobAsync() after jobContext.Complete() — same pattern as other post-completion transforms
  • Neutral is terminal: MergeTaskResults() already handles this correctly since Neutral = 6 > Failed = 2, so the existing if (currentResult > TaskResult.Failed) guard treats it as terminal
  • Env var fallback: ACTIONS_ALLOW_FAILURE=true allows testing the runner behavior in isolation without server changes

Test plan

  • Unit tests added for:
    • AllowFailure message property converts Failed → Neutral
    • AllowFailure does not affect Succeeded jobs
    • ACTIONS_ALLOW_FAILURE env var fallback works
    • Both CompleteJobAsync overloads (IRunServer + IJobServer) are covered
    • TaskResult.Neutral round-trips through return code translation
    • TaskResult.Neutral maps to ActionResult.Neutral
    • Neutral is terminal in merge logic (not overwritten by subsequent results)
  • End-to-end testing requires server-side changes (env var fallback demonstrates runner behavior in isolation)

🤖 Generated with Claude Code

Add TaskResult.Neutral (value 6) and ActionResult.Neutral (value 4) to
allow jobs to report a neutral/warning conclusion to the Checks API.

When a job fails and allow-failure is set (via message property or
ACTIONS_ALLOW_FAILURE env var), the runner reports Neutral instead of
Failed. The server maps this to the Checks API "neutral" conclusion,
which renders as a grey dash icon rather than a red X.

Changes:
- TaskResult enum: add Neutral = 6
- ActionResult enum: add Neutral = 4
- TaskResultUtil: add Neutral mapping in ToActionResult()
- AgentJobRequestMessage: add AllowFailure bool property
- JobRunner: override Failed → Neutral in both CompleteJobAsync overloads
- Tests: cover merge behavior, return code translation, and allow-failure
  logic for both message property and env var fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@atkinsonm atkinsonm force-pushed the feat/allow-failure-neutral-conclusion branch from 2e6d7d2 to 06f335f Compare May 6, 2026 18:23
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.

1 participant