Repository navigation
fix: report a failed step ahead of the harness to the outage tracker - #1749
Conversation
A failed setup-runtime (or checkout, or setup: step) skips the harness action and its Report failure step, so the run went red with no tend-outage row. Generated agent jobs now follow the harness with max-sixty/tend/report-failure, gated on the harness being skipped by a failure. It runs report_failure from the action's own source under /usr/bin/python3 -I, so it needs no installed runtime, and names the job's failed step from the jobs API. Closes #1663
tend-agent
left a comment
There was a problem hiding this comment.
The standalone reporter still fails before it files any row on an ubuntu-22.04 runner. That runner's /usr/bin/python3 is 3.10. report_failure.main() calls _issue.row() first, and row() stamps the time through _common.utcnow(), which returns datetime.datetime.now(datetime.UTC). datetime.UTC only exists from Python 3.11 on, so the step raises AttributeError and the failure it was supposed to report goes unrecorded. Generated jobs default to ubuntu-24.04 (3.12), but runs-on: ubuntu-22.04-large is the job override example in AGENTS.md, so consumers can land on 3.10. test_the_standalone_entry_point_needs_no_installed_runtime doesn't catch this because it probes third-party imports under the test interpreter, not the stdlib surface of an older Python.
datetime.timezone.utc has the same meaning and works on 3.10. That line is outside this diff, so I'm pushing it as a follow-up commit.
report-failure runs the reporter under the runner's system Python, which is 3.10 on ubuntu-22.04, where datetime.UTC does not exist.
When a step ahead of the harness action fails, such as
setup-runtime, checkout or a consumersetup:step, the run now files atend-outagerow that names the failed step. Before this, the failure skipped the harness and itsReport failurestep along with it, and nothing was recorded. This restores #857's guarantee, which #1608 lost whensetup-runtimebecame its own step.max-sixty/tend/report-failure(report-failure/action.yaml). It runs the existingreport_failuremodule from the action's own source as/usr/bin/python3 -I report-failure/report.py. That needs no uv and no installed runtime, so it still works whensetup-runtimeis the step that failed.report_failureand its imports were already stdlib-only apart fromtend.workflows.release, which this moves into a new stdlib-only module,tend/releases.py.id: harnessand is followed byreport-failurewithif: failure() && steps.harness.outcome == 'skipped'. A harness that ran and failed still reports through its own step, so the security-preflight exclusion holds and the run gets no second row.name_failed_step=True, the reporter readsruns/{id}/attempts/{n}/jobs, takes the in-progress job whoserunner_namematchesRUNNER_NAME(matrix siblings share the run id), and addsFailed before the harness action ran, at `<step>`.below the row. That read is best-effort: if it fails, the row is still filed. I checked against this session's own run that the jobs API reports completed step conclusions while the job is still running.Tests: the full Python suite passes, apart from the two
test_refresh_consumerstests that need DNS. New tests cover the generated step's placement and condition for both harnesses, the step-naming read (including a matrix sibling and an earlier job on the same runner), a failed jobs read that still files the row, and a probe that the standalone entry point imports no third-party module. Pre-commit is clean. Regtest snapshots are regenerated.What this doesn't cover: jobs with no harness step, such as mention's
verifyand triage'sselect. Ifsetup-runtimefails there, the agent job that depends on it is skipped, and nothing is reported. The new step also makes a red notifications pre-check file a row on each failing poll, as the request asked for any step ahead of the agent.Closes #1663