Skip to content

Conversation

@nishu-builder
Copy link
Contributor

@nishu-builder nishu-builder commented Jan 17, 2026

Summary

  • Created models/episodes.py with Episode and EpisodeTag SQLModel models
  • Created queries/episode_queries.py with SQLAlchemy query functions
  • Updated routes/stats_routes.py to use the new query module
  • Removed episode methods and classes from MettaRepo (EpisodeReplay, EpisodeWithTags, record_episode, get_episodes)

Part of stack to migrate app_backend from raw SQL to SQLAlchemy.

@nishu-builder nishu-builder marked this pull request as ready for review January 17, 2026 21:17
Copy link
Contributor Author

nishu-builder commented Jan 17, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • add-to-merge-queue - adds this PR to the back of the merge queue
  • add-to-merge-queue-as-hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4f9c98716

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +97 to +98
await session.flush()
return id

Choose a reason for hiding this comment

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

P1 Badge Commit episode inserts before leaving session

record_episode only calls flush() and returns; with_db/db_session() never commits, so the AsyncSession will roll back when the context exits. This means bulk uploads and episode inserts appear to succeed but nothing is persisted unless the caller commits (the stats route doesn’t). Add an explicit await session.commit() (or wrap in a transaction that commits) before returning to avoid losing writes.

Useful? React with 👍 / 👎.

@graphite-app graphite-app bot force-pushed the nishad/sqlalchemy-migration branch from 19c4a42 to afc9c59 Compare January 17, 2026 21:20
@graphite-app graphite-app bot force-pushed the nishad/sqlalchemy-episodes branch from 5fe8ccc to 2348b66 Compare January 17, 2026 21:20
@datadog-official

This comment has been minimized.

@blacksmith-sh

This comment has been minimized.

Nishad and others added 2 commits January 18, 2026 20:46
- Update Episode model with missing fields (data_uri, primary_pv_id, thumbnail_url, eval_task_id)
- Add EpisodeTag model
- Create queries/episode_queries.py with record_episode and get_episodes
- Update stats_routes.py to use new episode queries
- Move EpisodeWithTags model to episode_queries.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nishu-builder nishu-builder force-pushed the nishad/sqlalchemy-migration branch from 9d4cd17 to fa7f5de Compare January 19, 2026 04:49
@nishu-builder nishu-builder force-pushed the nishad/sqlalchemy-episodes branch from 85cbe40 to 0efd8de Compare January 19, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants