Files
EOS/ai
57905b2024 ci: run the tests in parallel jobs and speed up the Sphinx build
The single test job ran all tests one after the other on one runner,
including the Sphinx build and the Docker checks (11-19 min). It is now
split so that every test still runs exactly once:

- docs-test, docker-test: the Sphinx build (new marker "docs") and the
  Docker / Home Assistant add-on checks ("docker") in jobs of their own.
- test-server: the tests that start EOS or EOSdash on the fixed ports.
  The collection hook marks every test that uses the xprocess fixture
  with "eos_server" and puts them into one xdist group, so
  "pytest -n auto --dist loadgroup" also works locally. A test that
  binds the ports without a fixture carries the marker itself.
- test-shard: all other tests in four shards of about equal runtime
  (scripts/shard_test_files.py, runtimes in scripts/test_durations.json),
  each with pytest-xdist.
- test-count: fails if these parts do not add up to the tests of one
  plain run.
- test: keeps the name of the required check. It prints the combined
  coverage report and fails if any of the jobs above failed.

COVERAGE_CORE=sysmon measures line coverage through sys.monitoring:
the report is the same, the test time drops by about a third. The
combined report misses 1-3 statements more than a single run, in lines
that only run when a test finds state left by an earlier test.

The Sphinx build spent 74 % of its time in one search of
PythonDomain.find_obj (sphinx-doc/sphinx#11282). The local extension
docs/_ext/pyxrefindex.py answers it from an index of name endings with
the same matches in the same order; a build has a byte-identical
objects.inv. It copies the logic of Sphinx 9.0.4 and is only active for
that version; TestPyXrefIndex compares it with the installed Sphinx and
fails after a Sphinx update until the version is raised. The
documentation test builds with -j (up to four jobs); its pages can
differ from a serial build in the target of ambiguous cross-references.
Read the Docs builds without -j. Sphinx build on GitHub runners:
427-480 s -> 180-233 s.

make test-ci runs the commands of these jobs one after the other.

On GitHub runners the tests are done after about 2 minutes; the
required check ends with docs-test after about 4-5 minutes.

Additional changes
Add pytest-xdist to the development dependencies
List the 25 slowest tests in each test job (--durations=25)
Test version() directly; it was covered only through the Sphinx test
Add a "Keep Tests Fast" tip, the server marker rule, the extension and
test-ci to the development guide and the testing skill

Refs #1553

Co-authored-by: SchaafAlexander <86607129+SchaafAlexander@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: SchaafAlexander <86607129+SchaafAlexander@users.noreply.github.com>
Assisted-by: Claude Code (claude-opus-5-5)
Assisted-by: Claude Code (claude-fable-5-2)
2026-11-20 07:15:33 +01:00
..

AkkudoktorEOS AI Development Sandbox

Isolated Docker environment for AI-assisted development (OpenCode + Claude Code + Qwen Code) against the local AkkudoktorEOS repository.

The sandbox does not protect your repository from harmful changes by the agent. It limits what a misled agent can reach on your machine, but the agent can still write any change into the repository. Check every change before you run it on the host, open a pull request or update one. See the security model in docs/develop/ai.md.

Layout

  • compose.yaml – service definition (bind-mounts the repo root to /workspace, with ai/ read-only)
  • Dockerfile – Debian slim + Python 3.13 + uv + Node.js + OpenCode + Claude Code + Qwen Code + gh, with pinned versions
  • entrypoint.sh – container init (exec-bit stripping and reset of the shell startup files in $HOME, warning about active git hooks, uv cache, git config, gh credential helper); installed to /usr/local/bin in the image, outside the ai-home volume
  • .env.example – template, copied to .env on first run
  • run.sh / run.ps1 / run.bat – entry points (prerequisite checks, sanity check of compose.yaml, launch)
  • skills/ – project rules for the agents, indexed in AGENTS.md

Usage

From the repository root:

  • Linux/macOS: chmod +x ai/run.sh && ./ai/run.sh
  • Windows PowerShell: .\ai\run.ps1
  • Windows CMD: ai\run.bat

Options (environment variables):

  • AI_SANDBOX_REBUILD=1 – rebuild the image (e.g. after bumping the agent CLI versions in Dockerfile)
  • AI_SANDBOX_PORTS=1 – publish the ports of compose.yaml (8503 EOS, 8504 EOSdash) on 127.0.0.1 of the host. Off by default, as only one sandbox at a time can publish them. Start the servers with --host 0.0.0.0 inside the container to make them reachable.
  • AI_SANDBOX_SKILLS_RW=1 – make ai/skills writable in the sandbox, so the agent can update the skills. The rest of ai/ stays read-only.

A command after -- runs instead of the shell, e.g. ./ai/run.sh -- claude. In PowerShell the -- is optional: .\ai\run.ps1 claude. On Windows prefer PowerShell 7; run.bat cannot pass ! and % to the container.

On Windows the repository must be checked out with LF line endings, which .gitattributes enforces (see docs/develop/ai.md). In the sandbox, run pre-commit on the changed files only; --all-files fails on the read-only ai/ directory. Changes to ai/ itself (outside ai/skills, or to ai/skills without AI_SANDBOX_SKILLS_RW=1) must be checked on the host for the same reason.

See docs/develop/ai.md for the AI coding workflow.

Inside the container (working dir /workspace):

opencode auth login   # or /connect in the TUI
claude                # then /login on first run
qwen
gh auth login         # then gh auth setup-git

All auth state persists in the akkudoktor-ai-home Docker volume. The local repository is bind-mounted at /workspace, so AI-made changes are visible on the host immediately.

Security notes

  • No privileged mode, no Docker socket, no host home mount, no sudo.
  • ai/ (sandbox definition and launchers) is read-only in the container.
  • .git is writable, so the agent can commit. It can also plant git configuration and hooks that run on the host (e.g. through .git/commondir). Check .git before you run any git command on the host, see the review checklist in docs/develop/ai.md.
  • Git worktree checkouts are not supported: their .git is a file pointing outside the repository, so git does not work in the sandbox.
  • Container user matches the host UID/GID (Linux/macOS) so file ownership is preserved.
  • Credentials are never written to git or to compose.yaml; they live only in the persistent home volume via each tool's own login flow.
  • The home volume persists between sessions. Remove it (docker volume rm akkudoktor-ai-home) if a session may have been misled.
  • The launchers' checks of compose.yaml are a sanity check, not a complete validation.