Repository navigation
Description
Overview
Science runs increasingly write to a custom PYAUTO_OUTPUT_DIR (one output root
per arm, so parallel arms do not collide). Those roots are never pulled to the
laptop: each science project's hpc/sync carries a hard-coded PULL_DIRS array
that both pull and pull-full iterate. On 2026-09-09, euclid_dr1_prelim
jobs 342375_[0-1] (ordered MGE witness) and 342377_0 (unordered control)
completed on RAL and wrote 166 MB across three runs into
output_ordered_witness/; none of it came down, and retrieving it needed a
hand-edited copy of the project's own sync CLI.
Sibling task #370 / PR #371 makes such runs scorable once they are on the
laptop. This one makes them arrive.
This issue is blocked on #371 — it reuses the _path_tokens() helper that
PR adds, and the worktree conflict guard reports PyAutoBrain as claimed by that
task. Registered in PyAutoMind/planned.md until #371 merges.
Survey findings that shaped the design
- 12 projects, 3 active.
subhalo_validation,euclid_dr1_prelim,
slope_hierarchy_scale. The other nine are dormant or retired. - The forks share one ancestor. 55–95% of each script is verbatim identical;
inference_programme/hpc/sync:4-5names the ancestor in prose. 11 of 12
iterate a flatPULL_DIRSarray identically; only the retired
inference_programmediffers structurally (parallel
PULL_DIRS/PULL_DESTS/LOG_INDICES). - The override seam already exists. Every script sources a gitignored
hpc/sync.conf, whosesync.conf.examplesays "You can also export these as
environment variables instead of editing a file" — but only forHPC_HOST,
HPC_BASE,PROJECT_NAME.PULL_DIRS=(…)is a bare literal below that
source(sync.confat line 55,PULL_DIRSat line 112 in
euclid_dr1_prelim/hpc/sync), so it clobbers any override. - The
pullverb is arg-blind.pull) pull ;;never forwards"$2",
unlikesubmit/cancel/tail. A--dirsflag would need the dispatch line
andpull()'s body changed in every fork; the env seam needs neither, and
pull-fullinherits it since it iterates the same array.
The safety constraint that shapes root selection
A pull rsyncs remote → local ("${REMOTE}/${dir}/" →
"${PROJECT_ROOT}/${dir}/"). Real tasks' ## Where to look bullets name
results/, wiki/project/state.md, scripts/…, hpc/batch_cpu/… — feeding
those to a pull would overwrite the human's own source with the cluster's copy.
So Cortex contributes only output*-shaped roots, and the script
appends them, never replaces. This is where the "glob output*" option from
the prompt actually lives: applied to declared paths inside Cortex, so no
remote enumeration is needed.
Plan
- Cortex derives the
output*roots its tasks declare (reusing_path_tokens()
from cortex: check-in scorer resolves Where-to-look bullets against project roots #371) and passes them to each project's ownpullthrough an
environment variable — the same override conventionhpc/sync.confalready
documents. - The three active projects'
hpc/synchonour that variable by appending
the extra roots to their ownPULL_DIRS, so a project's own roots always
pull and an unset variable reproduces today's behaviour exactly. - The organ boundary is unchanged: Cortex still only runs the human's own CLI,
never reaching RAL itself. - Nine dormant/retired projects are deliberately left alone; they pick the
convention up when reactivated.
Detailed implementation plan
Affected Repositories
- PyAutoBrain (primary)
- euclid_strong_lens_modeling_pipeline
- subhalo_validation (a PyAutoLabs repo, not in
repos.yaml) - slope_hierarchy_scale (a PyAutoLabs repo, not in
repos.yaml)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoBrain | main | clean — claimed by cortex-scorer-where-paths (#370) |
| ./euclid_strong_lens_modeling_pipeline | main | clean |
| Science/subhalo_validation | main | 4 dirty (live science tree) |
| Science/slope_hierarchy_scale | main | 1 dirty (live science tree) |
| Science/euclid_dr1_prelim | main | 6 dirty, 2 commits ahead unpushed |
Suggested branch: feature/cortex-pull-declared-output-roots
Implementation Steps
-
PyAutoBrain —
agents/conductors/cortex/_cortex.py.PULL_DIRS_ENV = "PYAUTO_PULL_DIRS";OUTPUT_ROOT_RE = ^output[\w.-]*$,
with the remote→local hazard recorded as the reason for the guard.declared_output_roots(mod, tasks) -> list[str]— first path segment of
each relative declared token, kept only when it matches
OUTPUT_ROOT_RE; deduped, sorted. Absolute tokens skipped.pull_env(roots)→{**os.environ, PULL_DIRS_ENV: " ".join(roots)}, or
Nonewhen there are no roots, so a project declaring nothing invokes
exactly the command it does today.- Thread through both pull paths —
run_pull()(used bycollect) and
run_pull_streamed()(used bycheckin), which today call
subprocess.run(..., cwd=…)with noenv. Their callers (cmd_collect
~2121, the checkin ~2577) already have the tasks in scope. pull_shell(row, roots)— what--dry-runprints — shows the assignment:
cd <path> && PYAUTO_PULL_DIRS="output_ordered_witness" hpc/sync pull.
-
The three sync CLIs. Identical additive block immediately after the
PULL_DIRS=(…)literal, plus a documenting paragraph in each
hpc/sync.conf.example:# Extra roots the caller asks for, space-separated — the Cortex check-in # passes the `output*` roots its tasks declare, so a run written to a custom # PYAUTO_OUTPUT_DIR is pulled without this list being edited by hand. # Appended, never replacing: this project's own roots always pull. if [[ -n "${PYAUTO_PULL_DIRS:-}" ]]; then for _extra in ${PYAUTO_PULL_DIRS}; do [[ " ${PULL_DIRS[*]} " == *" ${_extra} "* ]] || PULL_DIRS+=("${_extra}") done fi
An env var cannot carry a bash array, hence the space-separated scalar; the
unquoted expansion is deliberate (word-splitting is the parse) and is why
Cortex only ever emitsoutput*tokens. -
Routing per project.
project repo route euclid_dr1_prelimeuclid_strong_lens_modeling_pipeline— registered inrepos.yaml; itshpc/syncis byte-identical (53fc4c66…) to the science clone'snormal task worktree + PR subhalo_validationPyAutoLabs/subhalo_validation— real repo, unregisteredgit -C <clone> worktree addinto the scratchpad, edit, push, PRslope_hierarchy_scalePyAutoLabs/slope_hierarchy_scale— samesame All three science clones are live working trees on
mainwith uncommitted
science state. Nothing switches branches in them — the separate worktree
exists precisely so the live trees are never disturbed; they pick the change
up with an ordinarygit pullonce merged.
Key Files
PyAutoBrain/agents/conductors/cortex/_cortex.py—declared_output_roots,
pull_env,PULL_DIRS_ENV,OUTPUT_ROOT_RE(new);run_pull,
run_pull_streamed,pull_shell+ their two callers (changed).PyAutoBrain/tests/test_cortex_conductor.py— new tests.<each project>/hpc/syncand<each project>/hpc/sync.conf.example.
Verification
Brain unit tests on the existing board fixture:
declared_output_rootskeepsoutput_ordered_witnessfrom a real-shaped
bullet and rejectsresults,wiki,scripts,hpcand absolute
tokens — the remote→local hazard asserted directly.- dedupe + sort across several tasks of one project.
pull_shell()shows thePYAUTO_PULL_DIRS=assignment when roots exist and
is byte-identical to today's string when none do.- both pull paths pass the env: monkeypatch
subprocess.run, assert theenv
carriesPYAUTO_PULL_DIRS, and that it is absent for a project declaring no
output*root.
Then the full PyAutoBrain/tests/ suite (~6 min; the one known
worktree-symlink failure passes in the canonical checkout and in CI).
Bash side: bash -n on each edited script, plus a harness sourcing only the
variable block with and without PYAUTO_PULL_DIRS set, asserting the resulting
PULL_DIRS — including that an already-present root is not duplicated.
Live witness (the prompt's own): euclid_dr1_prelim with
PYAUTO_PULL_DIRS=output_ordered_witness. output_ordered_witness/run_1/… is
already on the laptop, so the rsync is a near-no-op --update. This is the
only step that touches RAL and needs human confirmation first, per the
supervised autonomy level.
Flagged, not fixed
euclid_dr1_prelim's science clone is 2 commits ahead of origin, unpushed —
it will diverge from the merged change until those are pushed.- The retired
inference_programmeis structurally different and would need
bespoke work. - The real root cause is 12 forks of one ancestor with no provenance marker.
De-forking to a maintained template is the durable fix, out of scope here,
and worth its own prompt.
Original Prompt
Click to expand starting prompt
Custom output roots are never pulled from the HPC — each project's…
Type: bug
Target: PyAutoBrain
Repos:
- PyAutoBrain
- PyAutoCortex
Difficulty: large
Autonomy: supervised
Priority: normal
Status: formalised
Consequence: notify
Witness: a science run written to a custom PYAUTO_OUTPUT_DIR is pulled to the laptop by the project's own sync CLI without that path being hand-added to a per-project array.
Review-minutes: 0
Unattended: ready
Custom output roots are never pulled from the HPC — each project's hpc/sync has its own static PULL_DIRS
Type: bug
Target: PyAutoBrain
Witness: a science run written to a custom PYAUTO_OUTPUT_DIR is pulled to the laptop by the project's own sync CLI without that path being hand-added to a per-project array.
Science runs increasingly write to a custom PYAUTO_OUTPUT_DIR (one output root per arm, so parallel arms do not collide). Those roots are never pulled to the laptop, because each science project's hpc/sync carries its own hard-coded PULL_DIRS array and both the pull and pull-full verbs iterate it.
Evidence from 2026-09-09:
- euclid_dr1_prelim: PULL_DIRS=(output output_sed inspect)
- subhalo_validation: PULL_DIRS=(output results)
- slope_hierarchy_scale: PULL_DIRS=(output)
Three different file hashes — these are divergent per-project forks, not copies of a shared template, so there is no single place to add a path.
Concrete miss: euclid_dr1_prelim jobs 342375_[0-1] (ordered MGE witness) and 342377_0 (unordered control) completed on RAL and wrote to output_ordered_witness/. 166MB across three completed runs sat unpulled; the Cortex check-in reported the tasks as FAILED. Retrieving them needed a temporary edited copy of the project's own sync CLI.
The human confirms splitting results into custom output folders will become commonplace, so a per-project path addition is not the fix.
Options to weigh (design decision wanted, not a predetermined answer):
- glob output* in PULL_DIRS so any output root is pulled by convention;
- have the pull consult the Cortex task ledger's declared output roots for that project;
- give the sync CLI a flag the Cortex check-in can pass.
Filed against PyAutoBrain because the Cortex check-in door is what invokes each project's <sync_cli> pull and is the only place a general convention can be consulted centrally; part of this task is deciding whether the convention belongs there, in PyAutoCortex, or in the per-project science clones under the Science directory (which are not workspace repos).
Sibling task: the Cortex scorer bug filed alongside this one (scorer blind to runs outside output/) — that one makes such runs scorable once pulled; this one makes them arrive.
Activity
Jammy2211 commentedon Sep 9, 2026
Unblocked — the sibling #370 / PR #371 merged on 2026-09-09 (
ec354a7), so the scorer half is in.That fix makes a run written to a custom
PYAUTO_OUTPUT_DIRscorable once it is on the laptop:where_pathsnow resolves relative## Where to lookbullets against the project roots, andrun_artifactsreports UNOBSERVABLE rather than silently scoring the newest unrelated run underoutput/.What is still open here is the other half — getting those roots to arrive. Nothing in #371 touches the pull, so a custom output root still has to be fetched by hand today.
Field note for whoever picks this up: the three live science projects have genuinely divergent arrays, so there is no single file to edit —
euclid_dr1_prelim:PULL_DIRS=(output output_sed inspect)subhalo_validation:PULL_DIRS=(output results)slope_hierarchy_scale:PULL_DIRS=(output)Three different file hashes, no shared template. Both the
pullandpull-fullverbs iterate the same array, so neither verb can reach a custom root.Jammy2211 commentedon Sep 9, 2026
Shipped across all four repos — commits, pushes, and PRs open. Awaiting merge (library-first: PyAutoBrain first).
PRs:
Commits:
27be3256ffd2df202e8499572405Evidence recap:
PyAutoBrain/tests/suite: 943 passed, 1 failed in 3:22 — the one failure is the known pre-existing worktree/symlink trap (test_a_fixture_tree_finds_the_schema_its_checkout_ships), passes in canonical checkout/CI.bash -nclean on all three editedhpc/syncscripts.euclid_dr1_prelim: without the seam,output_ordered_witness/never appears in the pull; withPYAUTO_PULL_DIRS=output_ordered_witnessset, it is listed and not reported missing.rsync --dry-run --statson that root: 115 files (90 regular, 25 dirs), 173,465,562 bytes sitting on RAL.Heart is RED on five organism-scope reasons, acknowledged in-session for this task (recorded in
PyAutoMind/active.md); none of these four repos are in the release chain. Not merging — stopping at PR-open per policy.🤖 Generated with Claude Code
https://claude.ai/code/session_01FKSwTBuNwcJc2FPNpSCrkp
Jammy2211 commentedon Sep 9, 2026
Shipped
All four PRs merged.
11aa3f83da9ff852ab4bf323be6e88daCI at merge: PyAutoBrain
pytest (3.12)+(3.13)pass; euclid pipeline 9/9 legs pass acrossTestsandSmoke Tests.subhalo_validationandslope_hierarchy_scalehave no workflows configured — merged on local evidence (bash -nplus the append/dedupe harness) after an explicit human decision. Heart freeze: not frozen.Live witness (RAL dry run, euclid_dr1_prelim). Without the seam the pull enumerated
output/,output_sed/(absent),inspect/(absent) and never mentionedoutput_ordered_witness/. WithPYAUTO_PULL_DIRS=output_ordered_witnessthat root appears and is not reported missing;rsync --dry-run --statsshows it holds 115 files (90 regular, 25 dirs), 173,465,562 bytes on RAL — the results the 2026-09-09 check-in could not see.Follow-ups, deliberately not in scope here:
find_logs()globs every historical run stem soleg_resumereads an old job's.out, andvoidremains inFAILED_RUN_STATES. Those two are what still make the check-in read FAILED. De-forking the 12hpc/syncscripts to a maintained template remains the durable fix for the root cause.