feat(cli): enforce operator init distro#1255
Open
joshuajbouw wants to merge 11 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an operator-controlled boundary for astrid init so embedded distributions can enforce an init distro via ASTRID_ENFORCED_DISTRO, preventing callers from overriding it while preserving standalone Astrid’s requirement for an explicit --distro when no operator value is present.
Changes:
- Resolve
ASTRID_ENFORCED_DISTROduringastrid initdispatch and reject any CLI--distrooverride when it’s set. - Add targeted unit tests for neutral/enforced/override-rejection and malformed operator values, plus a CLI parsing regression for leading global options.
- Document the new operator hook in the changelog under
[Unreleased].
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/astrid-cli/src/dispatch.rs | Adds ASTRID_ENFORCED_DISTRO resolution logic for init and unit tests covering enforced/neutral/invalid cases. |
| crates/astrid-cli/src/cli.rs | Adds a parsing regression test ensuring global options before init don’t interfere with --distro. |
| CHANGELOG.md | Documents the new operator-enforced init distro hook under [Unreleased]. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
astrid init installed a distro's capsules per-principal but attached no capsule-access grants, so a non-default principal ended up with the capsule files yet no authority to invoke their tools — provisioning it required an out-of-band, hand-SYNC'd `agent modify --add-capsule` step. Add an opt-in --grant-capsules flag (only meaningful with --distro) that, after the distro's capsules install, grants access for exactly the installed set through the same admin.agent.modify kernel path as `agent modify --add-capsule`, now factored into a shared apply_agent_modify helper. Idempotent across re-runs (kernel apply_set_delta dedups; a failed first grant recovers on the fresh-lock re-run). No-op for the default principal, which holds admin *. Without the flag a non-default install prints the exact agent modify command; on grant failure the capsules are already installed and init exits non-zero with the recovery command. Closes #1195
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked Issue
Closes #1253
Depends on #1196. This PR targets
mainand contains settled #1196 head34a3a02a7ad1ab266586c3dd548d6d2cac8f188eas a signed merge parent. Merge #1196 first; GitHub will then narrow this stacked diff to the enforced-distro hook.Summary
Adds a generic embedding boundary for distributions that ship Astrid Runtime. A launcher can set the distro used by
astrid initwithout copying Astrid's argument grammar, and Astrid rejects a simultaneous caller--distrooverride.ASTRID_ENFORCED_DISTROis a process environment input, not a privileged Astrid security boundary. An embedding launcher such as AOS must overwrite any inherited value before executing Astrid. A caller invoking standalone Astrid can set its own process environment; standalone Astrid remains neutral and still requires an explicit distro when the variable is absent.Changes
ASTRID_ENFORCED_DISTROat init dispatch--distrowhenever an embedding launcher supplies the environment value--distrorequirement when the value is absent--grant-capsulespath[Unreleased]Verification
be84f920d2c921709ee92bd0fa4b8b9f0532d195a83f537ad20728cedc89495a14df312dd8a46becand settled feat(cli): grant installed distro capsules to the target principal #119634a3a02a7ad1ab266586c3dd548d6d2cac8f188e/private/tmp/astrid-1196-1255-preview-v2integration tree exactly in both previously conflicting CLI filescargo fmt --all -- --checkcargo metadata --locked --no-deps --format-version 1git diff --checkastridCLI execution was attempted locally, but the cold macOS build did not complete in a bounded window; replacement GitHub CI is the execution gateDependency handling
This PR still targets
main. #1196 must land first; GitHub will then narrow the diff to this additive embedding hook. No product-specific privilege path is introduced.Checklist
[Unreleased]No release is created or published by this change.