Skip to content

Fix false condition of TFL_REMOTE_STORAGE_ENABLED#1412

Merged
deep1401 merged 3 commits intomainfrom
fix/truthy-tfl-remote-storage
Feb 27, 2026
Merged

Fix false condition of TFL_REMOTE_STORAGE_ENABLED#1412
deep1401 merged 3 commits intomainfrom
fix/truthy-tfl-remote-storage

Conversation

@deep1401
Copy link
Copy Markdown
Member

@deep1401 deep1401 commented Feb 27, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Remote storage now activates only when the TFL_REMOTE_STORAGE_ENABLED setting is explicitly set to "true" (case-insensitive). Implicit/non-empty values no longer enable remote storage; update configurations if needed.
  • Chores

    • Bumped transformerlab and lab-sdk versions to 0.0.84.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 946ec72 and 1c81bbd.

📒 Files selected for processing (2)
  • api/pyproject.toml
  • lab-sdk/pyproject.toml

📝 Walkthrough

Walkthrough

Replaces truthy checks of TFL_REMOTE_STORAGE_ENABLED with an explicit case-insensitive boolean comparison against "true" (default "false") across multiple modules. Also updates project/dependency version(s) from 0.0.82 to 0.0.84 in api and lab-sdk.

Changes

Cohort / File(s) Summary
Version Bumps
api/pyproject.toml, lab-sdk/pyproject.toml
Bumped versions from 0.0.82 to 0.0.84 (project/dependency version updates).
Remote Storage Boolean Refactoring
api/api.py, api/transformerlab/routers/compute_provider.py, api/transformerlab/routers/experiment/documents.py, api/transformerlab/routers/teams.py, api/transformerlab/shared/models/user_model.py, api/transformerlab/shared/remote_workspace.py, lab-sdk/src/lab/dirs.py
Changed TFL_REMOTE_STORAGE_ENABLED handling to use getenv(..., "false").lower() == "true" and replaced direct truthy getenv checks with the new boolean variable; preserves existing combined conditions involving TFL_STORAGE_PROVIDER == "localfs" and TFL_STORAGE_URI.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

mode:multiuser

Suggested reviewers

  • dadmobile
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing a truthy check of TFL_REMOTE_STORAGE_ENABLED with an explicit boolean parse requiring "true" (case-insensitive).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/truthy-tfl-remote-storage

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

@sentry
Copy link
Copy Markdown

sentry bot commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
api/transformerlab/shared/remote_workspace.py (1)

30-33: Consider centralizing the remote-storage flag parsing.

The same parsing expression appears in three places. A small helper would keep behavior/messages consistent if semantics change again.

♻️ Refactor sketch
+def _is_remote_storage_enabled() -> bool:
+    return os.getenv("TFL_REMOTE_STORAGE_ENABLED", "false").strip().lower() == "true"
...
-    tfl_remote_storage_enabled = os.getenv("TFL_REMOTE_STORAGE_ENABLED", "false").lower() == "true"
+    tfl_remote_storage_enabled = _is_remote_storage_enabled()
...
-    tfl_remote_storage_enabled = os.getenv("TFL_REMOTE_STORAGE_ENABLED", "false").lower() == "true"
+    tfl_remote_storage_enabled = _is_remote_storage_enabled()
...
-        tfl_remote_storage_enabled = os.getenv("TFL_REMOTE_STORAGE_ENABLED", "false").lower() == "true"
+        tfl_remote_storage_enabled = _is_remote_storage_enabled()

