Pooria/1024 railtracks folder#1110
Open
Pooria90 wants to merge 6 commits into
Open
Conversation
…rnal directory redirection
| if env: | ||
| return Path(env) / _DIRNAME | ||
|
|
||
| current = Path.cwd() |
Member
There was a problem hiding this comment.
This should be fine in Windows too, right? (Cross-operating system file paths)
3 tasks
Amir-R25
requested changes
May 21, 2026
|
|
||
| cli_name = "railtracks" | ||
| cli_directory = ".railtracks" | ||
| UI_VERSION_FILE = f"{cli_directory}/.ui_version" |
Collaborator
There was a problem hiding this comment.
This constant is used by the CLI to detect the user's version of the visualizer UI vs the most recently published version and warns the user to update to get new features
| def get_stored_ui_version(): | ||
| """Get the stored UI version (ETag) from disk""" | ||
| version_file = Path(UI_VERSION_FILE) | ||
| version_file = resolve_railtracks_home() / ".ui_version" |
Collaborator
There was a problem hiding this comment.
Same comment here and below regarding UI_VERSION constant
it's a file inside .railtracks
| return JSONResponse(content={"error": "Not Found"}, status_code=404) | ||
|
|
||
| ui_dir = Path(f"{cli_directory}/ui") | ||
| ui_dir = get_railtracks_dir() / "ui" |
Collaborator
There was a problem hiding this comment.
will this make it dir/.railtracks/ui, or dir/ui cause only the first is correct, the second one will break the visualizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes inconsistent
.railtracksdirectory placement when agents are run from different working directories (closes #1024).Previously, each call site resolved the data directory independently —
_session.pyreadRAILTRACKS_HOMEbut fell back tocwd(), whileevaluations/utils.py,cli/__init__.py, andcli/viz_server.pyhardcoded".railtracks"relative tocwd(). Running scripts from a subdirectory silently created a second.railtracksfolder, splitting session and evaluation data across locations.The fix introduces a single
resolve_railtracks_home()function inrailtracks/paths.pyused by all four sites. Resolution order:RAILTRACKS_HOMEenv var, if setcwd()until an existing.railtracksdirectory is found (git-style traversal)cwd()/.railtrackswith aUserWarningprompting the user to runrailtracks initfrom their project rootType of change
Checklist
ruff check . && ruff format .)pytest tests)Notes
Migration: No breaking change for users who already set
RAILTRACKS_HOME— that path takes priority and behaviour is unchanged. Users relying on the implicitcwd()fallback will see aUserWarningon first run until they runrailtracks initfrom their project root; after that, traversal finds the directory and the warning is not emitted again.railtracks initbehaviour: If a.railtracksdirectory already exists in a parent folder,initreports the existing location rather than creating a second one. The.gitignoreentry is now written adjacent to the.railtracksdirectory rather than always atcwd().Removed:
EVALS_DIRmodule-level constant fromevaluations/utils.pyandUI_VERSION_FILEconstant fromcli/constants.py— both are now computed at call time viaresolve_railtracks_home(). Tests that patchedEVALS_DIRdirectly have been updated to patchresolve_railtracks_homeinstead.