Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/heart-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,28 @@ on:
schedule:
# Daily 05:00 UTC — one hour ahead of PyAutoMind's morning_health message
# (06:00 UTC), which reads this run's verdict (moved from 06:00 for that).
# Since PyAutoHeart#340 this is the BACKSTOP; the events below refresh the
# feed when its evidence actually moves.
- cron: "0 5 * * *"
workflow_dispatch:
# EVENT TRIGGERS (PyAutoHeart#340, human ruling 2026-11-12: "event triggers
# refresh the feed"). A development ship treats evidence older than 6 h as
# STALE (heart/readiness.py `dev_ship`), so the feed must move when its
# evidence moves, not once a day:
# * repository_dispatch `heart-refresh` — sent by the reusable library
# gate (lib-tests.yml, job `heart-refresh`) when a library's CI finishes
# on `main`, i.e. after every library merge. Any other sender (the
# release workflow) uses the same event type.
# * workflow_run on Release Integrate — the release-validation rehearsal
# lands new release evidence in this repo.
# Bursts coalesce: the concurrency group below keeps one run in flight and
# at most one queued, so ten merges in a minute cost two runs, not ten.
# Both events run on the default branch, so they publish like the cron.
repository_dispatch:
types: [heart-refresh]
workflow_run:
workflows: ["Release Integrate"]
types: [completed]

# contents: write → commit the README badge/block into Heart's OWN README
# issues: write → the [heart-health] tracking issue
Expand Down Expand Up @@ -139,6 +159,9 @@ jobs:
# Read validation artifacts before readiness; never dispatch a run.
PYTHONPATH="$PWD" python -m heart.checks.test_run
PYTHONPATH="$PWD" python -m heart.checks.cloud_validation
# Rehearsed SHA still on main? (M2.4) — after the validation
# report is in, before readiness reads it.
PYTHONPATH="$PWD" python -m heart.checks.rehearsal_ancestry
exit 0

