Repository navigation
Phase 7d: the unattended automatic re-pull run and its central workflow - #1963
Merged
neuromechanist merged 18 commits intoOct 26, 2026
Conversation
plan, execute and resume take --automatic-dispatch <id>: the dispatch is read from the event file (exactly the Worker's nine keys), the CLI must be the release it names, GH_TOKEN is the App token, a token on the command line is refused, and only fixed repull-auto lines are printed. plan reports started and refuses a plan the automatic path does not take; execute checks the live plan, presents the dispatch at the create, never takes up an administrator's record, and reports opened; resume finishes only a merged automatic re-pull. New run words are on the closed list. Tested: repull-automatic unit and CLI suites (real binary, real routes and callback, GitHub and S3 stand-ins), dispatch-words scan, typecheck, lint.
At pr_open a dispatched execute reads the release branch with git, holding the run's lock, until enrichment has not moved it for five minutes or --settle-minutes passes (default 30). Each move is judged by the head rule execute and resume share and recorded as the pr_open self-edge; any other commit is head-foreign, recorded on the row as [auto:head-foreign], and the run reports failed. A read that cannot be made is counted and retried, never taken as a move. Tested: repull-automatic CLI suite (enrichment move recorded, README commit refused, quiet period and bound timed against a real origin), typecheck, lint.
The authoring copy of the central workflow the Worker's dispatch starts, for nemarDatasets/.github; deployed only with the epic release. Masks the dispatch token from the event file first, checks the nine keys, gates on disk, mints an App token for the one dataset repository, installs exactly the release named (no dev build), signs in with the key in env, exchanges the import's AWS pair for a session, runs plan and execute (open) or resume (finish) unattended, and reports a run that did not report. No run line interpolates an expression; nothing is uploaded. Tested: actionlint with shellcheck; pinned by the next commit's test.
Parses the authoring copy and pins its triggers, scopes, concurrency, bound and timing, the token's mask and absence from every env, the nine keys against the Worker's builder, every option against the CLI, the App token's scope, and the callback word list. Runs the guard scripts under bash: validation, mask, the release-only install (bun and nemar stand-ins) and the backstop (curl stand-in). Parity with the deployed copy via NEMAR_REPULL_WORKFLOW_LIVE, skipping visibly. Tested: 31 pass, 3 parity skips; each guard mutated and caught.
Appends the dated 7d slice: where the run executes, the public-log rule, the dispatch and its token, production only, the live-plan check, the settle rule, the reports and backstop, the resume limit the next slice inherits, and what only production can check. Not tested (prose).
Bun prints an uncaught exception and an unhandled rejection itself, with the message and a source excerpt, which can name a path or a key in the public log. The quiet guard now takes both: the run ends with result phase=failed code=runner-failed and exits 1, a run that had said it succeeded says it failed, and one that had said why it failed keeps its word. Tested: a throwing timer and an unhandled rejection in a real process leave only repull-auto lines; each handler mutated and caught.
An automatic run refuses a TEST_API_URL or stored apiUrl other than the production API or a loopback one (auto-api-not-production) before anything is sent, and does not report it; the notices request, which carries the NEMAR key, is skipped in automatic mode. The token on argv is checked before the plan file is read, a missing event file is runner-failed, and one id bound (15 digits) is shared by the Worker's builder and the CLI. Tested: unit and payload suites; each guard mutated and caught.
The App token the workflow mints lasts an hour. A plan whose copy and uploads would take more than 20 minutes by estimate (30 MiB/s, the server-side rate ADR 0064 records, and a second an object, with no credit for concurrency) is refused auto-copy-too-long at plan and from the live plan at execute, before the copy, and the word ends the automatic path for that tag. A run that fails while GitHub answers its token 401 is reported token-expired, whatever its step called it. Tested: unit (budget edges, the override only shortens, the probe) and CLI (refused at plan; a refused registration push with an expired token reported token-expired); each guard mutated and caught.
The branch is quiet only over successful reads: the settle ends when reads have seen the recorded head unchanged for the quiet period, or at its bound, and it is settled only if a read succeeded in the last quiet period. Otherwise the run records [auto:head-unreadable] with the last read's cause in fixed words and reports failed head-unreadable (resumable at pr_open). The stored head-foreign text no longer speaks of a command that is not built. Tested: settle on a virtual clock (quiet, a move, the bound, always unreadable, reads that stop), and through the CLI with an unreadable origin; each guard mutated and caught.
The two sts calls send their error to /dev/null (an explicit deny names the IAM user and the account); the App token and Bun actions are pinned to the commits run-publication-review.yml pins; the header names the workflows that already use each secret and says the App token lasts an hour. The test now checks that curl reads its configuration from stdin, the pins, the one id pattern, and that the stalled-run slice's resume window still opens its pull requests the same UTC day. Tested: actionlint with shellcheck; workflow suite 33 pass, 3 parity skips; each guard mutated and caught.
Through the real binary: an API that is not production's, the token on argv before a bad plan file, an unknown option and a missing event file (failed result line, nothing reported), a finish fed to plan, another dataset and other tags (dispatch-mismatch), a rerun tolerating already-started, a create answered with an administrator's or another record, a taken-up record whose plan has a correction, and a finish of another record, an administrator's, a completed one or none. Tested: CLI suite 31 pass; each covered guard mutated and caught.
The 7d slice now states the App token's hour and the copy budget with its reason, token-expired, the settle rule as built, the API check, the crash handling, the hidden sts error, the pinned actions, the one id bound, what a tenth key does (the CLI reports nothing; the backstop reports a shape-valid one, which the Worker stores only for its own token), that a refused plan writes no record but leaves its file on the runner, what REPULL_JOB_TIMEOUT_MINUTES binds, the finish's --wait-minutes 30, the resume window now checked here, and what 7f's resume of a copied record meets. Header annotations name 7d. The automatic module's comments match the code. Tested: adr-index and the decision tests; lint.
neuromechanist
force-pushed
the
feature/issue-1913-phase7d-unattended-run
branch
from
October 26, 2026 03:39
e22e46f to
c608f77
Compare
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1963Version: 🤖 Updated on each push. |
The workflow notes the mint time (NEMAR_REPULL_TOKEN_SINCE) just before minting; the CLI plans for 55 minutes of the token. The copy budget is now derived: 55 minus the settle's six-minute reserve and 29 minutes for the other steps, so it stays 20 minutes but the settle is inside the hour. The plan, the execute before its record, and the copy, registration and pull-request steps refuse auto-token-hour when what is left would not fit; a missing or future mint time refuses auto-token-clock. The settle is cut at the end of the usable hour and a cut settle is head-unreadable (cause token-hour). The stored head-unreadable message and comments no longer promise a later run: an administrator's resume is the only way to settle it again. The quiet line now logs token_age_s and per-step seconds. Tested: unit, workflow and automatic CLI suites (injected clock and mint times in the past), typecheck and biome.
The sink records a terminal report the Worker stored. A crash, or an exit without a result line, after that prints the quiet line, a report-stands line and the stored result, instead of a failed line the dispatch's record contradicts. The crash handler's body is in try/finally so it exits 1 whatever happens while writing, and the closing lines mark the run ended before writing, so a log that cannot be written is not tried again on the way out. Tested: unit suite, including a crash after a stored opened and failed report, an exit after a stored finish, and a crash whose stdout throws (exit 1, nothing on stderr).
The App-token probe no longer runs for words that already say why the run stopped: auto-token-on-argv (reported first and as itself), auto-token-hour, auto-token-clock, head-unreadable and head-foreign. token-expired is reported refused once an open run left its record, and is in DISPATCH_FINAL_CODES, so the scheduler sends no new dispatch for the tag; before the record it stays failed. The report and the probe fetch with redirect "error", so neither token follows a redirect. Tested: unit suite (real loopback 307 redirect servers), automatic CLI suite (expired token with the token on argv, at the settle and at the registration; final_refusals counted by CANDIDATE_BLOCKERS_SQL).
The sign-in step sends both streams to /dev/null, since either can name the account. The workflow test pins the line and runs the step with a stand-in nemar that prints on both streams and exits 0 or 1. Tested: workflow suite, actionlint with shellcheck.
The 7d slice now says how the token's 55 usable minutes are shared (settle reserve, other steps, the derived copy budget), the elapsed checks and auto-token-hour/auto-token-clock, the settle cut, the probe's skip list, token-expired reported refused and final once a record exists, redirects refused, crash lines after a stored report, the logged durations, and that an administrator's resume is the only way to settle a head-unreadable pull request. The stalled-run limit names where a resume still works: planned, and prepared before any object is copied; a CLI test shows the latter replans to the record's digest and opens its pull request. Tested: adr-index suite; the new CLI test.
The redirect test of the report set the CLI's API address through the environment variable the CI routing reads as a live-tier marker, which moved the file out of unit-pure while its header claimed it. The report now takes the API address as a tests-only option (the CLI's own by default), and the test passes the loopback server's address there instead. The header says it starts two loopback servers. Tested: ci-tier-routing and the automatic unit suite (109 pass); the redirect mutant is still killed; the CLI happy path still reports.
neuromechanist
merged commit Oct 26, 2026
138386f
into
feature/issue-1046-epic-upstream-freshness
20 checks passed
This branch was previously deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Builds the unattended run of an automatic re-pull (ADR 0111, dated 2026-10-25 for this slice). A dispatch from the Worker starts the central workflow
run-upstream-repull.yml, which runs the CLI's automatic mode: it takes the nine dispatch keys, refuses a development build and any dispatch that does not name a release, reads the dispatch token from the event file (never from an environment variable or an argument), masks it, runs the existingexecutepath throughpr_open, and reportsstarted, thenopenedorrefusedorfailedwith a code from the closed list. Before it reports, it settles the release head so the report names a commit GitHub holds. The workflow authoring copy is in this repository; its deployed copy innemarDatasets/.githubis Phase 7w, held until the epic release. Nothing here merges.Phase 7d of epic #1046, part of #1913 (which stays open until Phase 7 completes). It builds on 6d and 6f (the execute, copy, register, push and merge paths), 7b (the dispatch record and report callback) and 7c (the payload).
Departures from the plan (each is the safer direction)
GetSessionToken) inside the step that runs the CLI. This is a security decision the review should judge.repull-in-flight.src/with a release version.DISPATCH_CODES.Test plan
bun teston the implementer's run: 21051 pass, 245 skip, 2 fail. One ispr-review-calibrate(a timeout under load; it passed on a third run), one is the website-parity check against a drifted local checkout.GetSessionTokenaccepts the import's key pair and its session can copy; that Ubuntu's apt git-annex reads what the planner reads; how soon enrichment commits after a push; that anonymous clones of OpenNeuroDatasets hold up from a runner (the App token is never sent there).