Also applies to: 191-193, 348-349

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/transformerlab/shared/remote_workspace.py` around lines 30 - 33, The code
repeats the same environment-flag parsing expression
(os.getenv("TFL_REMOTE_STORAGE_ENABLED", "false").lower() == "true") in multiple
places; create a small helper function (e.g., is_tfl_remote_storage_enabled or
parse_tfl_remote_storage_enabled) in remote_workspace.py and replace the
repeated expressions with calls to that helper wherever
tfl_remote_storage_enabled is computed (including the spots around the existing
tfl_remote_storage_enabled variable and the occurrences at the other indicated
locations); ensure the helper centralizes the default value and normalization
logic so all callers get consistent behavior and messaging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@api/transformerlab/shared/remote_workspace.py`:
- Around line 191-195: Update the skip log/message to accurately reflect the
boolean semantics of TFL_REMOTE_STORAGE_ENABLED: instead of saying "is not set",
change the message for the tfl_remote_storage_enabled check (the variable
tfl_remote_storage_enabled derived from os.getenv("TFL_REMOTE_STORAGE_ENABLED",
"false")) to indicate that remote storage is disabled or the env var is not set
to "true" (e.g., "TFL_REMOTE_STORAGE_ENABLED is not 'true', skipping bucket
creation" or "TFL_REMOTE_STORAGE_ENABLED is false or unset, skipping bucket
creation"); apply the same change to the other identical branch around lines
348-351 so both print statements accurately reflect the condition.

---

Nitpick comments:
In `@api/transformerlab/shared/remote_workspace.py`:
- Around line 30-33: The code repeats the same environment-flag parsing
expression (os.getenv("TFL_REMOTE_STORAGE_ENABLED", "false").lower() == "true")
in multiple places; create a small helper function (e.g.,
is_tfl_remote_storage_enabled or parse_tfl_remote_storage_enabled) in
remote_workspace.py and replace the repeated expressions with calls to that
helper wherever tfl_remote_storage_enabled is computed (including the spots
around the existing tfl_remote_storage_enabled variable and the occurrences at
the other indicated locations); ensure the helper centralizes the default value
and normalization logic so all callers get consistent behavior and messaging.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 670f565 and 946ec72.

📒 Files selected for processing (9)
  • api/api.py
  • api/pyproject.toml
  • api/transformerlab/routers/compute_provider.py
  • api/transformerlab/routers/experiment/documents.py
  • api/transformerlab/routers/teams.py
  • api/transformerlab/shared/models/user_model.py
  • api/transformerlab/shared/remote_workspace.py
  • lab-sdk/pyproject.toml
  • lab-sdk/src/lab/dirs.py

Comment on lines +191 to 195
# Check if TFL_REMOTE_STORAGE_ENABLED is enabled
tfl_remote_storage_enabled = os.getenv("TFL_REMOTE_STORAGE_ENABLED", "false").lower() == "true"
if not tfl_remote_storage_enabled:
print("TFL_REMOTE_STORAGE_ENABLED is not set, skipping bucket creation")
return False
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.

⚠️ Potential issue | 🟡 Minor

Update skip messaging to match new boolean semantics.

The current text says the variable “is not set”, but this branch also runs when it is set to values other than "true" (for example "false"). That can mislead operators during setup/debugging.

💡 Suggested message fix
-        print("TFL_REMOTE_STORAGE_ENABLED is not set, skipping bucket creation")
+        print("TFL_REMOTE_STORAGE_ENABLED is not 'true', skipping bucket creation")
...
-            print("TFL_REMOTE_STORAGE_ENABLED is not set, skipping bucket creation for existing teams")
-            return (0, 0, ["TFL_REMOTE_STORAGE_ENABLED is not set"])
+            print("TFL_REMOTE_STORAGE_ENABLED is not 'true', skipping bucket creation for existing teams")
+            return (0, 0, ["TFL_REMOTE_STORAGE_ENABLED must be 'true' to create buckets"])

Also applies to: 348-351

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/transformerlab/shared/remote_workspace.py` around lines 191 - 195, Update
the skip log/message to accurately reflect the boolean semantics of
TFL_REMOTE_STORAGE_ENABLED: instead of saying "is not set", change the message
for the tfl_remote_storage_enabled check (the variable
tfl_remote_storage_enabled derived from os.getenv("TFL_REMOTE_STORAGE_ENABLED",
"false")) to indicate that remote storage is disabled or the env var is not set
to "true" (e.g., "TFL_REMOTE_STORAGE_ENABLED is not 'true', skipping bucket
creation" or "TFL_REMOTE_STORAGE_ENABLED is false or unset, skipping bucket
creation"); apply the same change to the other identical branch around lines
348-351 so both print statements accurately reflect the condition.

@paragon-review
Copy link
Copy Markdown

Paragon Summary

This pull request review analyzed 9 files and found no issues. The review examined code changes, potential bugs, security vulnerabilities, performance issues, and code quality concerns using automated analysis tools.

Paragon did not detect any problems in the current diff. Proceed with merge after your normal checks.

This PR fixes a logic error in the TFL_REMOTE_STORAGE_ENABLED condition check that was incorrectly evaluating to false, affecting remote storage functionality across the API and SDK layers.

Key changes:

  • Modifies py, toml files

Confidence score: 5/5

  • This PR has low risk with no critical or high-priority issues identified
  • Score reflects clean code review with only minor suggestions or no issues found
  • Code quality checks passed - safe to proceed with merge

9 files reviewed, 0 comments


Tip: @paragon-run <instructions> to chat with our agent or push fixes!

Dashboard

@deep1401 deep1401 merged commit fae46b4 into main Feb 27, 2026
11 of 12 checks passed
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