fix: ga global command cwd should follow user launch directory#180
Open
wzql-qrs wants to merge 6 commits intolsdefine:mainfrom
Open
fix: ga global command cwd should follow user launch directory#180wzql-qrs wants to merge 6 commits intolsdefine:mainfrom
wzql-qrs wants to merge 6 commits intolsdefine:mainfrom
Conversation
- /new: calls reset_conversation() to clear all history and start fresh - /continue: lists recoverable sessions from model_responses/ - /continue N: restores the Nth session - /resume: kept as alias for backward compatibility - Lazy import from frontends.continue_cmd to avoid startup dependency Rollback: git revert HEAD
When 'ga' is installed as a global command (e.g. via pip or symlink),
the handler's cwd was hardcoded to {script_dir}/temp, regardless of
where the user runs the command. This PR changes it to os.getcwd() so
the working directory matches the user's current directory.
Changes:
- agentmain.py: use os.getcwd() for handler cwd instead of hardcoded temp
- ga.py: use os.getcwd() for cwd display, dynamically replace ../ in
memory paths with absolute paths to prevent resolution issues
Note: This code change was entirely authored by the GenericAgent AI
assistant (Claude), not by the repository owner or any human developer.
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.
Problem
When
gais installed as a global command (e.g. via pip or symlink to/usr/local/bin/ga), the handler working directory is hardcoded to{script_dir}/temp, regardless of where the user actually runs the command.This means:
file_read,file_write,code_runetc. all resolve relative paths against the GA installation directory instead of the user current directorycwd = /root/GA/GenericAgent/tempeven when launched from~/my_project/Changes
agentmain.py: Use
os.getcwd()for handler cwd instead of hardcodedos.path.join(script_dir, "temp")ga.py:
os.getcwd()for cwd display in system prompt../in memory template paths with absolutescript_dirpaths, since these paths are shown to the agent as navigation instructions and must resolve correctly regardless of cwdNotes
.pyfiles created bycode_runwill now be written to the user directory (they are auto-deleted in thefinallyblock, so no residue)