Skip to content

APP-1152 Add legacy fallback variable when finding persistence directory#13629

Merged
tofarr merged 1 commit intomainfrom
fix-docker-add-legacy
Mar 27, 2026
Merged

APP-1152 Add legacy fallback variable when finding persistence directory#13629
tofarr merged 1 commit intomainfrom
fix-docker-add-legacy

Conversation

@tofarr
Copy link
Copy Markdown
Collaborator

@tofarr tofarr commented Mar 27, 2026

Summary of PR

We now support the legacy FILE_STORE_PATH variable when identifying the persistence directory. We will swap over to the new variable when we remove support for V0 - for now it is still defined in the Dockerfile.

Demo Screenshots/Videos

image image

Change Type

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Other (dependency update, docs, typo fixes, etc.)

Checklist

  • I have read and reviewed the code and I understand what the code is doing.
  • I have tested the code to the best of my ability and ensured it works as expected.

Fixes

#13578

Resolves #(issue)

Release Notes

  • Include this change in the Release Notes.

@tofarr tofarr changed the title Add legacy fallback variable when finding persistence directory APP-1152 Add legacy fallback variable when finding persistence directory Mar 27, 2026
@tofarr tofarr marked this pull request as ready for review March 27, 2026 16:16
@tofarr tofarr requested review from hieptl and malhotra5 as code owners March 27, 2026 16:16
@github-actions
Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  openhands/app_server
  config.py 75
Project Total  

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

Copy link
Copy Markdown
Collaborator

@hieptl hieptl left a comment

Choose a reason for hiding this comment

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

Thank you! 🙏

@tofarr tofarr merged commit 3268c29 into main Mar 27, 2026
24 checks passed
@tofarr tofarr deleted the fix-docker-add-legacy branch March 27, 2026 16:18
Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

🟡 Acceptable - Pragmatic backward compatibility fix, but needs test coverage.

The core logic is solid and follows the "don't break userspace" principle. However, this adds new behavior without tests.


# Legacy V0 fallback variable
if persistence_dir is None:
persistence_dir = os.getenv('FILE_STORE_PATH')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🟠 Important: This adds new behavior but there are no tests for get_default_persistence_dir().

You should add tests that verify:

  1. FILE_STORE_PATH is used when OH_PERSISTENCE_DIR is not set
  2. OH_PERSISTENCE_DIR takes precedence over FILE_STORE_PATH when both are set
  3. Default behavior when neither is set

Example test structure:

def test_persistence_dir_fallback_to_legacy(monkeypatch, tmp_path):
    monkeypatch.delenv('OH_PERSISTENCE_DIR', raising=False)
    monkeypatch.setenv('FILE_STORE_PATH', str(tmp_path))
    result = get_default_persistence_dir()
    assert result == tmp_path

def test_persistence_dir_precedence(monkeypatch, tmp_path):
    new_dir = tmp_path / 'new'
    legacy_dir = tmp_path / 'legacy'
    monkeypatch.setenv('OH_PERSISTENCE_DIR', str(new_dir))
    monkeypatch.setenv('FILE_STORE_PATH', str(legacy_dir))
    result = get_default_persistence_dir()
    assert result == new_dir

The screenshots prove manual testing works, but automated tests ensure this doesn't regress when V0 support is eventually removed.

@mamoodi mamoodi added the release:cloud-1.19.0 Included in release 1.19.0 label Mar 30, 2026 — with OpenHands AI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:cloud-1.19.0 Included in release 1.19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants