[BUG]: os.chdir() Changes the Process-Wide Working Directory During Repository Sync
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 75/100
Piste de recherche
Lisez scripts/update_subtrees.py, en vous concentrant sur sync_all_subtrees() et l’appel os.chdir(bot_root). Suivez la construction des chemins et vérifiez si la fonction ou ses appelants dépendent du répertoire de travail du processus. Le travail est terminé lorsque la synchronisation laisse le répertoire de travail inchangé et que les chemins relatifs, tels que gap_log.json, continuent d’être résolus de manière cohérente.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Bug Description
The sync_all_subtrees() function in scripts/update_subtrees.py uses os.chdir(bot_root) to change the current working directory of the Python process during repository synchronization.
The os.chdir() function changes the working directory globally for the entire process, rather than only for the repository synchronization function.
This can cause unexpected behavior when SkillBot is launched from a directory other than its project root. Relative file paths used by other parts of the application may resolve to different locations after repository synchronization changes the working directory.
For example, a relative path such as gap_log.json may initially resolve relative to the directory from which SkillBot was launched. After os.chdir(bot_root) executes, the same relative path resolves relative to the SkillBot project directory.
As a result, files may be read from or written to unexpected locations, potentially causing missing or misplaced gap-log entries.
Root Cause:
sync_all_subtrees()callsos.chdir(bot_root)during repository synchronization.os.chdir()modifies the current working directory for the entire Python process.- Other application components that use relative file paths are affected by this global directory change.
- The working directory may change unexpectedly when SkillBot is launched from outside its project root.
- Repository synchronization does not need to change the process-wide working directory because the relevant paths are already constructed using
bot_root.
Expected Behavior:
Repository synchronization should operate using explicitly resolved paths without changing the process-wide working directory.
The application's current working directory should remain unchanged after repository synchronization, and relative file paths used by other components should continue resolving consistently.
Actual Behavior:
The call to os.chdir(bot_root) changes the working directory globally during repository synchronization. Consequently, relative paths used by other application components may resolve to different locations before and after synchronization.
Impact:
This can cause files to be accessed or created in unexpected directories when SkillBot is launched from a location other than its project root.
It may also result in gap-log entries being written to a different file location, making previously stored entries appear missing or causing the application to use an unintended gap log.
The issue primarily affects non-default launch scenarios where the initial working directory differs from the SkillBot project directory.
Steps to Reproduce
- Set up the SkillBot project with its required Python dependencies and environment configuration.
- Open a terminal and navigate to a directory outside the SkillBot project root.
- Start the SkillBot application using its script or entry point while keeping the terminal's current working directory unchanged.
- Before repository synchronization runs, record the application's current working directory using
os.getcwd(). - Check how a relative file path such as
gap_log.jsonresolves before synchronization. - Allow the repository synchronization process to execute
sync_all_subtrees()inscripts/update_subtrees.py. - Observe the execution of
os.chdir(bot_root)inside the synchronization workflow. - After synchronization, check the current working directory again using
os.getcwd(). - Resolve the same relative file path, such as
gap_log.json, again and compare its location with the location obtained before synchronization.
Expected Result:
- Repository synchronization should not modify the process-wide current working directory.
- The current working directory should remain unchanged before and after synchronization.
- Relative file paths should continue resolving to the same locations throughout the application's execution.
Actual Result:
The os.chdir(bot_root) call changes the process-wide working directory during repository synchronization. Relative file paths can consequently resolve to different locations after synchronization.
Additional Observation:
The repository synchronization code already constructs its relevant paths using bot_root as an absolute path. Therefore, changing the process-wide working directory is unnecessary for resolving those paths.
Logs and Screenshots
No response
Environment Details
Application: SkillBot (Discord Bot)
Operating System: Windows 11
Programming Language: Python 3.11.3
Affected File: scripts/update_subtrees.py
Affected Function: sync_all_subtrees()
Affected Operation: os.chdir(bot_root)
Related Component: Repository synchronization
Affected Resource: Process-wide current working directory
Related Application Behavior: Relative file path resolution
Example Affected File: gap_log.json
Impact
Medium - Feature works but has issues
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- Langage dominant
- Python
- Étoiles
- 10
- Forks
- 11
- Merge moyen
- 6 min
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de AOSSIE-Org/SkillBot
-
[BUG]: Issue-creation intent is missed when the article is omitted (create issue for this)Peut-être pris @Ankitavasudev l’a pris il y a 8 jours. Ouvertebug enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
AOSSIE-Org/SkillBot#65 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: Non-Atomic Gap Log Writes Can Cause Data Loss After an Interrupted SavePeut-être à nouveau libre @SYED-IRTEZA-HUSSAIN-RIZVI l’a pris il y a 11 jours, et aucune pull request n’est ouverte. Ouvertebug enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
AOSSIE-Org/SkillBot#61 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: wait_for_ollama() Retries Indefinitely When Ollama Is UnavailablePeut-être à nouveau libre @SYED-IRTEZA-HUSSAIN-RIZVI l’a pris il y a 11 jours, et aucune pull request n’est ouverte. Ouvertebug enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
AOSSIE-Org/SkillBot#56 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: Backlog Messages Are Re-processed on Discord ReconnectionPeut-être à nouveau libre @SYED-IRTEZA-HUSSAIN-RIZVI l’a pris il y a 11 jours, et aucune pull request n’est ouverte. Ouvertebug enhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
AOSSIE-Org/SkillBot#58 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: _log_gap() Performs Blocking File I/O on the Async Event LoopPeut-être pris @abu-tahir-0 l’a pris il y a 13 jours. Ouvertebug enhancement
Difficulté 3/5 1-2 jours Accessibilité débutants 25/100
AOSSIE-Org/SkillBot#57 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de AOSSIE-Org/SkillBot
Issues similaires
-
LLMContextNode tool builders fail on nested params like `params:retrieval.max_matches`Peut-être pris @Shizoqua l’a pris aujourd’hui. OuverteCommunity
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 2 jours
-
security
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
btclib-org/portanode#985 ·
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: maps skill OSRM foot/cycling returns car times (router.project-osrm.org ignores profile)Ouvertecomp/tools P2 tool/skills type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
NousResearch/hermes-agent#158494 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour
-
needs-format
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Niko1221/Strata#6475 · 1 commentaire ·
Les mainteneurs répondent en général sous 6 jours