Skip to content

docs: optimize AI agent sandbox instructions#1041

Open
lengau wants to merge 8 commits into
mainfrom
work/clankers
Open

docs: optimize AI agent sandbox instructions#1041
lengau wants to merge 8 commits into
mainfrom
work/clankers

Conversation

@lengau
Copy link
Copy Markdown
Collaborator

@lengau lengau commented Mar 19, 2026

Updates CLANKERS.md to improve the AI agent sandbox configuration instructions.

Changes:

  • Recommends mapping the host user to the 'ubuntu' user (UID 1000) for more consistent permissions.
  • Employs '--type native' for Multipass mounts to prevent Errno 75.
  • Explicitly forbids the use of 'snapcraft --destructive-mode'.
  • Suggests using 'CRAFT_VERBOSITY_LEVEL=debug' for greater build visibility.
  • Adds troubleshooting steps for fixing nested snapd/LXD issues within the sandbox.

- Map host user to 'ubuntu' user (UID 1000) for consistent permissions
- Use '--type native' for Multipass mounts to avoid Errno 75
- Explicitly forbid 'snapcraft --destructive-mode'
- Add CRAFT_VERBOSITY_LEVEL=debug for better build visibility
- Add troubleshooting for nested snapd/LXD issues
@lengau lengau requested a review from a team as a code owner March 19, 2026 22:54
Copilot AI review requested due to automatic review settings March 19, 2026 22:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new .github/CLANKERS.md guide intended for AI agents contributing to craft-application, with a strong focus on consistent local sandbox/VM setup for Snapcraft-based end-to-end testing.

Changes:

  • Introduces AI-agent oriented repository context (architecture, workflow, standards, testing strategy).
  • Documents manual sandbox setup for LXD (lxc CLI) and Multipass, including UID/GID mapping and recommended environment variables.
  • Adds a troubleshooting checklist for nested snapd/LXD issues inside the sandbox.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/CLANKERS.md Outdated
Comment thread .github/CLANKERS.md Outdated
Comment thread .github/CLANKERS.md Outdated
Comment thread .github/CLANKERS.md Outdated
Comment thread .github/CLANKERS.md Outdated
lengau and others added 3 commits March 19, 2026 21:22
- Restore accidentally-removed documentation commands (make docs,
  make lint-docs)
- Fix Multipass bootstrap section (had launch/mount/start duplicated
  instead of the actual bootstrap commands)
- Add one-time snapcraft LXD profile setup instructions with the
  actual fix for the nested CAP_MAC_ADMIN/AppArmor issue
- Add structured snap build troubleshooting section
- Provide snark credit where snark credit is due

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix malformed > [!IMPORTANT] admonition syntax
- Document why security.privileged=true is required (CAP_MAC_ADMIN
  delegation for nested snapcraft containers)
- Rename 'LXC' labels to 'LXD' throughout — the lxc CLI is the LXD
  client, not LXC; using LXC terminology is confusing
- Fix prose: 'cd (multipass)' → '--working-directory (multipass)'
- Add HYPOTHESIS_SUPPRESS_HEALTH_CHECK=too_slow to Multipass example
  to match the existing note about it

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/CLANKERS.md
- `security.privileged=true` / `security.nesting=true` — allow the nested build container to run snaps.
- `lxc.apparmor.profile = unconfined` — removes AppArmor confinement from the build container so `snapd` can operate.
- `lxc.cap.drop =` (empty) — clears LXD's default capability drop list, restoring `CAP_MAC_ADMIN` and `CAP_MAC_OVERRIDE` so `apparmor_parser` can load profiles inside `snapd`.

Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions here explicitly disable AppArmor confinement (lxc.apparmor.profile = unconfined) and clear the capability drop list for nested build containers. That materially weakens sandbox isolation; the doc should add a clear WARNING about the security implications and steer readers toward safer alternatives (e.g., prefer host builds on Linux / avoid inside-container builds unless strictly necessary).

Suggested change
**WARNING:** The above LXD profile settings significantly weaken the isolation of the nested build container by disabling AppArmor confinement and restoring powerful capabilities on the inner container. Only use this configuration in disposable, trusted environments where you fully control both host and guest. Prefer building snaps directly on a Linux host or in a dedicated VM, and avoid running nested privileged build containers inside another sandbox unless it is strictly necessary for your workflow.

Copilot uses AI. Check for mistakes.
lengau and others added 3 commits March 19, 2026 21:42
security.privileged=true and security.nesting=true were only ever
needed for running snapcraft pack from inside the container. Since
snapcraft now runs on the host, a plain unprivileged container is
sufficient for all dev/test tasks. Document this clearly.

Also: counter-counter-snark applied. The wall is gone. So is the
room it was guarding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Added Cursor-specific snark regarding rule-file hierarchies.
- Made snapcraft installation optional in the sandbox container since packing is now primarily host-based.

Authored by a clanker.
Comment thread .github/CLANKERS.md
Copy link
Copy Markdown

Copilot AI commented Mar 20, 2026

@bepri I've opened a new pull request, #1042, to work on those changes. Once the pull request is ready, I'll request review from you.

Discovered during container validation that omitting security.nesting=true
causes LXD integration tests to hang silently forever rather than failing
with a useful error. Since nesting carries no meaningful security cost
(unlike security.privileged), just include it unconditionally.

Also: warned Gumloop agents about their operator's wallet.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mr-cal
Copy link
Copy Markdown
Contributor

mr-cal commented Mar 20, 2026

Proof that LLMs were trained on facebook and nextdoor comments

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.

5 participants