Skip to content

onboard-openneuro: report the real failure, not a stage roll-up - #115

Merged
neuromechanist merged 1 commit into
mainfrom
feat/issue-1309-capture-real-failure
Sep 10, 2026
Merged

neuromechanist merged 1 commit into
mainfrom
feat/issue-1309-capture-real-failure

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Half A of nemarOrg/nemar-cli#1309 (epic nemarOrg/nemar-cli#1306). This is the deployed copy of
nemar-cli's .github/dataset-workflows/onboard-openneuro.yml; the two files are byte-identical, and
the companion PR is nemarOrg/nemar-cli#1351.

The problem. The only failure message that reached the database came from the report job:

terminal: prepare=failure copy=failure finalize=failure

A stage roll-up with no error text. Every machine-filed tracking issue on this repo reads exactly that,
which is why a human has been reading run logs and applying upstream-403 / git-divergence labels by
hand. The classifier that shipped in nemar-cli v0.10.2 reads import_jobs.last_error — text that was
never being sent.

The change. Each phase job reports its own failure, carrying the CLI's failure line. It runs in the
failing job, not in report, for two reasons that rule out the alternatives: jobs don't share a
filesystem (so report can't read the tee'd log), and matrix job outputs overwrite each other across
datasets (so a per-dataset error can't travel that way either). copy and finalize gain the tee that
prepare already had.

The roll-up stays as the backstop and cannot clobber the specific message — the backend refuses to
overwrite a specific error with a generic one, which is a rule that already exists for this purpose.

Details that are decisions, not incidentals

  • Reads the tee'd CLI output, never the Actions log. Two false positives make whole-log matching
    actively wrong, and both were hit while diagnosing the outage: a bare 403 matches apt's
    Packages [403 kB] on every runner, and [openneuro-upstream-inaccessible] appears in every
    prepare log because the reporting step's own source is echoed by Actions. That second one is the
    likeliest origin of the misattributed upstream-403 labels on the currently-open issues.
  • A six-line window from the last failure marker, not a single line. ora().fail() interpolates
    subprocess stderr, and git prints the part the classifier needs on continuation lines
    (remote: error: GH013:, hint: ... diverging commits). A single line would have dropped two of the
    four real causes.
  • grep -nF plus a sed window, not an awk bracket class. ubuntu-latest's awk is mawk, which
    is byte-oriented, so a multibyte character inside [...] matches its individual bytes.
  • jq -nc builds every payload. The hand-rolled JSON this replaces only ever carried fixed
    strings, so it worked right up until the message stopped being fixed — and the failure mode is a
    silent 400 on the one callback that carries the diagnosis.
  • An empty extraction becomes a named fallback, never an empty error_message: the classifier
    treats a roll-up or a null as unknown deliberately, and an empty string would look like a measured
    "no reason".

Test plan

Verified end to end before opening this, rather than after deploying it. The workflow's own extraction
pipeline was run over logs in the shape the CLI actually writes, and each result fed to the real
classifier:

captured message cause
Failed to clone: fatal: Authentication failed for … auth_invalid
Failed to enable s3-PUBLIC remote: … annex-uuid file indicates it is used by a different special remote annex_uuid_conflict
Failed to push: remote: error: GH013: Repository rule violations found … branch_protection
Failed to push: hint: … diverging commits git_divergence
prepare failed with no CLI failure line captured (see run log) unknown → needs-triage
terminal: prepare=failure copy=failure finalize=failure unknown → needs-triage

Those first four are the causes behind the 2026-07-22 → 2026-09-08 outage, so this is the taxonomy
being re-derived from the messages the workflow will now send.

Also verified: the file parses as YAML, all three reporters are present and name their own stage, and
nemarOrg/nemar-cli#1351 adds a test that fails if any of the tee, the per-stage reporter, the jq
payload, or the read-the-log-not-the-Actions-log rule is edited away — checked by removing a tee and a
jq and watching it fail.

Deploy note

The CLI-side classifier is already on dev and released, so this can land as soon as it is reviewed;
capture and classify are independent. Nothing here changes the success path — every new step is
if: failure().

Half A of nemarOrg/nemar-cli#1309 (epic #1306). Deployed copy of
nemar-cli's .github/dataset-workflows/onboard-openneuro.yml; the two files are
byte-identical and a test in that repo keeps them joined to the classifier.

Until now the only failure message reaching the database came from the `report`
job: `terminal: prepare=failure copy=failure finalize=failure`, a stage roll-up
with no error text. Every machine-filed tracking issue on this repo said exactly
that, so there was nothing to classify and a human read run logs and applied
labels by hand. The CLI-side classifier shipped in v0.10.2 reads text that was
never being sent.

Each phase job now reports its own failure with the CLI's failure line, in the
failing job rather than in `report`: jobs do not share a filesystem, so `report`
cannot read the tee'd log, and matrix job outputs overwrite each other across
datasets. `copy` and `finalize` gain the tee `prepare` already had.

The roll-up stays as the backstop and cannot clobber the specific message -- the
backend refuses to overwrite a specific error with a generic one.

Details that matter:

- Reads the tee'd CLI output, never the Actions log: a bare `403` matches apt's
  "Packages [403 kB]" on every runner, and the upstream marker appears in every
  Actions log because the reporting step's own source is echoed, which is the
  likeliest origin of the misattributed upstream-403 labels on the open issues.
- A six-line window from the last failure marker, because git prints what the
  classifier needs on continuation lines (`remote: error: GH013:`,
  `hint: ... diverging commits`).
- `grep -nF` plus `sed`, not an awk bracket class: ubuntu-latest's awk is mawk
  and is byte-oriented, so a multibyte character in [...] matches stray bytes.
- `jq -nc` builds every payload; the hand-rolled JSON it replaces only ever
  carried fixed strings, and an error line with a quote or backslash would have
  produced a silent 400 on the one callback carrying the diagnosis.
- An empty extraction becomes a named fallback, never an empty error_message.

Verified end to end before opening: the workflow's own extraction pipeline was
run over logs in the shape the CLI writes, and each result fed to the real
classifier. The expired PAT, the annex-uuid collision, the branch-protection
ruleset and the git divergence -- the four causes behind the 2026-07/09 outage
-- classify correctly; the fallback and the roll-up stay unknown/needs-triage.
@neuromechanist
neuromechanist merged commit 91bebcc into main Sep 10, 2026
@neuromechanist
neuromechanist deleted the feat/issue-1309-capture-real-failure branch September 10, 2026 10:51
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