Skip to content

chore(openai-conversation): Remove Unused OpenAI Conversations module - #1427

Open
Ayush8923 wants to merge 1 commit into
chore/cleanups-unwnated-modulesfrom
chore/remove-openai-conversations
Open

Ayush8923 wants to merge 1 commit into
chore/cleanups-unwnated-modulesfrom
chore/remove-openai-conversations

Conversation

@Ayush8923

@Ayush8923 Ayush8923 commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Closes #1382

What Changed

  • Removed the /api/v1/openai-conversation router and all 5 endpoints: GET /{id}, GET /response/{response_id}, GET /ancestor/{ancestor_response_id}, GET "" (list) and DELETE /{id}.
  • Dropped the openai_conversation table in Alembic migration 095 (revises 094). The downgrade recreates the empty table and its 4 indexes, but not the data.
  • Removed the OpenAIConversation, OpenAIConversationBase, OpenAIConversationCreate and OpenAIConversationPublic models.
  • Removed the openai_conversation CRUD functions: create_conversation, delete_conversation, get_ancestor_id_from_response and the other get_conversation* lookups.
  • Removed the openai_conversations relationship from Project and from Organization.
  • Removed the "OpenAI Conversations" OpenAPI tag and its endpoint docs. Also dropped "conversations" from the project and organization hard_delete docs and docstrings, and updated the wiki (INDEX.md, domain-map.md, modules/assistants.md).

Summary

The module is no longer used, so this PR removes its whole vertical slice, from the route down to the table.

 backend/app/
 ├── alembic/versions/
+│   └── 095_drop_openai_conversation_table.py   # drop table; downgrade = empty schema
 ├── api/
 │   ├── docs/
