Skip to content

[BUG] First migration fails after creating a new project and agent #2

@fioreagui

Description

@fioreagui

Hey! I'm running into errors when trying the basic setup flow for a new project.

What I did:

  1. Created a new project with cogsol-admin startproject myproject
  2. Created an agent with python manage.py startagent MyAgent
  3. Ran python manage.py makemigrations
  4. Ran python manage.py migrate

What happened:

First, makemigrations fails with an ImportError because the generated agent tries to import ExampleTool from tools.py, but ExampleTool is commented out in the template. You have to manually uncomment it to get past this step.

After uncommenting and running migrate, I get:

API error while applying migrations: Lesson did not include an id: None

I think this is caused by two bugs:

  1. startproject generates ExampleTool commented out, but startagent generates an agent that imports and uses it. The tool should ship uncommented so the default flow works out of the box.

  2. Migration operations are generated in the wrong order. Lessons and FAQs end up before the agent in the migration file, but they depend on the agent existing first. The correct order should be: tools -> agents -> lessons/faqs/fixed_responses.

Files involved:

  • cogsol/core/migrations.py — entity iteration order in diff_states()
  • cogsol/management/commands/startproject.pyTOOLS_PY template

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions