Skip to content

fix(migrations): renumber instance_id migration to 209 - #1126

Merged
jlav merged 2 commits into
mainfrom
jl/fix-duplicate-migration-207
Nov 2, 2026
Merged

jlav merged 2 commits into
mainfrom
jl/fix-duplicate-migration-207

Conversation

@jlav

@jlav jlav commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

  • A human has tested these changes.

AGENT:


Why

main has two migrations with revision 207, and both revise 206. #1119 added 207_add_startup_title_generation.py, and #1114 added 207_add_instance_id_to_instance_settings.py. Then #1121 put 208 on top of one of them.

Alembic now sees two heads, so alembic upgrade head fails. The app crashes at startup when RUN_MIGRATIONS_ON_STARTUP=true, so the docker compose stack doesn't come up. The unit test DB template can't migrate either.

Summary

  • Renames the instance_id migration to 209 and sets down_revision to 208, so the chain is linear again with one head.

Issue Number

How to Test

  • uv run alembic heads prints only 209 (head).
  • docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build brings the app up healthy. The DB ends at 209 with instance_settings.instance_id present.
  • uv run pytest tests/unit/test_migration_graph.py tests/unit/test_enterprise_migration_integrity.py tests/unit/test_migration_207_startup_titles.py passes. On main these error while building the test DB template.

Video/Screenshots

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

#1114 merged after #1121, so a database migrated from main before #1114 is already at 208. On that database, upgrade head only runs 209.


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-2495a88

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

⚠️ This PR contains migrations. Please synchronize before merging to prevent conflicts.

@github-actions github-actions Bot added the type: fix A bug fix label Nov 2, 2026
@jlav
jlav enabled auto-merge (squash) November 2, 2026 16:53

@tofarr tofarr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🍰

The openhands logger is configured with propagate=False, so pytest's caplog
attaches its handler directly to it. Setting propagate=True mid-test also sent
each record to the root logger, which holds the same caplog handler, so every
warning was captured twice and the single-record unpacking failed.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  migrations/versions
  209_add_instance_id_to_instance_settings.py
Project Total  

This report was generated by python-coverage-comment-action

@jlav
jlav merged commit cb96a01 into main Nov 2, 2026
23 checks passed
@jlav
jlav deleted the jl/fix-duplicate-migration-207 branch November 2, 2026 17:55
@openhands-release-bot openhands-release-bot Bot added the released: 1.83.0 Shipped in 1.83.0 label Nov 2, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.83.0.

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

Labels

released: 1.83.0 Shipped in 1.83.0 type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants