Files
lai_automatisierung/README.md
Christian Meyer 25ed6a8439
Some checks failed
CI / test (push) Has been cancelled
CI / test (pull_request) Has been cancelled
feat: replace Aider with secure mini-SWE-agent worker
2026-08-31 02:46:58 +02:00

2.4 KiB

LAI Coding Automation

This service turns explicitly queued Gitea issues into reviewed pull requests. It no longer reads the Laravel production database and does not merge changes automatically.

Workflow

  1. LAI creates one Gitea issue for a wrong-answer report and labels it ai:queued.
  2. This worker replaces the label with ai:running, clones main, and creates ai/issue-N.
  3. mini-SWE-agent 2.4.6 implements the issue in a credential-free, unprivileged command environment.
  4. The worker rejects protected paths, symlinks, empty patches, and oversized diffs.
  5. Deterministic setup and test commands run with isolated test database credentials.
  6. A pull request containing Fixes #N, the original problem, changed files, and checks is opened.
  7. The issue is labeled ai:ready or ai:failed and receives a status comment.

Human review and merge are always required.

Security boundary

  • Gitea and model credentials exist only in the root worker process.
  • Agent-issued commands receive a strict environment without inherited worker variables.
  • The agent runs as the unprivileged coder user.
  • Git metadata lives outside the writable worktree, and Git hooks are disabled for commits.
  • The Docker socket is not mounted. Repository cloning and pushing use HTTPS with a temporary GIT_ASKPASS credential file that is deleted immediately.
  • .env, CI, Docker/deployment files, dependencies, generated storage, and symlinks are rejected.

The container is the intended execution boundary. Do not run the worker directly on a developer host.

Configuration

Copy .env.example to .env and set GITEA_TOKEN plus MISTRAL_API_KEY. Existing test database settings can be retained. Commands are separated with ;;. Laravel's default connection uses TEST_DB_NAME, the ERP connection uses TEST_CUSTOMER_DB, and cross-schema cockpit fixtures use TEST_CONFIG_DB. The worker enables database integration tests and supplies a non-secret placeholder AI key so mocked provider-discovery tests execute deterministically. Real Gitea and model credentials are never copied into the test or agent command environment.

Start the worker with Docker Compose. Use lai-agent check inside the image for configuration validation, lai-agent preflight for clean-clone setup and tests without a model call, or lai-agent once for a single polling cycle.

Archived implementation

The previous database-polling Aider implementation is preserved unchanged in old_2026-08-31/.