Skip to content

test: normalize paths in OPENCLAW_HOME tests for cross-platform support#12212

Merged
quotentiroler merged 4 commits intomainfrom
fix/windows-test-path-normalize
Feb 9, 2026
Merged

test: normalize paths in OPENCLAW_HOME tests for cross-platform support#12212
quotentiroler merged 4 commits intomainfrom
fix/windows-test-path-normalize

Conversation

@quotentiroler
Copy link
Contributor

@quotentiroler quotentiroler commented Feb 9, 2026

Fix Windows CI test failures caused by Unix-style path literals (e.g., /srv/openclaw-home) in tests. Instead of skipping tests on Windows, normalize paths using path.join(path.sep, ...) for cross-platform compatibility.

Tests now also account for path.resolve() behavior from #12125.

Changes

src/agents/agent-scope.test.ts

  • Replace hardcoded /srv/openclaw-home paths with path.join(path.sep, "srv", "openclaw-home")
  • Clear OPENCLAW_STATE_DIR to ensure OPENCLAW_HOME fallback is properly tested
  • Use path.resolve(home) in expectations for cross-platform compatibility

src/agents/workspace.defaults.test.ts

  • Same path normalization approach with path.resolve()

src/config/config.nix-integration-u3-u5-u9.test.ts

  • Normalize /custom/home paths to use path.join(path.sep, ...)
  • Use path.resolve() in expectations to match production behavior

src/agents/pi-embedded-runner.test.ts

  • Remove unnecessary itIfNotWin32 skip - test runs fine on Windows

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • pnpm vitest run src/agents/agent-scope.test.ts - all 10 tests pass
  • pnpm vitest run src/agents/workspace.defaults.test.ts - all 1 test passes
  • pnpm vitest run src/config/config.nix-integration-u3-u5-u9.test.ts - all 19 tests pass
  • pnpm vitest run src/agents/pi-embedded-runner.test.ts - all 9 tests pass
  • pnpm check passes

Fixes Windows CI failures from #11881.

@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Feb 9, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 219 to 223
it("uses OPENCLAW_HOME for default agentDir", () => {
const home = path.join(path.sep, "srv", "openclaw-home");
vi.stubEnv("OPENCLAW_HOME", home);
// Clear state dir so it falls back to OPENCLAW_HOME
vi.stubEnv("OPENCLAW_STATE_DIR", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Env override may not clear

vi.stubEnv("OPENCLAW_STATE_DIR", "") relies on the production code treating an empty string the same as “unset”. If resolveAgentDir checks process.env.OPENCLAW_STATE_DIR !== undefined (common pattern), this will still be considered set and the test will fail (or worse, pass for the wrong reason if empty string leads to odd path joins). Consider deleting the var (or restoring previous value) instead of setting it to "", so the fallback to OPENCLAW_HOME is unambiguous on all platforms.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/agent-scope.test.ts
Line: 219:223

Comment:
**Env override may not clear**

`vi.stubEnv("OPENCLAW_STATE_DIR", "")` relies on the production code treating an *empty string* the same as “unset”. If `resolveAgentDir` checks `process.env.OPENCLAW_STATE_DIR !== undefined` (common pattern), this will still be considered set and the test will fail (or worse, pass for the wrong reason if empty string leads to odd path joins). Consider deleting the var (or restoring previous value) instead of setting it to `""`, so the fallback to `OPENCLAW_HOME` is unambiguous on all platforms.

How can I resolve this? If you propose a fix, please make it concise.

@quotentiroler quotentiroler force-pushed the fix/windows-test-path-normalize branch from eef1216 to c728f06 Compare February 9, 2026 01:15
@quotentiroler quotentiroler merged commit 53a1ac3 into main Feb 9, 2026
24 checks passed
@quotentiroler quotentiroler deleted the fix/windows-test-path-normalize branch February 9, 2026 01:21
zendizmo pushed a commit to zendizmo/openclaw that referenced this pull request Feb 9, 2026
…rt (openclaw#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
yeboster pushed a commit to yeboster/openclaw that referenced this pull request Feb 9, 2026
…rt (openclaw#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
NikolasP98 pushed a commit to NikolasP98/openclaw that referenced this pull request Feb 9, 2026
…rt (openclaw#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
NikolasP98 added a commit to NikolasP98/openclaw that referenced this pull request Feb 9, 2026
Integrated upstream improvements:
- CRITICAL: Fix bundled hooks broken since 2026.2.2 (openclaw#9295)
- Grok web search provider (xAI) with inline citations
- Telegram video note support with tests and docs
- QMD model cache sharing optimization (openclaw#12114)
- Context overflow false positive fix (openclaw#2078)
- Model failover 400 status handling (openclaw#1879)
- Dynamic config loading per-message (openclaw#11372)
- Gateway post-compaction amnesia fix (openclaw#12283)
- Skills watcher: ignore Python venvs and caches
- Telegram send recovery from stale thread IDs
- Cron job parameter recovery (openclaw#12124)
- Auto-reply weekday timestamps (openclaw#12438)
- Utility consolidation refactoring (PNG, JSON, errors)
- Cross-platform test normalization (openclaw#12212)
- macOS Nix defaults support (openclaw#12205)

Preserved DEV enhancements:
- Docker multi-stage build with enhanced tooling (gh, gog, obsidian-cli, uv, nano-pdf, mcporter, qmd)
- Comprehensive .env.example documentation (371 lines)
- Multi-environment docker-compose support (DEV/PRD)
- GOG/Tailscale integration
- Fork-sync and openclaw-docs skills
- UI config editor (Svelte)
- Fork workflow documentation

Merge strategy: Cherry-picked 22 upstream commits, preserved DEV Docker architecture.
Docker files unchanged: Dockerfile, docker-compose.yml, docker-setup.sh, .env.example

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Ethermious pushed a commit to Ethermious/openclaw that referenced this pull request Feb 9, 2026
…rt (openclaw#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
lucasmpramos pushed a commit to butley/openclaw that referenced this pull request Feb 10, 2026
…rt (openclaw#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
yeboster pushed a commit to yeboster/openclaw that referenced this pull request Feb 13, 2026
…rt (openclaw#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
skyhawk14 pushed a commit to skyhawk14/openclaw that referenced this pull request Feb 13, 2026
…rt (openclaw#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
mbelinky pushed a commit that referenced this pull request Feb 14, 2026
…rt (#12212)

* test: normalize paths in OPENCLAW_HOME tests for cross-platform support

* test: normalize paths in Nix integration tests for cross-platform support

* test: remove unnecessary Windows skip from pi-embedded-runner test

* test: fix nix integration tests for path.resolve behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments