Skip to content

fix(report-failure): name the trigger a stranded outage row points at - #823

Merged
max-sixty merged 1 commit into
mainfrom
fix/outage-trigger-ref
Aug 5, 2026
Merged

fix(report-failure): name the trigger a stranded outage row points at#823
max-sixty merged 1 commit into
mainfrom
fix/outage-trigger-ref

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Problem

The Trigger column of a tend-outage row is the only pointer back to the work a failed run stranded. It goes blank for the one trigger where that pointer matters most, and prints #null when a field is missing.

repository_dispatch is unhandled. tend-mention relays review events through a secretless job that re-posts them as a repository_dispatch, so the handle job runs on that event and the PR number arrives as client_payload.pr rather than in a pull_request object. The if/elif chain has no branch for it, so every failure on the relay path records Trigger: N/A — and a relayed review is exactly the case a maintainer can't recover from the run alone, since tend-review fires only on pull_request_target and never retries. This path is in constant use: gh api "repos/max-sixty/tend/actions/runs?event=repository_dispatch" returns a steady stream of tend-mention runs.

workflow_run names no run. The ci-fix path hardcodes REF="CI fix for workflow run", discarding workflow_run.id — the id of the CI failure the job was dispatched to fix.

Missing fields render as null. jq -r '.issue.number' prints the literal string null when the field is absent, so the cell reads #null rather than falling back to N/A.

Solution

Add a repository_dispatch branch reading client_payload.pr, link the upstream run id in the workflow_run branch, and give every extraction // empty plus a ${VAR:+…} guard so an absent field leaves the cell blank (rendered as N/A by the existing ${REF:-N/A}) instead of #null.

Testing

shared/steps/ has no shell test harness — shellcheck via pre-commit is the only automated gate, and it passes on the changed file. So the block was exercised directly: the REF logic was sliced out of the script (between the # Build a one-line reference comment and TIMESTAMP=) and sourced under crafted GITHUB_EVENT_PATH payloads, before and after.

Before, on origin/main:

repository_dispatch  -> N/A
workflow_run         -> CI fix for workflow run
issues (no number)   -> #null

After:

relayed review               -> #815
relay w/o pr                 -> N/A
ci-fix                       -> CI fix for [run 30795510450](https://github.com/max-sixty/tend/actions/runs/30795510450)
ci-fix w/o id                -> CI fix for workflow run
PR event                     -> #821
PR event w/o number          -> N/A
issue comment                -> #808
issue w/o number             -> N/A
schedule                     -> N/A

Adding a real harness for shared/steps/ is worth considering separately — three of the recent outage-path fixes have all landed in scripts nothing can test — but that is a bigger change than this fix warrants, so it is not bundled here.

Scope

Separate from the other two open changes on this path, and textually disjoint from both. #818 names the cause of a failure (in claude/action.yaml); #809 dedups rows across matrix legs (in the EXISTING branch of this same script, lines 49+). This one fixes what the row points at, in the REF block at lines 19–29.

@max-sixty
max-sixty merged commit fbd7b2c into main Aug 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the fix/outage-trigger-ref branch August 5, 2026 16:39
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Aug 7, 2026
Automated nightly regeneration of tend's workflow files.

**tend version:** 0.1.13 → 0.1.14

## Notable changes

- **Jobs now name the `tend` environment with `deployment: false`**
(max-sixty/tend#852), so GitHub stops filing a deployment record per run
and posting it on the pull request. This is what the current `tend
check` flags as `environment-deployments` (#3729) — regenerating clears
it, and max-sixty/tend#853 makes `check` refuse the old shape going
forward.
- **`id-token: write` dropped from every tend job** — a side effect of
removing the claude-smoke workflow and its `tend-manual` environment
(max-sixty/tend#820). None of the remaining jobs use OIDC, so the
permission was unused.
- **`tend-mention` counts bot engagement outside `jq`**
(max-sixty/tend#840). `gh api --paginate` applies `--jq` once per page,
so `| length` emitted one count per page; past 100 comments the shell
variable held `100\n7`, the numeric test errored, and the bot fell
through to `should_run=false` — going quiet on exactly its most-engaged
threads.
- **Review and triage skill fixes** — the review-record guards now
ignore synthetic reply containers (max-sixty/tend#835), `/code-review`
is ported into a tend-owned skill (max-sixty/tend#819), and triage
substitutes the real issue number into its PR-body templates instead of
leaving a placeholder (max-sixty/tend#844).
- **Outage reporting is more robust** — a stranded outage row now names
the trigger it points at (max-sixty/tend#823), and marking a
notification read tolerates a transient run-metadata fetch failure
(max-sixty/tend#843).

Full compare: max-sixty/tend@0.1.13...0.1.14

Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
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.

2 participants