Skip to content

Workspace Smoke runs nightly when a main moved, and accepts pinned SHAs (M3.7d) - #355

Merged
Jammy2211 merged 3 commits into
mainfrom
feature/workspace-smoke-nightly
Nov 19, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
feature/workspace-smoke-nightly

Conversation

@Jammy2211

@Jammy2211 Jammy2211 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Closes #354 (M3.7d, epic autonomous-orchestrators).

Summary

  • Nightly schedule. The workspace-smoke.yml cron is now 0 3 * * *. The old Monday 03:00 run is one of these. This entry only ever tests main.

  • Gate job. A new first job runs .github/scripts/smoke_sha_gate.py. It resolves the commit of every library and workspace the sweep checks out (git ls-remote). The script names no repo and no owner. It reads the covered repos from workspace-validation.yml itself, the one source of truth for what the sweep checks out: the libraries come from the body's for lib in clone loops, and the workspaces from find_scripts' declare -A WS map. A reshaped body fails the gate loudly. The owner comes from github.repository_owner. This keeps Heart's Python clear of instance facts, as the organ tenant firewall requires. It then reads two things from runs on main:

    • the workspace-smoke-shas artifact of the last successful run;
    • the conclusion of the latest completed run.

    It skips the sweep only when all of these hold:

    • force is not set;
    • the latest completed run concluded success;
    • a record was readable;
    • no SHA differs from that record;
    • the last full sweep is under 7 days old.

    A skipped run concludes success. Its summary starts "Workspace sweep skipped: no main moved since run ", where <id> is the last full sweep.

  • Why each extra rule exists.

    • The 7-day floor keeps the old weekly coverage of changes that arrive without a main moving, such as PyPI dependency updates.
    • The latest-run rule stops a skip from hiding a newer red run (a flake, or a dependency that moved) behind an older green sweep. In that case the reason is "last run concluded ".
  • force dispatch input (boolean, default false). It sweeps even when nothing moved, with the reason "forced by dispatch". A plain dispatch still skips when nothing moved; the shift-end dispatch relies on that.

  • Fallback. No previous run, an expired artifact, or a run from before this change means "run the sweep". An ls-remote failure or an unresolvable pin fails the gate, so the run goes red rather than skipping silently.

  • Pinned bisect runs have their own entry: workspace-smoke-pinned.yml.

    • It is dispatch-only and takes a required commit_shas input: JSON {repo: full-sha | branch | tag}. Unknown repo names are rejected; unlisted repos use main; an empty map is refused.
    • It runs the same gate script in pin mode, which resolves the SHAs, writes the record and always sweeps. Then it calls workspace-validation.yml in smoke mode.
    • Because it has its own run history, a pinned run that passes on an old SHA never becomes the smoke verdict Heart reads, nor the gate's baseline. Example: gh workflow run workspace-smoke-pinned.yml -f commit_shas='{"PyAutoGalaxy":"<sha>"}'.
  • The sweep tests exactly what was recorded. Both entries pass the full resolved map as commit_shas to workspace-validation.yml. In smoke mode, every workspace checkout (find_scripts, generate_notebooks, run_scripts, run_notebooks) and both library clone loops now check out those SHAs, so a main that moves mid-run cannot split the run across commits. (Before this PR, smoke mode ignored commit_shas and always cloned main.) Release mode is unchanged: refs={} there, and its commit_shas still only labels the release report.

  • SHA record on every run. Every run, swept or skipped, uploads workspace-smoke-shas/shas.json: run_id, event, swept, reason, full_sweep_run_id, full_sweep_created_at, previous_run_id, pinned and commit_shas. The summary shows the same table. Read it with gh run download <id> --repo PyAutoLabs/PyAutoHeart -n workspace-smoke-shas.

Heart test_run leg (design and age rule)

  • Age rule (unchanged): readiness.py marks the leg STALE when the latest run's createdAt is more than TEST_STALE_DAYS = 10 days old.
  • Branch filter (new): _cloud_verdict now lists runs with --branch main, so a dispatch from a feature branch is no longer read as the smoke verdict. Run 43034177136 was one such dispatch. This was a one-line change, with a test.
  • Skipped nights stay fresh. A skipped run concludes success with a fresh createdAt, so a quiet week cannot age the evidence into STALE. This is correct because the code on main is exactly the code that the last full sweep passed, the latest run was green, and the gate forces a full sweep at least every 7 days.
  • A skip is not read as a fresh full sweep. test_run.run() takes a new injected cloud_sha_fetcher. main() passes it, and the result is cached per run id like the report artifact. When the record says swept: false, the leg:
    • takes its counts from the attested full sweep's report;
    • sets sweep_skipped, full_sweep_run_id and full_sweep_ts;
    • labels the result cloud#<full> (re-attested by #<skip>: no main moved).
  • Extra sidecar fields. commit_shas is added to the sidecar. A missing record (older runs, expired artifact, no gh) behaves exactly as before.

Run 43034177136 (2026-11-11): real failure, not a flake

It was dispatched on Heart's feature/jax-floor-0-12 branch, which installs jax/jaxlib 0.12.0.1. Two scripts failed with a deterministic AssertionError:

  • autogalaxy_workspace_test scripts/misc/latent/zero_contour_compat_jax.py
  • autolens_workspace_test scripts/misc/jax_assertions/critical_curves_zero_contour_jit_grad.py

This is the zero-contour gradient regression under jax 0.12. The jax-floor PRs dealt with it the next day: autogalaxy_workspace_test 7ea166ba (NEEDS_FIX) and autolens_workspace_test 1585db2f (taken off the smoke allowlist). After that, 43218299026 passed. Before this PR, test_run read that branch run as the smoke verdict; with --branch main it no longer would.

