Skip to content

[fix] Build the records sequence index concurrently - #6576

Merged
mmabrouk merged 1 commit into
feat/session-live-eventsfrom
fix/session-live-events-index
Sep 5, 2026
Merged

[fix] Build the records sequence index concurrently#6576
mmabrouk merged 1 commit into
feat/session-live-eventsfrom
fix/session-live-events-index

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Sep 5, 2026

Copy link
Copy Markdown
Member

Context

The session live-events migration built a unique index on the existing records table with a regular CREATE UNIQUE INDEX. On a large tracing table, that blocks record writes for the duration of the build even when all live-events flags are off.

Changes

Build ux_records_session_id_sequence with PostgreSQL's concurrent index mode inside an Alembic autocommit block. The downgrade uses the same concurrent path when dropping the index. The nullable records.sequence column addition is unchanged.

Tests

  • nice -n 19 uv run --no-sync pytest -o 'addopts=-ra --self-contained-html' oss/tests/pytest/unit/migrations/test_tracing_session_sequence_chain.py oss/tests/pytest/unit/migrations/test_tracing_session_sequence_migration.py -q
  • Verified upgrade and downgrade against empty and 4,096-row records tables in the disposable agenta_m2idx_tracing database.
  • nice -n 19 uvx ruff@0.15.12 format .
  • nice -n 19 uvx ruff@0.15.12 check --fix .

https://claude.ai/code/session_0164kzT6ttwpBtzvcDC6YzYk

Create and drop the records sequence index concurrently from Alembic autocommit blocks so populated tracing tables remain writable during the index operation.

Cover empty and populated-table upgrades and downgrades in a disposable tracing database.

Claude-Session: https://claude.ai/code/session_0164kzT6ttwpBtzvcDC6YzYk
@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 5, 2026 2:16pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • release/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: cc137a79-2656-4b27-bf5a-1ae513d634ae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Comment @coderabbitai help to get the list of available commands.

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SHIP

The migration builds and drops the unique records sequence index concurrently inside Alembic autocommit blocks, while leaving the nullable column addition unchanged. The disposable PostgreSQL test covers empty and 4,096-row upgrades and downgrades, verifies the unique index definition, and confirms existing rows and payloads remain intact. Focused migration tests and the Ruff 0.15.12 API pass are clean.

@mmabrouk
mmabrouk merged commit c47d89e into feat/session-live-events Sep 5, 2026
40 checks passed
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-6576.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-6576-c670253
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-09-05T14:28:28.128Z

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.

1 participant