-│   │   └── openai_conversation/*.md
 │   ├── main.py                                  # include_router(openai_conversation) removed
 │   └── routes/
-│       └── openai_conversation.py
 ├── crud/
-│   └── openai_conversation.py
 ├── models/
-│   ├── openai_conversation.py
 │   ├── organization.py                          # openai_conversations relationship removed
 │   └── project.py                               # openai_conversations relationship removed
 └── tests/
-    ├── api/routes/test_openai_conversation.py
-    └── crud/test_openai_conversation.py

Evidence

  • Before: api_router.include_router(openai_conversation.router) exposed /api/v1/openai-conversation/*, backed by the openai_conversation table.
    After: The router, models, CRUD functions and table are gone. The dedicated route and CRUD test suites were deleted along with the module.
  • Booted the app locally with fastapi run --reload app/main.py / docker compose up (checklist item below). No test run output is attached.

Merge Danger

Door: one-way

Migration 095 runs op.drop_table("openai_conversation"), which deletes every existing row. Running the downgrade restores only an empty table so that older code can boot. The data is not recoverable unless it is backed up before the upgrade.

Blast Radius: API consumers

  • Any client still calling /api/v1/openai-conversation/* will now get 404s.
  • The "OpenAI Conversations" section disappears from the OpenAPI docs.
  • Deployed environments lose all stored conversation rows on upgrade, so check whether anything needs archiving before running migrations.

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

Notes

Previous PR description

Issue

Closes #1382

Summary

  • Removed the OpenAI Conversations Module which is not used anymore.

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

Notes

Remove the /openai-conversation read and delete endpoints, their CRUD,
model, docs and tests, and the Project/Organization relationships.
Migration 095 drops the openai_conversation table; its downgrade
recreates the empty table as it stood at 094.
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4f68004 and 953eeec.

Files selected for processing: 24

  • backend/app/alembic/versions/095_drop_openai_conversation_table.py
  • backend/app/api/docs/openai_conversation/delete.md
  • backend/app/api/docs/openai_conversation/get.md
  • backend/app/api/docs/openai_conversation/get_by_ancestor_id.md
  • backend/app/api/docs/openai_conversation/get_by_response_id.md
  • backend/app/api/docs/openai_conversation/list.md
  • backend/app/api/docs/openapi_config.py
  • backend/app/api/docs/organization/delete.md
  • backend/app/api/docs/projects/delete.md
  • backend/app/api/main.py
  • backend/app/api/routes/openai_conversation.py
  • backend/app/crud/__init__.py
  • backend/app/crud/openai_conversation.py
  • backend/app/crud/organization.py
  • backend/app/crud/project.py
  • backend/app/models/__init__.py
  • backend/app/models/openai_conversation.py
  • backend/app/models/organization.py
  • backend/app/models/project.py
  • backend/app/tests/api/routes/test_openai_conversation.py
  • backend/app/tests/crud/test_openai_conversation.py
  • docs/wiki/INDEX.md
  • docs/wiki/domain-map.md
  • docs/wiki/modules/assistants.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot changed the title chore(conversations): Remove the OpenAI Conversations module chore(conversations): Remove OpenAI Conversations module Dec 4, 2026
@Ayush8923
Ayush8923 added this pull request to stack #1432 December 4, 2026 17:34
@Ayush8923
Ayush8923 marked this pull request as ready for review December 4, 2026 17:35

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Besides the inline finding, I checked two other things and found no problems in either.

  • Downgrade indexes: the indexes that 095's downgrade recreates are the same set that existed at 094. That is the project_id index plus the three partial deleted_at IS NULL indexes from 058, minus the three that 059 dropped.
  • Leftover references: nothing outside older migrations and the updated wiki line still mentions openai_conversation or OpenAIConversation.
Extended reasoning...

I compared the recreated index names and predicates in 095's downgrade against migrations 058 and 059. I also searched the repo for remaining references to the removed model and table, and found them only in historical migrations and the updated wiki line.



def upgrade():
op.drop_table("openai_conversation")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (optional) During a deploy, admins on still-running old tasks get 500s on every project and organization hard delete. The migration runs before the new image takes over. upgrade() drops openai_conversation while old code still maps it through cascade_delete=True relationships. Fix: split the removal across two releases. Ship the code removal now and drop the table in a later migration, after no running code references it. Otherwise, document that the drop must run only after the old tasks are drained.

Why this was flagged

deploy-staging-ecs.yml runs a one-off task with alembic upgrade head in its "Run database migrations" step. Only after that does "Deploy to ECS and verify rollout" start, with a 15-minute timeout, so base-image tasks keep serving after 095 has run. In the base code, Project.openai_conversations and Organization.openai_conversations were Relationship(..., cascade_delete=True). SQLModel turns that into an ORM delete cascade without passive_deletes. So session.delete(project) in hard_delete_project (crud/project.py:180) and the organization hard delete both SELECT from openai_conversation before deleting. Once 095 has dropped the table, those SELECTs fail with UndefinedTable. Project and org hard deletes then return 500 on old tasks until the rollout finishes. The base branch has no such window. The DB-level ON DELETE CASCADE does not help, because the ORM query runs first. This is a cost beside the PR's purpose of removing the module, not something the purpose requires. Dropping the table in a later release avoids it.

Verification: The migration drops the table outright: op.drop_table("openai_conversation") (095_drop_openai_conversation_table.py:21-22). The base image still maps that table. On an old task, the hard-delete flush issues the collection SELECT against the dropped table. It fails with UndefinedTable / ProgrammingError, so the delete request returns 500. Nothing handles old code running after the upgrade.

@Ayush8923 Ayush8923 self-assigned this Dec 4, 2026
@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Ayush8923 Ayush8923 changed the title chore(conversations): Remove OpenAI Conversations module chore(conversations): Remove Unused OpenAI Conversations module Dec 4, 2026
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

OpenAPI changes   🔴 7 breaking changes

Caution

Downstream consumers may need an update before merging.

Breaking changes  ·  7
Method Path Change
🔴 GET /api/v1/openai-conversation API path removed without deprecation
🔴 GET /api/v1/openai-conversation/ancestor/{ancestor_response_id} API path removed without deprecation
🔴 GET /api/v1/openai-conversation/response/{response_id} API path removed without deprecation
🔴 DELETE /api/v1/openai-conversation/{conversation_id} API path removed without deprecation
🔴 GET /api/v1/openai-conversation/{conversation_id} API path removed without deprecation
🔴 POST /api/v1/responses API path removed without deprecation
🔴 POST /api/v1/responses/sync API path removed without deprecation
Full changelog  ·  17
Method Path Change
🔴 GET /api/v1/openai-conversation API path removed without deprecation
🔴 GET /api/v1/openai-conversation/ancestor/{ancestor_response_id} API path removed without deprecation
🔴 GET /api/v1/openai-conversation/response/{response_id} API path removed without deprecation
🔴 DELETE /api/v1/openai-conversation/{conversation_id} API path removed without deprecation
🔴 GET /api/v1/openai-conversation/{conversation_id} API path removed without deprecation
🔴 POST /api/v1/responses API path removed without deprecation
🔴 POST /api/v1/responses/sync API path removed without deprecation
🟢 — — removed the schema APIResponse_CallbackResponse_
🟢 — — removed the schema APIResponse_OpenAIConversationPublic_
🟢 — — removed the schema APIResponse_ResponseJobStatus_
🟢 — — removed the schema APIResponse_list_OpenAIConversationPublic__
🟢 — — removed the schema CallbackResponse
🟢 — — removed the schema Diagnostics
🟢 — — removed the schema OpenAIConversationPublic
🟢 — — removed the schema ResponseJobStatus
🟢 — — removed the schema ResponsesAPIRequest
🟢 — — removed the schema ResponsesSyncAPIRequest

main ↔ dde85c0b · generated by oasdiff

@Ayush8923 Ayush8923 added the breaking-change-approved Reviewer-acknowledged API breaking change label Dec 5, 2026
@Ayush8923 Ayush8923 changed the title chore(conversations): Remove Unused OpenAI Conversations module chore(openai-conversation): Remove Unused OpenAI Conversations module Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change-approved Reviewer-acknowledged API breaking change ready-for-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cleanup: Remove unused backend modules

1 participant