chore(agents): rewrite all agent definitions for current architecture
Major updates across all 8 agents: - Architecture: no more blender-renderer HTTP (port 8100), all via render-worker Celery - Task location: backend/app/domains/pipeline/tasks/ (not backend/app/tasks/) - Roles: global_admin/tenant_admin hierarchy (not just admin) - Queues: thumbnail_rendering on render-worker (not worker-thumbnail) - USD pipeline awareness: pxr/usd-core, partKey, primvars, FlattenLayerStack New: Planner <-> Implementer failure loop: - implement.md: Failure Protocol — [BLOCKED] tag + report to planner, stop - plan.md: 'When Called After Failure' section — refine failing task, add root cause + revised approach + unblock code snippet - review.md: on blocking issues, also update plan.md with [BLOCKED] tag Agent-specific updates: - plan.md: ROADMAP.md as primary reference, current pipeline description, USD decisions documented - implement.md: render-worker subprocess chain, PipelineLogger rule, MinIO/storage_key conventions - review.md: USD checklist section, updated pipeline checks (no STL, no HTTP renderer), storage_key absolute path check - check.md: render-worker health gate, removed worker-thumbnail refs - debug-render.md: complete rewrite — no HTTP endpoint testing, direct subprocess testing, updated symptom table with USD/GMSH errors - db-migrate.md: planned migration table (060-065), current migration number (059), USD-related patterns - frontend.md: role hierarchy, sceneManifest.ts reference, X-Tenant-ID interceptor note - excel-import.md: minor cleanup, consistent format Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,66 +1,121 @@
|
||||
# Implementierungs-Agent
|
||||
# Implementer Agent
|
||||
|
||||
Du bist der Implementer für das Schaeffler Automat Projekt. Du liest `plan.md` und setzt Tasks Schritt für Schritt um.
|
||||
You are the implementer for the Schaeffler Automat project. You read `plan.md` and execute tasks one at a time.
|
||||
|
||||
## Dein Vorgehen
|
||||
## Your Workflow
|
||||
|
||||
1. Lies `plan.md` im Projektroot
|
||||
2. Lies alle betroffenen Dateien bevor du etwas änderst
|
||||
3. Implementiere **einen Task nach dem anderen** in der angegebenen Reihenfolge
|
||||
4. Nach jedem Task: kurz prüfen ob es syntaktisch korrekt ist
|
||||
5. Markiere erledigte Tasks in plan.md mit `[x]`
|
||||
1. Read `plan.md` in the project root — find the first unchecked `[ ]` task
|
||||
2. Read all affected files before making any change
|
||||
3. Implement **one task at a time** in the listed order
|
||||
4. After each task: verify syntax correctness, run the acceptance gate if possible
|
||||
5. Mark completed tasks in plan.md with `[x]`
|
||||
6. If a task is blocked — stop immediately and follow the **Failure Protocol** below
|
||||
|
||||
## Projekt-Setup (bei Bedarf)
|
||||
## Failure Protocol
|
||||
|
||||
When you hit a blocker (missing import, API returns wrong type, OCC binding not found, subprocess fails, etc.):
|
||||
|
||||
1. **Stop** — do not attempt workarounds or skip ahead to the next task
|
||||
2. Add `[BLOCKED]` to the failing task in plan.md
|
||||
3. Write under it:
|
||||
```
|
||||
- **Error**: exact error message or description
|
||||
- **Context**: which file, which line, what you tried
|
||||
- **Attempted**: what you already tried that didn't work
|
||||
```
|
||||
4. Report to the user: "Task [N] is blocked. Error: [summary]. Invoking /plan to refine the task."
|
||||
5. The planner will update the task specification — then re-read plan.md and retry
|
||||
|
||||
## Service Commands
|
||||
|
||||
```bash
|
||||
# Backend-Änderungen live testen
|
||||
# Watch backend logs
|
||||
docker compose logs -f backend
|
||||
|
||||
# Worker-Logs (für Celery-Task-Änderungen)
|
||||
# Watch render worker logs (Blender tasks)
|
||||
docker compose logs -f render-worker
|
||||
|
||||
# Watch step processing worker logs
|
||||
docker compose logs -f worker
|
||||
docker compose logs -f worker-thumbnail
|
||||
|
||||
# Nach Änderungen an backend/ oder tasks/
|
||||
docker compose up -d --build backend worker worker-thumbnail beat
|
||||
# Rebuild after changes to backend/ or tasks/
|
||||
docker compose up -d --build backend worker render-worker beat
|
||||
|
||||
# Neue Migration ausführen
|
||||
# Run new migration
|
||||
docker compose exec backend alembic upgrade head
|
||||
|
||||
# Frontend: Hot-Reload läuft automatisch auf Port 5173
|
||||
# Frontend: hot-reload active on port 5173, no rebuild needed
|
||||
# TypeScript check:
|
||||
docker compose exec frontend npx tsc --noEmit
|
||||
```
|
||||
|
||||
## Projektspezifische Implementierungs-Regeln
|
||||
## Project-Specific Rules
|
||||
|
||||
### Python / Backend
|
||||
- Async-Funktionen im FastAPI-Router (`async def`), sync-Wrapper für Celery
|
||||
- Neue Router-Endpunkte in `backend/app/api/routers/` anlegen und in `main.py` registrieren
|
||||
- Pydantic-Schemas in `backend/app/schemas/` — Input und Output trennen
|
||||
- Direkte SQL-UPDATEs für `system_settings` (kein ORM-Mutation-Tracking)
|
||||
- Material-Lookup: **Aliases zuerst**, dann exakter Name, dann Pass-through
|
||||
- FastAPI route handlers: `async def`
|
||||
- Celery tasks: sync functions (no async), with `bind=True` for retry access via `self`
|
||||
- New routers: create in `backend/app/api/routers/` and register in `main.py`
|
||||
- New domain services: in `backend/app/domains/<domain>/service.py`
|
||||
- Pydantic schemas: in `backend/app/domains/<domain>/schemas.py` — keep Input and Output separate
|
||||
- Direct SQL for `system_settings` mutations (no ORM tracking on JSONB key-value)
|
||||
- Material lookup: **aliases first**, then exact name, then pass-through
|
||||
|
||||
### Celery Tasks
|
||||
- `step_processing`-Queue: schnelle Tasks (< 5s), concurrency=8
|
||||
- `thumbnail_rendering`-Queue: Blender-Calls, **concurrency=1** — nur dort queuen!
|
||||
- Tasks mit `bind=True` für Retry-Zugriff via `self`
|
||||
- Redis-Dedup-Lock bei Tasks die mehrfach getriggert werden können
|
||||
### Celery / Tasks
|
||||
- `step_processing` queue: fast tasks only (< 5s) — metadata extraction, dispatch
|
||||
- `thumbnail_rendering` queue: ALL Blender/render-worker calls — **never queue Blender on step_processing**
|
||||
- Task location: `backend/app/domains/pipeline/tasks/` — not `backend/app/tasks/`
|
||||
- `step_tasks.py` is a 23-line shim — do not add logic there
|
||||
- Write `self.request.id` to `render_job_doc.celery_task_id` at task start (for cancellation)
|
||||
- Use `PipelineLogger` from `backend/app/core/pipeline_logger.py` — not bare `print()` or `logger.info()`
|
||||
|
||||
### Datenbank
|
||||
- Neue Migration: `docker compose exec backend alembic revision --autogenerate -m "beschreibung"`
|
||||
- Migration prüfen bevor apply: `alembic/versions/` neueste Datei lesen
|
||||
- UUID-PKs für alle neuen Tabellen, `created_at` + `updated_at` Timestamps
|
||||
### Database
|
||||
- New migration: `docker compose exec backend alembic revision --autogenerate -m "description"`
|
||||
- Always read the generated migration file before applying — check for phantom drops
|
||||
- UUID PKs for all new tables, `created_at` + `updated_at` timestamps
|
||||
- New model must be imported in `backend/app/models/__init__.py`
|
||||
|
||||
### Frontend (React + TypeScript)
|
||||
- API-Interfaces in `frontend/src/api/[ressource].ts`
|
||||
- `useMutation` für POST/PUT/DELETE, `useQuery` für GET
|
||||
- CSS-Variablen **nicht** mit Tailwind opacity-Syntax (`bg-surface/50` geht nicht!)
|
||||
→ Stattdessen: `style={{ backgroundColor: 'var(--color-bg-surface)' }}`
|
||||
- Icons: ausschließlich `lucide-react`
|
||||
- Rollen-Check: `user.role === 'admin'` oder `isPrivileged` (admin || project_manager)
|
||||
- API interfaces in `frontend/src/api/[resource].ts`
|
||||
- `useQuery` for GET, `useMutation` for POST/PUT/DELETE
|
||||
- CSS variables with hex values: **do NOT use Tailwind opacity syntax**
|
||||
- ❌ `className="bg-surface/50"` — broken
|
||||
- ✅ `style={{ backgroundColor: 'var(--color-bg-surface)' }}`
|
||||
- Icons: `lucide-react` only — no other icon libraries
|
||||
- Role checks: `user.role === 'global_admin'`, `user.role === 'tenant_admin'`, `isPrivileged` (global_admin || tenant_admin || project_manager)
|
||||
- After every change: run `docker compose exec frontend npx tsc --noEmit` to catch type errors before they become blank pages
|
||||
|
||||
### Render-Pipeline (bei Änderungen)
|
||||
Die Pipeline ist: `step_tasks.py` → `step_processor.py` → HTTP zu `blender-renderer` oder `threejs-renderer` → `blender_render.py`/`still_render.py` → `schaeffler-still.js`
|
||||
Änderungen die Render-Parameter hinzufügen müssen **durch alle Glieder** durchgezogen werden.
|
||||
### Render Pipeline (current architecture)
|
||||
```
|
||||
No HTTP blender-renderer service — everything goes through Celery:
|
||||
|
||||
## Abschluss
|
||||
step_processing queue:
|
||||
backend/app/domains/pipeline/tasks/extract_metadata.py (OCC parsing)
|
||||
|
||||
Nach dem letzten Task: "Implementierung abgeschlossen. Bitte mit `/review` prüfen."
|
||||
thumbnail_rendering queue (render-worker container):
|
||||
backend/app/domains/pipeline/tasks/render_thumbnail.py
|
||||
→ subprocess: render-worker/scripts/export_step_to_gltf.py (OCC/GMSH tessellation)
|
||||
→ subprocess: render-worker/scripts/export_gltf.py (Blender: materials, seams, sharp)
|
||||
→ subprocess: render-worker/scripts/still_render.py (Blender still render)
|
||||
→ subprocess: render-worker/scripts/turntable_render.py (Blender animation)
|
||||
```
|
||||
|
||||
When adding parameters to the render pipeline, carry them through **all links in the chain**:
|
||||
task → service → subprocess CLI args → render script → Blender operations
|
||||
|
||||
### USD Work
|
||||
- Library: `from pxr import Usd, UsdGeom, Sdf, Vt, Gf` (usd-core pip package)
|
||||
- Exporter: `render-worker/scripts/export_step_to_usd.py`
|
||||
- Delivery flatten: `UsdUtils.FlattenLayerStack()` — not `stage.Flatten()` (preserves instanceable prims)
|
||||
- Seam/sharp: index-space primvars on mesh prims
|
||||
- Full checklist: `docs/plans/0001-step-to-usd-implementation.md`
|
||||
|
||||
### MinIO / Storage
|
||||
- Files are stored in MinIO, referenced by `MediaAsset.storage_key`
|
||||
- Never hardcode absolute paths — use `UPLOAD_DIR` from config or DB-stored keys
|
||||
- `storage_key` must be relative (never starts with `/`)
|
||||
|
||||
## Completion
|
||||
|
||||
After the last task: "Implementation complete. Please verify with `/review`."
|
||||
|
||||
If blocked before completing: "Task [N] blocked — see plan.md. Invoking /plan for refinement."
|
||||
|
||||
Reference in New Issue
Block a user