You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2026/10/05 17:48:19 UTC
[PR] feat(config): keep install-only personal config in the git directory [magpie]
potiuk opened a new pull request, #1533:
URL: https://github.com/apache/magpie/pull/1533
## What
A project that only **installs** Magpie families, without adopting Magpie (no committed `.apache-magpie.lock`), no longer gets anything in its working tree.
Its personal configuration layer moves to `<git-common-dir>/apache-magpie/`.
That location is never committed, needs no ignore entry, and is shared by every worktree of the clone.
Adopted projects keep `.apache-magpie-local/` and `.apache-magpie-overrides/` exactly as before.
This is the code half (resolution, tools, pre-flight finding).
The skill text, the pre-flight block invocation, the setup modes and the docs follow in the next PR.
### The rule
[`setup_preflight/layers.py`](plugins/magpie-setup/skills/setup/setup_preflight/layers.py):
| Project | Personal layer |
|---|---|
| adopted (`.apache-magpie.lock`) | `<repo>/.apache-magpie-local/` |
| not adopted, git repo | `<git-common-dir>/apache-magpie/` |
| not adopted, not a git repo | none |
- The layer is looked up first, then a legacy in-tree `.apache-magpie-local/` in an unadopted repo, then `.apache-magpie-overrides/`.
- The git common directory is computed by reading `.git` / `commondir`, never by spawning `git`, because the pre-flight runs sandboxed on every invocation.
- A read never creates the directory.
- `python3 -m setup_preflight.layers` prints the layout as JSON for skills that need to write it.
The tools that resolve configuration carry identical copies, kept in step by an AST test:
- release-config
- adversarial-review
- the privacy-llm checker
- agent-guard
- the status collector
- container-gateway
- sandbox-lint
`vetted-ops` and `generate-cve-json` stay overrides-only on purpose: their policy is committed by design.
### Behaviour changes
- **Pre-flight:** a new `legacy-local-dir` finding fires for an unadopted repo that still has an in-tree `.apache-magpie-local/`.
The legacy dir keeps working in the meantime.
The finding offers, only with explicit confirmation, to:
- move its contents into the git-directory home;
- drop the `.git/info/exclude` line;
- repoint gateway socket entries.
- **privacy-llm checker (fix):** it never read the personal layer, only `.apache-magpie/` and the overrides, so a personally configured `privacy-llm.md` was ignored.
It now reads personal → legacy → overrides.
It also no longer looks in the framework snapshot, which `upgrade` replaces and which ships no such file.
- **container-gateway:** an unadopted repo serves from `<git-common-dir>/apache-magpie/run/<worktree-id>/` (`main` for the main checkout, else the worktree's gitdir name).
That gives one gateway per worktree, as before.
- Each level is created one at a time with mode 0700.
- `serve` refuses socket paths over the `sun_path` limit.
- The run dir and the personal layer are never accepted as bind sources; the comparison resolves symlinks on both sides.
- **Worktree anchor check:** a linked worktree's common dir comes from its `.git` file, which an agent can rewrite.
The gateway therefore accepts it only the way git links a worktree to its repository:
- the common dir is owned by the user and not group- or world-writable;
- it holds `HEAD` and `objects/`;
- `worktrees/<name>/gitdir` points back at this worktree.
- **sandbox-lint:** exempts exactly the new socket location.
- **status:** reports where the personal layer is, and warns about a legacy in-tree dir.
### `privacy-llm.md`, where it lives now
`privacy-llm.md` declares every LLM in the project's active stack and the third-party endpoints the team approved.
Skills that may read `<private-list>` content run the privacy-llm checker against it as a gate before they start; an unapproved entry, or no file at all, stops the skill.
The checker looks it up in this order; the first file found wins:
| # | Location | When |
|---|---|---|
| 1 | `--config <path>` / `$PRIVACY_LLM_CONFIG` | explicit override |
| 2 | `<repo>/.apache-magpie-local/privacy-llm.md` | personal layer of an adopted project (gitignored) |
| 2 | `<git-common-dir>/apache-magpie/privacy-llm.md` | personal layer of an install-only project (never committed, shared by worktrees) |
| 3 | `<repo>/.apache-magpie-local/privacy-llm.md` in an unadopted repo | legacy, until `legacy-local-dir` moves it |
| 4 | `<repo>/.apache-magpie-overrides/privacy-llm.md` | committed project-wide declaration (adopted projects) |
What changes for users:
- **Install-only users:** `setup-privacy-llm` writes the file to the personal layer, and the gate now actually reads it there.
Before this PR the checker looked only in `.apache-magpie/` and the overrides, so a personally declared stack was ignored.
- **Personal file wins:** a maintainer can declare a stricter or different stack for their own runs without editing the project's committed file.
- **Snapshot no longer read:** `.apache-magpie/privacy-llm.md` is no longer looked in, because the snapshot is replaced on `upgrade` and the framework ships no such file.
If anyone kept a hand-placed copy there, the gate now stops with "no config found" and lists the paths it tried.
It can only stop, never wrongly pass.
The checker README, [`tools/privacy-llm/models.md`](tools/privacy-llm/models.md) and [`docs/setup/privacy-llm.md`](docs/setup/privacy-llm.md) are updated to match.
### Specs
`adoption-and-setup.md`, `privacy-llm-gate.md` and `container-gateway.md` are updated.
## Testing
- `prek run --all-files` is green.
- Per-package pytest, ruff and mypy pass for every touched package.
- New `test_layers.py` files cover:
- the main checkout, linked worktrees (relative and absolute `commondir`) and submodules;
- not-a-repo and malformed `.git` files;
- planted or forged common dirs, a missing back-link and a group-writable `.git`;
- bind exclusion through a symlinked path.
- The 4 real-podman integration tests in container-gateway fail identically on `main` (the gateway refuses the libpod image-pull endpoint), so that is unrelated to this change.
---
Gen-AI disclosure: prepared with the assistance of Claude Code (Claude Opus 5); reviewed by the author.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(config): keep install-only personal config in the git directory [magpie]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #1533:
URL: https://github.com/apache/magpie/pull/1533
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org