Witness

The witness 3 command is now gh workflow run workspace-smoke-pinned.yml -f commit_shas='{"PyAutoGalaxy":"<sha>"}', and the record lands in that run's workspace-smoke-shas artifact. The architect amends the Mind prompt's witness to match.

# Item Verified locally Needs a run on main
1 nightly schedule:; pins go to the body through the pinned entry yes (YAML parse, actionlint, wiring tests) no
2 no-move night ends in under 2 min, success, "no main moved since run " decision (including the latest-run and force rules), summary text and job wiring unit-tested; the gh --jq "latest completed run" expression was run read-only against the real history yes: the first scheduled run after merge always sweeps, because no earlier run has a record. The skip can only show up the night after that.
3 workspace-smoke-pinned.yml dispatch runs against that SHA and records it the library clone step was run verbatim against local repos and lands on the pin; checkout ref: expressions wiring-tested yes: needs a real pinned dispatch, which also checks that GitHub serves a fetch by SHA
4 every run writes its SHAs to the summary and an artifact record and summary contents unit-tested yes: artifact upload and summary rendering
5 test_run reads the latest completed run on main; a skip does not make it STALE yes (unit tests in tests/test_test_run.py) the real artifact download is exercised only once runs exist

API Changes

None to the published libraries. Heart-internal changes:

  • heart.checks.test_run.run() gains an optional cloud_sha_fetcher keyword.
  • New constant SHA_ARTIFACT and new helper _cloud_sha_record.
  • _cloud_verdict now filters with --branch main.
  • New sidecar keys: sha_record, sha_record_run_id, commit_shas, pinned, sweep_skipped, full_sweep_run_id, full_sweep_ts.
  • New workflow: workspace-smoke-pinned.yml.
  • workspace-smoke.yml dispatch inputs: force only.

Test Plan

  • Tenant firewall: python3 PyAutoMind/scripts/repos_sync.py --check --only "tenant firewall (organ code)" --root <root>, run locally with the CI layout (PyAutoMind and PyAutoHeart side by side), reports check tenant firewall (organ code): OK. Against c3bd55f it reproduced CI's 3 mismatches.
  • The gate run end to end locally against the real body and real ls-remote: with no record it sweeps 15 repos, and with that record as the previous one it skips ("no main moved since run 1").
  • python -m pytest -q -n 4: 1519 passed, run from the task worktree. This includes tests/test_smoke_sha_gate.py and tests/test_test_run.py (new tests for force, the red-latest-run rule, the --branch main filter, and the shape of the pinned entry), plus tests/test_workflow_wiring.py.
  • yaml.safe_load and actionlint (without shellcheck) on workspace-smoke.yml, workspace-smoke-pinned.yml, workspace-validation.yml and release-integrate.yml: clean. Untouched workflows have their own actionlint findings, which this PR leaves alone.
  • Heart dev readiness for PyAutoHeart: GREEN. Shown reasons, not blocking: manifest drift (end-at-deliverable blocks: 46 mismatches; generated hooks: 2 mismatches), and "release validation incomplete: no rehearsal for current source".
  • After merge: the first scheduled run sweeps and uploads a record, and the next night with no move should skip. One workspace-smoke-pinned.yml dispatch confirms witness 3.

No workflow was dispatched for this PR.

Review: architect session, round 1 FINDINGS (1 high, 1 medium, 2 low), fixed.

🤖 Generated with Claude Code

Jammy2211 and others added 3 commits November 19, 2026 12:22
… (M3.7d)

workspace-smoke.yml runs nightly at 03:00 UTC. A gate job
(.github/scripts/smoke_sha_gate.py) resolves the commit of every library and
workspace the sweep covers and compares it with the SHA record of the last
successful run on main; when none moved and the last full sweep is under 7
days old it skips the sweep (success, "no main moved since run <id>").
Every run uploads the workspace-smoke-shas artifact and a summary table of
the SHAs tested. A workflow_dispatch commit_shas input pins repos, never
skips, and workspace-validation.yml now checks out smoke-mode repos at the
resolved SHAs. Heart's test_run reads a skipped night as a re-attestation of
the full sweep it names: counts come from that sweep, the label says so, and
the skip run's timestamp keeps the evidence fresh.

Refs #354

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pt (review round 1)

- workspace-smoke-pinned.yml: dispatch-only bisect entry with a required
  commit_shas input; workspace-smoke.yml loses the input and only tests main,
  so a pinned pass on an old SHA never becomes the smoke verdict or the
  gate's baseline.
- The gate sweeps when the latest completed run on main did not conclude
  success ("last run <id> concluded <conclusion>"), so a skip cannot mask a
  newer red run behind an older green sweep.
- workspace-smoke.yml gains a `force` dispatch input ("forced by dispatch");
  a plain dispatch still skips when nothing moved.
- test_run reads only runs on main (--branch main), so a feature-branch
  dispatch is not read as the smoke verdict.

Refs #354

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (tenant firewall)

smoke_sha_gate.py no longer names any repo or owner: load_covered() reads
the libraries (the body's `for lib in` loops) and workspaces (find_scripts'
`declare -A WS` map) from workspace-validation.yml, the one source of truth
for what the sweep checks out, and the owner comes from
github.repository_owner. Both entries' gate checkouts widen the sparse
checkout to .github. Tests use placeholder repos; the agreement test checks
every checkout in the body names a covered repo without literal names.

Refs #354

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 8ab527d into main Nov 19, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/workspace-smoke-nightly branch November 19, 2026 12:37
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.

feat: Workspace Smoke nightly when a main moved, commit_shas input (M3.7d)

1 participant