phase 4: fix execution FK violation — create entity row before insert

- phase3.go: RequestExecution now calls InsertEntity before InsertExecution
  (executions.entity_id references entities.id via FK constraint).
- mcp/server.go: request_execution MCP tool same fix — inserts entities row
  with slug 'exec:<target>:<id8>' before executions insert.
- docker-compose.yml: fix seed OIKOS_SEEDS_DIR from /app/seeds to /seeds
  (distroless image COPY destination).
This commit is contained in:
2026-07-07 16:45:28 +02:00
parent 3823a82417
commit 74a6b6bb18
3 changed files with 23 additions and 1 deletions

View File

@@ -243,6 +243,16 @@ func newServer(pool *db.Pool, agentID uuid.UUID) *mcp.Server {
}
correlationID := uuid.New().String()
execSlug := "exec:" + targetSlug + ":" + id.String()[:8]
_, err = pool.Exec(ctx, `
INSERT INTO entities (id, slug, type, name, attributes)
VALUES ($1, $2, 'execution', $3, '{}')`,
id, execSlug, action+" on "+targetSlug)
if err != nil {
return textResult(fmt.Sprintf("insert entity: %v", err)), nil
}
_, err = pool.Exec(ctx, `
INSERT INTO executions (entity_id, target_entity_id, action, risk_class,
status, correlation_id, agent_id)