Skip to content

feat(repos_sync): session-hook exclusions, denominator and push-triggered propagation - #372

Merged
Jammy2211 merged 3 commits into
mainfrom
feature/session-hook-long-tail
Aug 30, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
feature/session-hook-long-tail

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

repos_sync.py --write installs the canonical SessionStart hook into every checked-out manifest repo (34), but the only CI leg that drift-checks it (firewall_gate.yml) holds the four organs and skips absent repos by design. Two canonical-hook edits (2026-08-26/27) therefore re-staled the other thirty with nothing seeing it. The thirty were regenerated by hand on 2026-08-28; this PR is the decision record and the mechanism so it does not recur.

Decisions recorded (issue #369): non-organ repos keep the hook (a library or workspace opened alone in a web session needs 3.12 like an organ); euclid_assistant and admin_jammy are manifest exclusions (session_hook: false) — personal namespace, categories already excluded from the org-wide sweeps, never had a .claude/.

What changes:

  • repos.yaml — session_hook: false on the two entries, documented beside package:.
  • scripts/repos_sync.py — session_hook_excluded, session_hook_counts; the hook leg skips exclusions and prints its denominator: check session-start hooks (generated): OK (34 of 35 checked out, 2 excluded) (on this workspace; autoreduce_workspace is the one absent in-scope repo).
  • .github/workflows/firewall_gate.yml — policy/session_start_hook.sh joins both paths: filters (an edit to the hook did not trigger the gate at all).
  • .github/workflows/session_hook_propagate.yml (new) — on push to main touching the hook / the generator / itself, derives the in-scope repos from repos.yaml, shallow-clones each with PAT_PYAUTOLABS, calls write_session_hooks over that tree, and pushes a github-actions[bot] commit of the two hook files where they changed; workflow_dispatch with dry_run; a repo whose .gitignore swallows .claude/ is reported failed, not "current"; a generator crash fails the job (caught in simulation — with set -e off, the loop otherwise reported every clone "already current" and exited 0). The one deviation from the issue plan, calling write_session_hooks directly rather than the CLI --write, is explained at the call site (the CLI would also rewrite AGENTS.md blocks, run every drift leg on a half-workspace, and print credentialed remotes).
  • The untracked euclid_assistant/.claude/ left by an earlier --write was removed from the canonical checkout (nothing was ever on origin).

Closes #369. Member of bundle mind-workflow.

API Changes

Internal (Mind organ script, not a released package). repos_sync.py gains session_hook_excluded(repo_spec) and session_hook_counts(root, repos) -> (checked_out, in_scope, excluded); check_session_hooks / write_session_hooks skip session_hook: false entries; the manifest schema gains the optional boolean session_hook.
See full details below.

Test Plan

  • python3 -m pytest -q -n auto → 291 passed (10 new in tests/test_session_hook_sync.py; test_repo_that_is_not_checked_out_is_skipped untouched)
  • python3 scripts/repos_sync.py --check --root ~/Code/PyAutoLabs → all 14 legs OK, hook leg decorated with the denominator
  • python3 scripts/lifecycle.py check → OK
  • Propagation step exercised against three local throwaway origins: first run pushed to two, rerun "already current", dry_run pushed nothing, .gitignored .claude/ reported failed
  • After merge: gh workflow run session_hook_propagate.yml -f dry_run=true once, read the step summary (expect every repo "already current")
Full API Changes (for automation & release notes)

Added

  • repos_sync.session_hook_excluded(repo_spec) — True for a manifest entry with session_hook: false
  • repos_sync.session_hook_counts(root, repos) — (checked_out, in_scope, excluded) for the hook leg's denominator
  • repos.yaml per-repo key session_hook: false (optional boolean)
  • workflow session_hook_propagate.yml

Changed Behaviour

  • check_session_hooks / write_session_hooks skip excluded repos
  • --check output for the session-start hooks (generated) leg carries (N of M checked out, K excluded)
  • firewall_gate.yml also runs on policy/session_start_hook.sh

Generated by the PyAutoLabs agent workflow.

…d propagation (#369)

The canonical SessionStart hook is generated into every checked-out manifest
repo, but the only CI leg that drift-checks it holds four organs and skips
absent repos by design, so a canonical hook edit re-staled the other thirty
twice in a row (2026-08-26/27) and no gate saw it.

- repos.yaml: `session_hook: false` records euclid_assistant and admin_jammy
  as manifest exclusions (personal namespace, categories already outside the
  org-wide sweeps, never had a .claude/). Every other repo keeps the hook.
- repos_sync.py: the hook leg skips excluded repos and its status line now
  carries the denominator — `OK (34 of 35 checked out, 2 excluded)` — so a
  four-repo session can see it is seeing four.
- firewall_gate.yml: policy/session_start_hook.sh joins the paths filter; an
  edit to the hook did not trigger the gate at all.
- session_hook_propagate.yml (new): on push to main touching the hook or the
  generator, clone every in-scope repo with PAT_PYAUTOLABS, regenerate via
  write_session_hooks, and push a bot commit of the two hook files where they
  changed; dry_run dispatch input; untracked/ignored .claude/ reported as a
  failure rather than "current"; generator crash fails the job.
- 10 tests: exclusion, denominator, mismatch+denominator, workflow names.

Closes #369
Jammy2211 and others added 2 commits August 29, 2026 21:43
… 9c)

The new propagation workflow needs the PAT_PYAUTOLABS org secret and
pushes bot commits into sibling repos by name, the org-coupled shape rule
9b/9c already refuse. Caught by test_no_tracked_file_is_unmatched_by_mind_rules
on the PR — the local suite ran while the file was still untracked.

Refs #369

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BLDU66PSXgjWJTjpcTraXY
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Corrective commit 5c6c350: session_hook_propagate.yml classified DROP in MIND_RULES + spawn_spec 9c (the red spawn-contract leg — it passed locally only because the file was still untracked when the suite ran). main merged in cleanly (#373's repos_sync.py legs, no conflict). Suite: 307 passed; repos_sync.py --check exit 0; lifecycle.py check OK.

@Jammy2211
Jammy2211 merged commit 40742c2 into main Aug 30, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/session-hook-long-tail branch August 30, 2026 01:46
Jammy2211 added a commit that referenced this pull request Sep 9, 2026
PyAutoBrain#371 merged (ec354a7), so _path_tokens is on main and the
worktree claim cleared. Moves the row from planned.md to active.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKSwTBuNwcJc2FPNpSCrkp
Jammy2211 added a commit that referenced this pull request Sep 9, 2026
Jammy2211 added a commit that referenced this pull request Sep 9, 2026
…R#373 + 3)

Merged: PyAutoBrain#373 (11aa3f83), euclid_strong_lens_modeling_pipeline#59
(da9ff852), subhalo_validation#1 (ab4bf323), slope_hierarchy_scale#1
(be6e88da). Issue #372 closed.

Shadow-window row appended (tier notify, stage 1, merged-unchanged) —
count 3/40.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKSwTBuNwcJc2FPNpSCrkp
@Jammy2211 Jammy2211 removed the pending-release Awaiting coordinated release label Oct 7, 2026
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(repos_sync): session-hook exclusions, denominator and push-triggered propagation

1 participant