Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: file in _instructions directory not set correctly. (#1602)

Xia Zhenhua2d24521222d2
diff --git a/agenthub/micro/instructions.py b/agenthub/micro/instructions.py
index 022e08511b..adbfb19d87 100644
--- a/agenthub/micro/instructions.py
+++ b/agenthub/micro/instructions.py
@@ -7,13 +7,16 @@ base_dir = os.path.dirname(os.path.abspath(__file__)) + '/_instructions'
for root, dirs, files in os.walk(base_dir):
if len(files) == 0:
continue
- rel_base = os.path.relpath(root, base_dir)
- keys = rel_base.split('/')
- obj = instructions
- for key in keys:
- if key not in obj:
- obj[key] = {}
- obj = obj[key]
+ if root == base_dir:
+ obj = instructions
+ else:
+ rel_base = os.path.relpath(root, base_dir)
+ keys = rel_base.split('/')
+ obj = instructions
+ for key in keys:
+ if key not in obj:
+ obj[key] = {}
+ obj = obj[key]
for file in files:
without_ext = os.path.splitext(file)[0]
with open(os.path.join(root, file), 'r') as f: