Repository navigation
fix(actions): report failures before the agent starts #9206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
waynesun09
merged 25 commits into
fullsend-ai:main
from
csoceanu:codex/1297-pre-agent-failure-notifications
Nov 19, 2026
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
50f475e
fix(actions): report pre-agent startup failures
csoceanu 19038f1
fix(actions): harden startup failure reporting
csoceanu ed40040
fix(actions): harden startup failure fallback
csoceanu 88b005b
fix(actions): address startup failure review findings
csoceanu 7ae5fb0
fix(actions): report additional startup failure cases
csoceanu d4062e0
fix(actions): isolate startup failure reporting token
csoceanu 52f0de9
fix(actions): tighten startup failure bot matching
csoceanu 597d33e
fix(actions): derive trusted bot role dynamically
csoceanu c628eb1
fix(actions): preserve startup reporter roles
csoceanu eef46e6
fix(actions): refine startup failure reporting
csoceanu 89cdd25
fix(secrets): reserve workflow role name
csoceanu d2f9d2b
fix(actions): clean up startup failure reporting
csoceanu f503fee
fix(action): keep failure target pairs aligned
csoceanu 609deb4
fix(action): align reporting roles and tokens
csoceanu 22057b4
fix(action): harden startup failure reporting
csoceanu 4cff973
fix(action): match startup failure run links exactly
csoceanu b6f8444
fix(workflow): avoid unnecessary prioritize token minting
csoceanu 274e64b
docs: fix repository wording
csoceanu 37f4297
fix(workflow): report harness dispatch failures
csoceanu 04cef75
fix(actions): deduplicate harness failure comments
csoceanu ffdc475
fix(actions): correct startup failure reporting
csoceanu caeda22
fix(workflow): resolve rebase lint issues
csoceanu 8a24500
fix(workflow): use structured harness event payload
csoceanu c2a86cc
fix(workflow): include vendored failure reporter
csoceanu c5e8497
fix(reporting): fall back when comment updates fail
csoceanu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| #!/usr/bin/env bash | ||
| # report-agent-startup-failure-test.sh — Tests for report-agent-startup-failure.sh | ||
| # | ||
| # Run from the repo root: | ||
| # bash .github/scripts/report-agent-startup-failure-test.sh | ||
|
|
||
| set -euo pipefail | ||
| FAILURES=0 | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| SCRIPT="${SCRIPT_DIR}/report-agent-startup-failure.sh" | ||
| TMPDIR="$(mktemp -d)" | ||
| trap 'rm -rf "${TMPDIR}"' EXIT | ||
|
|
||
| MOCK_BIN="${TMPDIR}/bin" | ||
| mkdir -p "${MOCK_BIN}" | ||
| cat > "${MOCK_BIN}/gh" <<'MOCKEOF' | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| MOCK_DIR="$(cd "$(dirname "$0")/.." && pwd)" | ||
| if [[ "$1" != "api" ]]; then | ||
| echo "unexpected gh call: $*" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ "$*" == *"graphql"* ]]; then | ||
| if [[ "${MOCK_GRAPHQL_FAIL:-}" == "true" ]]; then | ||
| exit 1 | ||
| fi | ||
| printf '%s\n' "${MOCK_VIEWER_LOGIN}" | ||
| elif [[ "$*" == *"--method PATCH"* ]]; then | ||
| if [[ "${MOCK_PATCH_FAIL:-}" == "true" ]]; then | ||
| exit 1 | ||
| fi | ||
| printf 'patch\n' >> "${MOCK_DIR}/calls" | ||
| elif [[ "$*" == *"--method POST"* ]]; then | ||
| printf 'post\n' >> "${MOCK_DIR}/calls" | ||
| else | ||
| if [[ "${MOCK_COMMENTS_FAIL:-}" == "true" ]]; then | ||
| exit 1 | ||
| fi | ||
| printf '%s\n' "${MOCK_COMMENTS_JSON}" | ||
| fi | ||
| MOCKEOF | ||
| chmod +x "${MOCK_BIN}/gh" | ||
|
|
||
| run_case() { | ||
| local name="$1" viewer="$2" comment_login="$3" trusted_bots="${4:-}" role="${5:-review}" body_prefix="${6:-marker}" expected="${7:-patch}" graphql_fail="${8:-false}" stable_marker="${9:-false}" agent="${10:-review}" patch_fail="${11:-false}" comments_fail="${12:-false}" | ||
| local marker="<!-- fullsend:agent-startup-failure:${agent}:123" | ||
| if [[ "${stable_marker}" == "true" ]]; then | ||
| marker+=":stable" | ||
| fi | ||
| marker+=' -->' | ||
| local body="${marker}\n\nold comment\n\n[View the workflow run](https://github.com/org/repo/actions/runs/123)" | ||
| if [[ "${body_prefix}" == "embedded" ]]; then | ||
| body="old comment\n\n${marker}" | ||
| elif [[ "${body_prefix}" == "old-run" ]]; then | ||
| body="${marker}\n\nold comment\n\n[View the workflow run](https://github.com/org/repo/actions/runs/99)" | ||
| elif [[ "${body_prefix}" == "prefix-run" ]]; then | ||
| body="${marker}\n\nold comment\n\n[View the workflow run](https://github.com/org/repo/actions/runs/1234)" | ||
| fi | ||
| export MOCK_VIEWER_LOGIN="${viewer}" | ||
| export MOCK_GRAPHQL_FAIL="${graphql_fail}" | ||
| export MOCK_PATCH_FAIL="${patch_fail}" | ||
| export MOCK_COMMENTS_FAIL="${comments_fail}" | ||
| export MOCK_COMMENTS_JSON="[[{\"id\":42,\"user\":{\"type\":\"Bot\",\"login\":\"${comment_login}\"},\"body\":\"${body}\"}]]" | ||
| : > "${TMPDIR}/calls" | ||
|
|
||
| PATH="${MOCK_BIN}:${PATH}" \ | ||
| GH_TOKEN=test \ | ||
| RUNNER_TEMP="${TMPDIR}" \ | ||
| FULLSEND_FAILURE_REPOSITORY=org/repo \ | ||
| FULLSEND_FAILURE_NUMBER=123 \ | ||
| FULLSEND_FAILURE_AGENT="${agent}" \ | ||
| FULLSEND_FAILURE_ROLE="${role}" \ | ||
| FULLSEND_FAILURE_STABLE_MARKER="${stable_marker}" \ | ||
| FULLSEND_FAILURE_TRUSTED_BOTS="${trusted_bots}" \ | ||
| FULLSEND_FAILURE_RUN_URL=https://github.com/org/repo/actions/runs/123 \ | ||
| FULLSEND_FAILURE_CATEGORY="workflow setup" \ | ||
| bash "${SCRIPT}" >/dev/null | ||
|
|
||
| local actual | ||
| actual="$(cat "${TMPDIR}/calls")" | ||
| if [[ "${actual}" == "${expected}" ]]; then | ||
| printf 'PASS: %s\n' "${name}" | ||
| else | ||
| printf 'FAIL: %s — expected %s, got %s\n' "${name}" "${expected:-no call}" "${actual:-no call}" >&2 | ||
| FAILURES=$((FAILURES + 1)) | ||
| fi | ||
| } | ||
|
|
||
| run_case "job token finds app-bot comment" "github-actions" "fullsend-ai-review[bot]" | ||
| run_case "app token finds job-bot comment" "fullsend-ai-review" "github-actions[bot]" | ||
| run_case "custom app set finds job-bot comment" "acme-review" "github-actions[bot]" "acme" | ||
| run_case "job token finds custom app-set comment" "github-actions" "acme-review[bot]" "acme" | ||
| run_case "non-listed role is trusted" "github-actions" "acme-scribe[bot]" "acme" "scribe" | ||
| run_case "custom app-set whitespace is trimmed" "github-actions" "acme-scribe[bot]" " acme " "scribe" | ||
| run_case "lookalike app is not trusted" "github-actions" "acme-reviewer[bot]" "acme" "review" "marker" "post" | ||
| run_case "marker must start the comment" "github-actions" "fullsend-ai-review[bot]" "" "review" "embedded" "post" | ||
| run_case "different run posts a new historical comment" "github-actions" "fullsend-ai-review[bot]" "" "review" "old-run" "post" | ||
| run_case "prefix-matching run posts a new historical comment" "github-actions" "fullsend-ai-review[bot]" "" "review" "prefix-run" "post" | ||
| run_case "GraphQL viewer failure does not prevent reporting" "github-actions" "fullsend-ai-review[bot]" "" "review" "marker" "patch" "true" | ||
| run_case "stable harness marker updates a prior run" "github-actions" "fullsend-ai-harness[bot]" "" "harness" "old-run" "patch" "false" "true" "harness" | ||
| run_case "failed cross-identity patch falls back to post" "github-actions" "fullsend-ai-review[bot]" "" "review" "marker" "post" "false" "false" "review" "true" | ||
| run_case "comments lookup failure falls back to post" "github-actions" "fullsend-ai-review[bot]" "" "review" "marker" "post" "false" "false" "review" "false" "true" | ||
|
|
||
| if [[ "${FAILURES}" -gt 0 ]]; then | ||
| printf '%d test(s) FAILED\n' "${FAILURES}" | ||
| exit 1 | ||
| fi | ||
| printf 'All tests passed\n' | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.