Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#2302·open-swe

`os.getuid()` in agent/desktop.py breaks the desktop backend on Windows

Author: rajarshidattapyCreated Aug 28, 2026Updated Sep 14, 2026

Severity: Medium Type: Portability / Crash File: agent/desktop.py:51

Description

_artifacts_root() namespaces the artifacts temp directory by POSIX uid:

python
def _artifacts_root() -> Path:
    configured = os.environ.get("OPEN_SWE_LOCAL_ARTIFACTS_DIR")
    if configured:
        return Path(configured)
    return Path(tempfile.gettempdir()) / f"open-swe-artifacts-{os.getuid()}"

os.getuid does not exist on Windows. There is no sys.platform guard anywhere in agent/desktop.py.

Impact

On Windows the desktop/local backend raises immediately:

AttributeError: module 'os' has no attribute 'getuid'. Did you mean: 'getpid'?
agent\desktop.py:51: AttributeError

This is reachable through desktop_artifact_routes, which sets up the routes for offloaded tool results and evicted conversation history — so the failure is on the agent-assembly path, not an optional feature.

Two tests fail on Windows for this reason:

  • tests/agent/test_agent_assembly_context.py::test_desktop_agent_loads_snapshotted_and_bundled_skills
  • tests/agent/test_agent_assembly_context.py::test_desktop_agent_honors_gateway_environment

Open SWE Desktop is documented as macOS-only (Makefile: install-desktop, desktop/README.md), so this may be intentional today. It is still worth fixing: the value is only used to keep two users' temp directories apart, the fix is one line, and the current code turns "Windows is not a release target" into "the module cannot be imported and exercised on Windows at all", which is what makes the test suite unrunnable there.

Suggested fix

python
_uid = getattr(os, "getuid", None)
suffix = _uid() if _uid else getpass.getuser()
return Path(tempfile.gettempdir()) / f"open-swe-artifacts-{suffix}"

Or gate the whole desktop path behind an explicit platform check and skip the tests accordingly.


Found during a full-repo audit (ruff + basedpyright + pytest on a Windows host, plus manual review). Filing each finding separately so they can be triaged independently.

Source: langchain-ai/open-swe

View original on GitHubView discussion on GitHub