Skip to content

Commit abbface

Browse files
committed
fix: remove misleading user from system info in multi-user mode, catch /home/usr hallucination
- get_system_info() no longer includes 'as user user' when MULTI_USER is active, removing the hint that caused smaller LLMs to hardcode /home/user - resolve_path() now rewrites /home/usr → actual user home, matching the existing /home/user rewrite Closes #57
1 parent 0f2e4ea commit abbface

4 files changed

Lines changed: 19 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

7+
## [0.11.14] - 2026-03-13
8+
9+
### Fixed
10+
11+
- 🏠 **Multi-user home directory hints**`get_system_info()` no longer includes `as user 'user'` in the OpenAPI description when multi-user mode is active, removing a misleading hint that caused smaller LLMs to write to `/home/user` instead of their assigned directory. ([#57](https://github.com/open-webui/open-terminal/issues/57))
12+
- 🔄 **`/home/usr` path rewrite**`resolve_path()` now also rewrites `/home/usr` (a common LLM hallucination) to the provisioned user's home directory, matching the existing `/home/user` rewrite.
13+
714
## [0.11.13] - 2026-03-13
815

916
### Fixed

open_terminal/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@
4747
def get_system_info() -> str:
4848
"""Gather runtime system metadata for the OpenAPI description."""
4949
shell = os.environ.get("SHELL", "/bin/sh")
50+
user_part = f" as user '{os.getenv('USER', 'unknown')}'" if not MULTI_USER else ""
5051
return (
5152
f"This system is running {platform.system()} {platform.release()} ({platform.machine()}) "
52-
f"on {socket.gethostname()} as user '{os.getenv('USER', 'unknown')}' with {shell}. "
53+
f"on {socket.gethostname()}{user_part} with {shell}. "
5354
f"Python {sys.version.split()[0]} is available."
5455
)
5556

open_terminal/utils/fs.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@ def resolve_path(self, path: str) -> str:
5050
home directory, since LLMs often hardcode that path.
5151
"""
5252
if os.path.isabs(path):
53-
# Swap /home/user → user's actual home when multi-user is active
53+
# Swap /home/user (and /home/usr, a common LLM hallucination)
54+
# → user's actual home when multi-user is active
5455
if self.username and self.home != "/home/user":
55-
if path == "/home/user":
56-
path = self.home
57-
elif path.startswith("/home/user/"):
58-
path = self.home + path[len("/home/user"):]
56+
for prefix in ("/home/user", "/home/usr"):
57+
if path == prefix:
58+
path = self.home
59+
break
60+
elif path.startswith(prefix + "/"):
61+
path = self.home + path[len(prefix):]
62+
break
5963
return os.path.normpath(path)
6064
return os.path.normpath(os.path.join(self.home, path))
6165

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "open-terminal"
3-
version = "0.11.13"
3+
version = "0.11.14"
44
description = "A remote terminal API."
55
readme = "README.md"
66
authors = [

0 commit comments

Comments
 (0)