Repository navigation
Conversation
…rack sweep (trinity-enterprise#76) Brain-Orb-capable templates COMMIT their convention hooks under .trinity/brain-orb/ (scopes/scope/search/action). The fleet gitignore migration appends `.trinity/` on every push and then `git rm --cached`s ignored-but-tracked files — which untracked the hooks and pushed their deletion, so any later re-clone/recreate booted hookless. - _build_rm_cached_ignored_command: pathspec-exempt `.trinity/brain-orb` from both the emptiness probe and the removal pipe; sibling .trinity/ files are still swept. - compatibility S-005: accept the `.trinity/*` star form (the only shape a template can commit re-included hooks under — git cannot re-include beneath a dir-form exclusion) as satisfying the ignore intent, so the compat panel doesn't flag Brain-Orb templates and its auto-fix doesn't churn. - Regression tests for both (real git repo + snapshot check). Co-Authored-By: Claude Fable 5 <[email protected]>
…trinity-enterprise#76) Caught by the live e2e Push: the fleet .trinity/ append made the template's committed setup.sh ignored-but-tracked and the sweep untracked it — a re-clone of the synced agent repo would never run its startup setup (Brain Orb seed copy + hook chmod). Same class as the brain-orb hook deletion; same fix. Co-Authored-By: Claude Fable 5 <[email protected]>
dolho
left a comment
There was a problem hiding this comment.
Review — approve-with-a-question. Solid, surgical fix with an excellent real-git regression test; I reproduced one sibling of the same bug that isn't covered.
I ran the branch's actual _build_gitignore_merge_command + _build_rm_cached_ignored_command output against a real git repo mirroring the scenario (plus a .trinity/pre-check file):
BEFORE: brain-orb/action, brain-orb/scopes, pre-check, runtime-state.yaml, setup.sh (tracked)
AFTER merge+sweep: brain-orb/action, brain-orb/scopes, setup.sh ✅ survive
runtime-state.yaml ✅ swept (correct)
.trinity/pre-check ❌ SWEPT
What's right
- Root cause is correct: the fleet merge appends dir-form
.trinity/, which defeats the template's!.trinity/brain-orb/re-include → hooks become ignored-but-tracked → thegit rm --cachedsweep untracks them. The pathspec exemption is the correct, surgical compensation, applied to both the probe and the removal pipe (consistent), with a positive-- .pathspec so the:!excludes have something to subtract. No injection risk (hardcoded constants,git_dirisshlex.quoted). - S-005 change is correct and complete for the shapes in play.
- Tests are excellent — real git, asserts survival AND that siblings are still swept AND the working tree is untouched; the live e2e actually caught the
setup.shcase.
The one substantive point (see inline): .trinity/pre-check (SCHED-COND-001 / #454 — a documented template-committed convention hook) hits the identical bug and isn't exempted. Fine to scope this PR to #76 and file a follow-up, but it shouldn't be left silent since a template that ships pre-check will have it untracked on the first Push.
Nit: commit.gpgsign false in the test is fine (throwaway repo), just noting it's local-repo config.
| hookless and never runs its startup setup (verified live: the e2e Push | ||
| swept setup.sh before the second exemption was added). | ||
| """ | ||
| exempt = '":!.trinity/brain-orb" ":!.trinity/setup.sh"' |
There was a problem hiding this comment.
Verified (real git): .trinity/pre-check — a documented template-committed convention hook (SCHED-COND-001, #454) — is swept by this same pipe because it isn't in the exempt set, so a template shipping it re-hits exactly the bug this PR fixes (untracked on first Push → re-clone boots without it).
Two options: add .trinity/pre-check here now, or scope this PR to #76 and file a follow-up for the general class.
Nit while here: this exempt list will grow one path at a time. Promoting it to a named module constant (e.g. _TEMPLATE_COMMITTED_TRINITY_PATHS) makes adding pre-check a one-liner and self-documents the growing allowlist.
Summary
github:Abilityai/cornelius) COMMIT their convention files — the.trinity/brain-orb/{scopes,scope,search,action}hooks and.trinity/setup.sh. The fleet gitignore migration (_migrate_workspace_gitignore, run on every operator Push) appends the fleet-wide.trinity/ignore and thengit rm --cacheds ignored-but-tracked files — untracking those files and pushing their deletion, so a later re-clone/recreate boots hookless and never runs startup setup._build_rm_cached_ignored_commandnow pathspec-exempts.trinity/brain-orband.trinity/setup.shfrom both the emptiness probe and the removal pipe; sibling.trinity/runtime files are still swept..trinity/*star form — the only shape a template can commit re-included hooks under (git cannot re-include beneath a dir-form exclusion) — so the compat panel doesn't flag Brain-Orb templates and its auto-fix doesn't churn.Changes
src/backend/services/git_service.py— sweep exemptions (probe + removal pipe)src/backend/services/compatibility/static_checks.py— S-005 accepts.trinity/*tests/unit/test_github_init_gitignore.py— real-git regression test (hooks + setup.sh survive the merge+sweep; sibling state still swept; working tree untouched)tests/unit/test_compatibility_checks.py— S-005 star-form snapshot testTest Plan
pytest tests/unit/test_github_init_gitignore.py tests/unit/test_compatibility_checks.py— 43 passedcornelius-e2efromgithub:Abilityai/cornelius, ran an operator Push through this backend — all 6 hook files +setup.shstayed tracked, the vault capture committed, non-exempt.trinity/state was swept. (The pre-fix backend reproduced the bug: the first Push deletedsetup.sh— caught live, second exemption added.)Part of abilityai/trinity-enterprise#76 (Brain Orb full cycle from the public cornelius template — agent-side kit shipped in
Abilityai/cornelius@1ce85bd).🤖 Generated with Claude Code