- name: Append today's observations to the timing record
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/lib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -610,3 +610,47 @@ jobs:
{
"text": "${{ github.repository }}/${{ github.ref_name }} (no-jax leg) build result: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}

# EVENT TRIGGER for the Heart feed (PyAutoHeart#340). When a library's CI
# finishes on `main` — after a merge — ask PyAutoHeart's heart-health.yml for
# a fresh board, so a development ship never reads a day-old verdict about
# the library that just moved. The ship gate treats a feed older than 6 h as
# STALE (heart/readiness.py `dev_ship`); this is the trigger that keeps the
# feed young.
#
# Harmless by construction:
# * runs only on a push to `main`, never on a PR or a branch;
# * `always()` — a red run moves the feed as much as a green one;
# * `continue-on-error` — a failed mint or dispatch never reds the
# library's required check (the caller's run conclusion is untouched);
# * it dispatches one `heart-refresh` event and nothing else: Heart's own
# concurrency group coalesces bursts.
# The App token is the org App the Heart already uses (heart-health.yml),
# scoped to the one Heart repo; the caller passes it with `secrets: inherit`.
heart-refresh:
name: Refresh the Heart feed
needs: [unittest, unittest-nojax]
if: ${{ always() && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Mint App token (the Heart repo, contents write for dispatch)
id: app_token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ vars.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: PyAutoHeart
permission-contents: write

- name: Dispatch heart-refresh to heart-health.yml
env:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: |
gh api "repos/${{ github.repository_owner }}/PyAutoHeart/dispatches" \
-f event_type=heart-refresh \
-f "client_payload[source]=${{ github.repository }}" \
-f "client_payload[sha]=${{ github.sha }}" \
-f "client_payload[reason]=library CI finished on main"
echo "heart-refresh dispatched for ${{ github.repository }}@${{ github.sha }}"
9 changes: 6 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ triggers Build. **STALE** is the freshness tier: nothing known-bad, but some
evidence is missing or expired — the remedy is re-running a check, never
fixing code, and evidence whose last known result was adverse stays
yellow/red (`heart/readiness.py` docstring is the canonical definition).
Releases still require GREEN; the dev-ship gate (PyAutoBrain `AUTONOMY.md`
leg 4) treats STALE as passing because an evidence gap is organism-scope,
not branch-scope.
Releases still require GREEN. A development ship asks the scoped gate,
`pyauto-heart readiness --dev --repos A,B --json`: only CI on `main` of the
touched repos and their dependants blocks, every other reason is shown, a
feed older than 6 h is STALE, and STALE never passes (PyAutoHeart#340). It
judges the dev box's local `~/.pyauto-heart/state.json`; the event triggers
refresh the published cloud feed, not that file.

For the release-**validation** rehearsal specifically (build-and-exercise the
exact source about to ship, before promoting to PyPI — see
Expand Down
26 changes: 24 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,35 @@ back to grey after 48 h (`DEVBOX_FRESH_SECONDS`).
script-timing regressions, stale open PRs / parked scripts, skew BEHIND.
- **STALE** — evidence missing or expired with nothing known-bad; the remedy is
re-running a check, never fixing code. Evidence whose last known result was
adverse stays yellow/red. Releases require GREEN; the dev-ship gate treats
STALE as passing (an evidence gap is organism-scope, not branch-scope).
adverse stays yellow/red. Releases require GREEN.
- **GREEN** — none of the above.

`red > yellow > stale > green`. The `score` (0–100) is advisory/sortable only —
the colour is the gate. Persisted to `~/.pyauto-heart/release_ready.json`.

### The development-ship gate (`readiness --dev --repos A,B`)

`dev_ship(snapshot, repos)` answers "may this branch ship?" (PyAutoHeart#340,
human ruling 2026-11-12). It computes the release verdict above and partitions
it: only CI on `main` of the touched repos and of their dependants (the
`dependencies:` graph in `config/repos.yaml`) blocks; every other reason is
carried in `shown_reasons`. In-scope `main` CI is read for a repo of any
group (organs and developer workspaces included); a run with no conclusion
yet is STALE. A touched repo Heart does not poll is STALE ("not polled by
Heart"); a name `config/repos.yaml` never mentions is a usage error. Evidence
older than 6 h (`--max-feed-age-hours`, positive, at most 6), of unknown age,
or dated more than 5 min ahead, is STALE; each CI sidecar is aged by its own
`ts`, the snapshot by its aggregation `ts`. Only GREEN passes
(`"pass": true`); STALE means re-check, or park. The plain `readiness` call —
the release gate — is unchanged. Never persisted.

**What it reads.** The dev box's local `$HEART_STATE_DIR/state.json` (default
`~/.pyauto-heart/state.json`, written by `tick` / `watch`); the verdict's
`source` and `feed_age_hours` say so. The event triggers in `heart-health.yml`
(`repository_dispatch: heart-refresh` from library CI on `main`, Release
Integrate completing) refresh the **published cloud feed** on Pages, which the
Brain's door reads — not this local snapshot. Refresh it locally with `tick`.

## The release freeze window (`freeze`)

A release validation is a window in which the library `main` branches must not
Expand Down
15 changes: 14 additions & 1 deletion bin/pyauto-heart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ cmd_status() {
}

help_readiness() { cat <<EOF
pyauto-heart readiness [--json] [--quiet] [--no-color]
pyauto-heart readiness [--json] [--quiet] [--no-color] [--profile release-ci]
pyauto-heart readiness --dev --repos REPO[,REPO...] [--max-feed-age-hours H] [--json]

Print the composite release-readiness verdict (green / yellow / red + a
0–100 score and the reasons behind it), computed from the cached state on
Expand All @@ -205,6 +206,18 @@ YELLOW = caution (timing regressions, stale PRs/parked scripts, a workspace
This is the authoritative release gate: PyAutoHands is a pure executor and
runs no readiness checks of its own. The release agent dispatches release.yml
only when this verdict is green.

--dev --repos A,B is the DEVELOPMENT-SHIP gate (PyAutoHeart#340): it blocks
only on CI on main of the repos the branch touches and of their dependants
(config/repos.yaml dependencies:), shows every other reason without
blocking, and treats evidence older than 6 h as STALE. Only GREEN passes
("pass": true); STALE means re-check, or park. Any group's main CI counts
for a touched repo; an unpolled repo is STALE; an unknown name is a usage
error. --max-feed-age-hours must be positive and at most 6. --repos implies
--dev. It judges the LOCAL \$HEART_STATE_DIR/state.json (refresh with tick)
and prints that source and its age; the heart-health.yml event triggers
refresh the published cloud feed, not this file. The plain call above is
unchanged.
EOF
}
cmd_readiness() {
Expand Down
72 changes: 72 additions & 0 deletions config/repos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,62 @@ version_skew:
euclid_strong_lens_modeling_pipeline: {library: PyAutoLens, package: autolens}
autolens_assistant: {library: PyAutoLens, package: autolens}

# Development-ship policy (heart/readiness.py `dev_ship`, PyAutoHeart#340).
# A touched repo's own `main` CI blocks a development ship whatever its group;
# for a group with no required workflows (organs, build workflow, developer
# workspaces) that means the runs on its main HEAD. These workflows live in
# such repos but answer the RELEASE question (rehearsal, full-surface sweeps,
# release execution, the release push credential) — the ruling shows release
# scope and never enforces it at a development ship, so they never count as
# the repo's own CI there. Matched by workflow display name (`name:`).
dev_ship:
# A polled repo's OWN CI, for the groups with no required_workflows
# (organs, build workflow, developer workspaces): the workflows that gate
# its pull requests — its test / lint check. Seeded 2026-11-12 from the
# required-check survey (Science/scratch/ecosystem_review_2026-11/
# m2_rulesets/survey.md) and the pull_request-triggered workflows of each
# repo, minus dashboard refreshes. Only these block a development ship;
# every other workflow on the repo (boards, sweeps, scheduled ops) is shown,
# never blocking. `[]` = the repo has no CI to judge. A polled advisory repo
# with NO entry reads STALE ("no CI workflows declared") until one is added.
ci_workflows:
PyAutoBrain: [Brain Tests]
PyAutoHeart: [Heart Tests]
PyAutoHands: [Hands Tests]
PyAutoMind: [Tenant Firewall Gate, Lifecycle Drift, Spawn Drift]
PyAutoEars: [Ears tests]
PyAutoMemory: [validate]
PyAutoEyes: [lint]
PyAutoPulse: [lint]
PyAutoInsight: [lint]
autofit_workspace_developer: []
autolens_workspace_developer: []
release_scope_workflows:
- Release Integrate
- Workspace Smoke
- Workspace Validation
- Release Diagnostic (not validation)
- JAX compatibility endpoints (not release validation)
- Token Push Check
- Python Version Matrix
- PyAuto Release
- Nightly Release

# Library dependency graph: <library> -> the libraries it imports directly.
# Read strictly by heart/readiness.py's development-ship scope (`readiness
# --dev --repos A,B`, PyAutoHeart#340): a branch is blocked by red CI on `main`
# of the repos it touches AND of their dependants — the libraries downstream of
# them in this graph, transitively — and by nothing else. Mirrors the deps map
# in .github/workflows/lib-tests.yml (the install chain each library's own CI
# uses). A library with no entry imports no other library. Release gating does
# not read this block.
dependencies:
PyAutoFit: [PyAutoNerves]
PyAutoArray: [PyAutoNerves]
PyAutoGalaxy: [PyAutoNerves, PyAutoFit, PyAutoArray]
PyAutoLens: [PyAutoNerves, PyAutoFit, PyAutoArray, PyAutoGalaxy]
PyAutoCTI: [PyAutoNerves, PyAutoFit, PyAutoArray]

# Smoke-suite table: the workspaces the local smoke runner (heart/smoke.py)
# can prepare and run — each key names its workspace checkout directory and the
# library install chain — plus the repo -> import-package map the preflight
Expand Down Expand Up @@ -198,6 +254,22 @@ smoke:
excluded:
- autolens_assistant # public-facing template
- autolens_profiling # profiling project
- PyAutoReduce # standalone library (own lib-tests.yml caller); not polled — a dev ship touching it reads STALE
# Body-map repos (PyAutoMind/repos.yaml) Heart does not poll. Named so a
# development ship touching one reads STALE ("not polled by Heart") rather
# than failing as an unknown name; poll one to give its branches a verdict.
- PyAutoBroca
- PyAutoCortex
- PyAutoDNA
- PyAutoGut
- PyAutoScientist
- ECLIPSE_lens_catalogue
- autocti_assistant
- autofit_assistant
- autogalaxy_assistant
- euclid_assistant
- autoreduce_workspace
- pyautolabs.github.io
- autolens_inference # inference benchmark project (search/inference runs; results tracked)
- autolens_visualization # lens figure gallery project (PNGs + manifest tracked; re-rendered on release)
- autogalaxy_visualization # galaxy figure gallery project (PNGs + manifest tracked; re-rendered on release)
Expand Down
13 changes: 13 additions & 0 deletions health_agent/capabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ gate:
HEADs and whose profile == release. Absent/stale/SHA-mismatch/wrong-profile
→ YELLOW; a failed validation stage → RED. This is the M2 hard gate: no
release rehearsal for the current source can no longer be GREEN.
dev_ship_gate:
command: "pyauto-heart readiness --dev --repos A,B --json"
returns: "{ gate: dev-ship, verdict: green|stale|red, pass, scope{touched,dependants,enforced,not_polled}, red_reasons[], stale_reasons[], shown_reasons[], organism_verdict, feed_age_hours, max_feed_age_hours, remedy }"
rule: >-
PyAutoHeart#340 (human ruling 2026-11-12). A development ship blocks only
on CI on `main` of the repos the branch touches and of their dependants
(config/repos.yaml dependencies:); every other reason is shown in
shown_reasons, not blocking. Evidence older than 6 h, or of unknown age,
is STALE; only GREEN passes; STALE means re-check, or park. Release
gating is unchanged. It judges the dev box's LOCAL
~/.pyauto-heart/state.json (named in `source`, aged in
feed_age_hours); the heart-health.yml event triggers refresh the
published cloud feed instead.

# Continuous checks — cheap, run every <30s tick (heart/tick.sh).
continuous_checks:
Expand Down
Loading
Loading