Skip to content

feat: cortex conductor reads the campaign digest; scheduler governance hook (hpc-campaign p5c) #547

Closed

Description

@Jammy2211

Overview

Phase 5c: the Cortex conductor reads the digest; AUTONOMY.md scheduler allowlist; a PreToolUse hook (Claude + Codex) blocking raw sbatch/scancel/scontrol over ssh outside hpc/sync act/submit. Branch feature/hpc-campaign-p5c-brain. Tier judge; merges after 5a and 5b.

Heart RED at the door (2026-10-30): release validation FAILED (stage integrate); PyAutoHeart/workflows/Release Integrate failure; PyAutoNerves test_fitsable.py::test__output_to_fits red; Unit-test timing 1 regression (>3× baseline), 14 slow; autogalaxy red; Release validation NOT release_ready (v2026.10.30.1.dev85101); autolens_profiling red; Worktree drift 1 dirty. Human override for Heart RED (development only) authorized live by the human for hpc-campaign phase 5 ("Override + approve"). Merge needs green CI and a separate /prm; no release.

Original Prompt

Click to expand

Issued: 2026-10-30
Epic: hpc-campaign
Phase: 5c
Blocked-by: phases 2–4 (COMPLETE 2026-10-30); ruling F3 (yes)
Consequence: judge
Autonomy: human-required
Merge-order: after 5a v2 and 5b (uses their verb/CLI names)

HPC campaign phase 5c — Brain cortex conductor digest + scheduler governance hook

Original request (human, 2026-10-30): "spread across grid bases, prm on those and then we do next phase 5"; plan
approved with "Override + approve" (5a assistant, 5b Cortex, 5c Brain in parallel; 5d pipeline adoption deferred
until DR1 v1.0 ships).

Lane prompt: Workspace/Science/scratch/pyautolens_ii_campaign_results_scoping_2026-10-28/PROMPT_hpc_campaign.md §Phase 5.
@PyAutoBrain: Cortex conductor pull reads the digest (hpc/sync status) instead of raw squeue; scheduler action allowlist in AUTONOMY.md and skills/cortex/cortex.md; PreToolUse hook for Claude and Codex (F12) blocking raw sbatch|scancel|scontrol over ssh outside hpc/sync act/submit; audit-log contract; hook tests.

Activity

  1. Jammy2211 commented on Oct 30, 2026

    @Jammy2211
    ContributorAuthor

    Status 2026-10-30 (session wrap-up)

    The background lane stalled before producing anything (worktree ~/Code/PyAutoLabs-wt/hpc-campaign-p5c-brain clean, no commits). NEXT: restart the lane. Interfaces are now concrete: assistant#172 v2 (hpc/sync act <hold|release|throttle|update-pending|resubmit|cancel>, submit|push-submit the only mutating paths; actions.log JSON lines {utc,user,campaign,action,args,exit} at <project_root>/campaign/<name>/actions.log) and PyAutoCortex#82 (cortex sync-runs <project> --digest <path> [--dry-run], first line sync-runs: <project>: <n> changed; decision 64).

  2. Jammy2211 commented on Oct 31, 2026

    @Jammy2211
    ContributorAuthor

    Status 2026-10-31: lane restarted and built (local, not pushed)

    Commit 2c4b24f on feature/hpc-campaign-p5c-brain, built against autolens_assistant 271f939 (the post-review 5a interface) and PyAutoCortex#83:

    • cortex pull reads the digest instead of squeue. For a row with campaign_file:, it runs <sync_cli> status <campaign_file> in place of jobs. For a row with digest:, it prints what sync-runs <key> --dry-run would change. Pull still writes nothing. You record the result with cortex.py sync-runs <key> (decision 64).
    • Scheduler allowlist (new "Scheduler actions" section in AUTONOMY.md, plus skills/cortex/cortex.md and the conductor AGENTS.md): hpc/sync act <submit|resubmit|hold|release|throttle|update-pending|cancel> is the only way a campaign's jobs start or change. submit/push-submit sbatch one hand-written script, outside any campaign. Read verbs, including pilot, are free. The section also states the actions.log contract (writability checked before acting, then one JSON line {utc,user,campaign,action,args,exit}).
    • bin/scheduler_action_guard.py is a PreToolUse(Bash) hook for Claude and Codex, written to the same contract as mind_commit_guard.py. It refuses raw sbatch, scancel, any mutating scontrol, and python -m autofit.campaign submit (unless --dry-run). That covers commands typed directly, over ssh, in bash -c/eval, behind env or wrapper prefixes, in chains or substitutions, and in heredocs fed to a shell. scontrol show stays allowed, because recording a run as GPU needs gres/gpu from it. A word that is only mentioned (a commit message, a grep) is not a call. It fails open on unparseable shell. The exception is PYAUTO_SKIP_SCHEDULER_GUARD=1.

    Tests: 77 guard tests and 3 new pull/digest tests. Full suite: 1370 passed, 16 failed. All 16 also fail on a clean main (test_hygiene_conductor extras ×6, test_skill_install ×10).

    Not yet done: the independent (different-model) review has not run. Run it before opening the PR.

    Follow-ups:

    • Registration needs a human go-ahead. The hook is not registered in .claude/settings.json or .codex/hooks.json. That belongs to PyAutoMind/scripts/repos_sync.py, and it should land only after the human approves.
    • Cross-lane defect in 5a. At 271f939, pull_campaign rsyncs only *.md/*.json/failed_*.txt/actions.log, which drops tasks.jsonl. Cortex sync-runs needs that file beside digest.json, so a laptop-pulled digest is unreadable. Pull reports "the digest could not be read" and carries on. The fix is in 5a: add --include='tasks.jsonl'.
    • Ruling needed: srun/salloc also start jobs but are outside the F12 scope, so they are not blocked.

    Merge order: after 5a.

  3. Jammy2211 commented on Oct 31, 2026

    @Jammy2211
    ContributorAuthor

    Status 2026-10-31

    PR #548 is open (2c4b24f + review fixes 6b6c11f).

    • Independent review (a different model from the author's): FINDINGS, 4 low items, all fixed with tests.
    • Human rulings: hook registration approved (done after merge: root .claude/settings.json + Mind repos_sync Codex list); the escape hatch stays; srun/salloc are blocked; pull stays write-nothing.
    • Merge order: autolens_assistant#173 → feat: /issue_cleanup — GitHub issue-tracker reconciliation door #174 → this PR. Then register the hook.
  4. Jammy2211 commented on Oct 31, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged in PyAutoBrain#548 (2c4b24f + 6b6c11f + 271ebc1).

    • Cortex pull: a campaign project's pull reads the digest (hpc/sync status) and previews sync-runs --dry-run; it writes nothing.
    • Allowlist: AUTONOMY.md "Scheduler actions" and the Cortex skill.
    • Guard: bin/scheduler_action_guard.py blocks raw sbatch, scancel, srun, salloc, mutating scontrol and raw autofit.campaign submit. The escape hatch works only as the clause prefix.
    • Registration:
      • Claude: live in the workspace-root .claude/settings.json (local); a raw scancel was denied in-session.
      • Codex: PyAutoMind#520 (open); after merge, session_hook_propagate regenerates Brain's .codex/hooks.json.
    • Independent review: 4 findings, all fixed. CI: Brain Tests green on 271ebc1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions