Skip to content

chore(threads): Remove Unused Threads Module - #1431

Open
Ayush8923 wants to merge 1 commit into
chore/remove-v1-eval-writesfrom
chore/remove-threads
Open

Ayush8923 wants to merge 1 commit into
chore/remove-v1-eval-writesfrom
chore/remove-threads

Conversation

@Ayush8923

@Ayush8923 Ayush8923 commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Closes #1382

What Changed

  • Removed Threads endpoints: POST /threads, POST /threads/sync, POST /threads/start, GET /threads/result/{thread_id}
  • Dropped openai_thread table in migration 098 (revises 097). Rows are deleted on upgrade, and downgrade recreates only the empty schema.
  • Removed helpers used only by Threads:
    • OpenAIThread / OpenAIThreadBase / OpenAIThreadCreate
    • upsert_thread_result / get_thread_result
    • LangfuseTracer and _to_usage_details
    • configure_openai
  • Removed the Threads OpenAPI tag: deprecated_tags goes from ["Assistants", "Threads"] to ["Assistants"]
  • Deleted tests for the removed code: test_threads.py, test_langfuse_tracer.py, test_thread_result.py. Wiki docs are updated to match.

Summary

The Threads module is no longer used, so the route, model, CRUD, tracer and their tests are removed together.

 backend/app/
 ├── alembic/versions/
+│   └── 098_drop_openai_thread_table.py   # drop_table("openai_thread")
 ├── api/
 │   ├── docs/
-│   │   └── threads/examples.py
 │   ├── main.py                            # - include_router(threads.router)
 │   └── routes/
-│       └── threads.py
 ├── core/
 │   ├── langfuse/langfuse.py               # - class LangfuseTracer
 │   └── util.py                            # - configure_openai()
 ├── crud/
-│   └── thread_results.py
 └── models/
-    └── threads.py

observe_llm_execution stays in place. Its comment no longer points at LangfuseTracer.__init__ and now inlines the multi-tenant client note.

Evidence

  • Before: /api/v1/threads* routes are registered, and the openai_thread table exists.
    After: The routes and table are removed. The author ran fastapi run --reload app/main.py / docker compose up locally (see checklist).

No test output or screenshots are attached. The tests for the removed code are deleted, and no new tests are added.

Merge Danger

Door: one-way

Migration 098 drops openai_thread, and all rows are lost on upgrade. downgrade() recreates the empty table and the ix_openai_thread_thread_id index so older code can boot. It does not restore the data. Back up the table before deploying if you need to keep its history.

Blast Radius: API consumers

  • Any client still calling /api/v1/threads, /threads/sync, /threads/start or /threads/result/{id} will now get 404.
  • Any out-of-tree code importing LangfuseTracer, configure_openai, OpenAIThread* or the thread CRUD functions will fail to import.
  • This is a stacked PR targeting chore/remove-v1-eval-writes. Migration 098 assumes 097 is the head, so merge order matters.

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 threads 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 deprecated /threads endpoints, the OpenAIThread model, the
thread-result CRUD, docs and tests. LangfuseTracer and
configure_openai had no other callers left, so they go too.

Migration 098 drops the openai_thread table; its downgrade recreates
the empty table as it stood at 097.
@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 5f0041a and e439d97.

Files selected for processing: 18

  • backend/app/alembic/versions/098_drop_openai_thread_table.py
  • backend/app/api/docs/openapi_config.py
  • backend/app/api/docs/threads/examples.py
  • backend/app/api/main.py
  • backend/app/api/routes/threads.py
  • backend/app/core/langfuse/langfuse.py
  • backend/app/core/util.py
  • backend/app/crud/__init__.py
  • backend/app/crud/thread_results.py
  • backend/app/models/__init__.py
  • backend/app/models/threads.py
  • backend/app/tests/api/routes/test_threads.py
  • backend/app/tests/core/test_langfuse/conftest.py
  • backend/app/tests/core/test_langfuse/test_langfuse_tracer.py
  • backend/app/tests/crud/test_thread_result.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

@Ayush8923
Ayush8923 added this pull request to stack #1432 December 4, 2026 17:34
@github-actions github-actions Bot changed the title chore(threads): Remove the Threads module chore(threads): Remove deprecated module Dec 4, 2026
@Ayush8923 Ayush8923 changed the title chore(threads): Remove deprecated module chore(threads): Remove threads module Dec 4, 2026
@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.

I reviewed this PR and didn't find any bugs. Migration 098 permanently deletes the openai_thread rows and the PR removes the public /threads endpoints, so it's worth having a human confirm that both are intended for deployed environments.

What was reviewed:

  • The 098 downgrade, compared against migrations 011/040 and the old model: column types, nullability, comments, the PK and the unique ix_openai_thread_thread_id index all match the table as it stood at 097.
  • Leftover references: no Python code under backend/ still uses LangfuseTracer, _to_usage_details, configure_openai, OpenAIThread, thread_results or the threads router.
  • The changes to observe_llm_execution are limited to a comment, and the imports that are still used were kept.
Extended reasoning...

The change deletes about 1,800 lines: the deprecated Threads router, model, CRUD, OpenAPI docs, the LangfuseTracer class, the configure_openai helper and their tests. It also adds migration 098, which drops the openai_thread table, and updates three wiki pages. The security-sensitive surface is none beyond removing endpoints. The code looks mechanically correct and the downgrade schema matches the original. I deferred because the upgrade irreversibly destroys stored thread data and removes a public API, which is a product and operations decision a person should sign off on.

@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(threads): Remove threads module chore(threads): Remove Unused Threads module Dec 4, 2026
@Ayush8923 Ayush8923 changed the title chore(threads): Remove Unused Threads module chore(threads): Remove Unused Threads Module Dec 4, 2026
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

OpenAPI changes   🔴 25 breaking changes

Caution

Downstream consumers may need an update before merging.

Breaking changes  ·  25
Method Path Change
🔴 GET /api/v1/documents/transformation API path removed without deprecation
🔴 GET /api/v1/documents/transformation/{job_id} API path removed without deprecation
🔴 POST /api/v1/evaluations API removed without deprecation
🔴 POST /api/v1/evaluations/datasets API removed without deprecation
🔴 POST /api/v1/evaluations/{evaluation_id}/improve-prompt API path removed without deprecation
🔴 POST /api/v1/fine_tuning/fine_tune API path removed without deprecation
🔴 GET /api/v1/fine_tuning/{document_id} API path removed without deprecation
🔴 GET /api/v1/fine_tuning/{fine_tuning_id}/refresh API path removed without deprecation
🔴 POST /api/v1/model_evaluation/evaluate_models API path removed without deprecation
🔴 GET /api/v1/model_evaluation/{document_id} API path removed without deprecation
🔴 GET /api/v1/model_evaluation/{document_id}/top_model API path removed without deprecation
🔴 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
🔴 POST /api/v1/threads API path removed without deprecation
🔴 GET /api/v1/threads/result/{thread_id} API path removed without deprecation
🔴 POST /api/v1/threads/start API path removed without deprecation
🔴 POST /api/v1/threads/sync API path removed without deprecation
🔴 POST /api/v1/documents removed the request property callback_url
🔴 POST /api/v1/documents removed the request property target_format
🔴 POST /api/v1/documents removed the request property transformer
Full changelog  ·  55
Method Path Change
🔴 GET /api/v1/documents/transformation API path removed without deprecation
🔴 GET /api/v1/documents/transformation/{job_id} API path removed without deprecation
🔴 POST /api/v1/evaluations API removed without deprecation
🔴 POST /api/v1/evaluations/datasets API removed without deprecation
🔴 POST /api/v1/evaluations/{evaluation_id}/improve-prompt API path removed without deprecation
🔴 POST /api/v1/fine_tuning/fine_tune API path removed without deprecation
🔴 GET /api/v1/fine_tuning/{document_id} API path removed without deprecation
🔴 GET /api/v1/fine_tuning/{fine_tuning_id}/refresh API path removed without deprecation
🔴 POST /api/v1/model_evaluation/evaluate_models API path removed without deprecation
🔴 GET /api/v1/model_evaluation/{document_id} API path removed without deprecation
🔴 GET /api/v1/model_evaluation/{document_id}/top_model API path removed without deprecation
🔴 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
🔴 POST /api/v1/threads API path removed without deprecation
🔴 GET /api/v1/threads/result/{thread_id} API path removed without deprecation
🔴 POST /api/v1/threads/start API path removed without deprecation
🔴 POST /api/v1/threads/sync API path removed without deprecation
🔴 POST /api/v1/documents removed the request property callback_url
🔴 POST /api/v1/documents removed the request property target_format
🔴 POST /api/v1/documents removed the request property transformer
🟢 — — removed the schema APIResponse_CallbackResponse_
🟢 — — removed the schema APIResponse_DocTransformationJobPublic_-Input
🟢 — — removed the schema APIResponse_DocTransformationJobPublic_-Output
🟢 — — removed the schema APIResponse_DocTransformationJobsPublic_
🟢 — — removed the schema APIResponse_FineTuningJobPublic_
🟢 — — removed the schema APIResponse_ModelEvaluationPublic_
🟢 — — removed the schema APIResponse_OpenAIConversationPublic_
🟢 — — removed the schema APIResponse_ResponseJobStatus_
🟢 — — removed the schema APIResponse_list_FineTuningJobPublic__
🟢 — — removed the schema APIResponse_list_ModelEvaluationPublic__
🟢 — — removed the schema APIResponse_list_OpenAIConversationPublic__
🟢 — — removed the schema Body_Evaluation-evaluate
🟢 — — removed the schema Body_Evaluation-upload_dataset
🟢 — — removed the schema Body_Fine_Tuning-fine_tune_from_CSV
🟢 — — removed the schema CallbackResponse
🟢 — — removed the schema Diagnostics
🟢 — — removed the schema DocTransformationJobPublic
🟢 — — removed the schema DocTransformationJobsPublic
🟢 — — removed the schema FineTuningJobPublic
🟢 — — removed the schema ModelEvaluationCreate
🟢 — — removed the schema ModelEvaluationPublic
🟢 — — removed the schema ModelEvaluationStatus
🟢 — — removed the schema OpenAIConversationPublic
🟢 — — removed the schema ResponseJobStatus
🟢 — — removed the schema ResponsesAPIRequest
🟢 — — removed the schema ResponsesSyncAPIRequest
🟢 — — removed the schema StartThreadRequest
🟢 — — removed the schema TransformationJobInfo
🟢 — — removed the schema TransformationStatus
🟢 POST /api/v1/documents removed the optional property data/anyOf[subschema #1: DocumentUploadResponse]/transformation_job from the response with the 200 status

main ↔ 51024c50 · generated by oasdiff

@Ayush8923 Ayush8923 added the breaking-change-approved Reviewer-acknowledged API breaking change label 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