mirror of
https://github.com/open-webui/open-terminal.git
synced 2026-07-09 16:09:14 +00:00
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
This commit is contained in:
parent
0f2e4ea178
commit
abbface95a
4 changed files with 19 additions and 7 deletions
|
|
@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
## [0.11.14] - 2026-03-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- 🏠 **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))
|
||||
- 🔄 **`/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.
|
||||
|
||||
## [0.11.13] - 2026-03-13
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -47,9 +47,10 @@ except ImportError:
|
|||
def get_system_info() -> str:
|
||||
"""Gather runtime system metadata for the OpenAPI description."""
|
||||
shell = os.environ.get("SHELL", "/bin/sh")
|
||||
user_part = f" as user '{os.getenv('USER', 'unknown')}'" if not MULTI_USER else ""
|
||||
return (
|
||||
f"This system is running {platform.system()} {platform.release()} ({platform.machine()}) "
|
||||
f"on {socket.gethostname()} as user '{os.getenv('USER', 'unknown')}' with {shell}. "
|
||||
f"on {socket.gethostname()}{user_part} with {shell}. "
|
||||
f"Python {sys.version.split()[0]} is available."
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -50,12 +50,16 @@ class UserFS:
|
|||
home directory, since LLMs often hardcode that path.
|
||||
"""
|
||||
if os.path.isabs(path):
|
||||
# Swap /home/user → user's actual home when multi-user is active
|
||||
# Swap /home/user (and /home/usr, a common LLM hallucination)
|
||||
# → user's actual home when multi-user is active
|
||||
if self.username and self.home != "/home/user":
|
||||
if path == "/home/user":
|
||||
path = self.home
|
||||
elif path.startswith("/home/user/"):
|
||||
path = self.home + path[len("/home/user"):]
|
||||
for prefix in ("/home/user", "/home/usr"):
|
||||
if path == prefix:
|
||||
path = self.home
|
||||
break
|
||||
elif path.startswith(prefix + "/"):
|
||||
path = self.home + path[len(prefix):]
|
||||
break
|
||||
return os.path.normpath(path)
|
||||
return os.path.normpath(os.path.join(self.home, path))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "open-terminal"
|
||||
version = "0.11.13"
|
||||
version = "0.11.14"
|
||||
description = "A remote terminal API."
|
||||
readme = "README.md"
|
||||
authors = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue