Skip to content

feat(openclaw): normalize host paths for split-root workspace routing#7

Closed
kalinon wants to merge 6 commits intoByMosDev:mainfrom
moltar-forge:codex/feature-openclaw-split-roots-api
Closed

feat(openclaw): normalize host paths for split-root workspace routing#7
kalinon wants to merge 6 commits intoByMosDev:mainfrom
moltar-forge:codex/feature-openclaw-split-roots-api

Conversation

@kalinon
Copy link
Copy Markdown
Contributor

@kalinon kalinon commented Mar 3, 2026

Summary

This PR updates MosBot API to align with OpenClaw Path Law v2 behavior while keeping dashboard integration unchanged.

Changes

  • Workspace allowlist updates in src/routes/openclaw.js:
    • removed legacy /workspace + /workspace/** allowance
    • kept /workspace-<id>, /projects, /skills, /docs, config files, and archived path handling
  • GET /api/v1/openclaw/agents fallback updates:
    • COO fallback workspace is now / (canonical main workspace path)
    • archived fallback remains present
  • Preserves existing remap architecture:
    • built-in remap prefixes remain active
    • additive OPENCLAW_PATH_REMAP_PREFIXES behavior remains
    • longest-prefix behavior remains
  • Integration tests updated:
    • fixture paths moved from /workspace/... to /workspace-main/...
    • added explicit regression that /workspace is rejected with PATH_NOT_ALLOWED
    • fallback COO workspace expectation updated to /

Why

Under Path Law v2, canonical main workspace path is /, and /workspace must not be treated as a valid alias. API must enforce this consistently so dashboard/file flows do not regress or route to ambiguous paths.

Issues Solved

  • Legacy /workspace alias creating inconsistent behavior with v2 routing
  • Fallback agent workspace mismatch with canonical main path
  • Coverage gaps around rejecting deprecated path aliases

Validation

  • npm test -- --runInBand src/routes/__tests__/openclaw.integration.test.js (pass)
  • npm run lint -- src/routes/openclaw.js src/routes/__tests__/openclaw.integration.test.js (pass)

Related PRs

Tracking issue:

kalinon added 3 commits March 3, 2026 15:09
Remove the hardcoded archived fallback agent for fresh installs and extend workspace path allowlisting to permit /_archived_workspace_main when it is intentionally present.
Add OPENCLAW_PATH_REMAP_PREFIXES support to normalize host-absolute workspace paths into virtual paths before allowlist/forwarding, keep archived fallback agent, and add integration coverage for remap + fallback behavior.
Implement API-side OpenClaw path normalization for both /home/node/.openclaw and ~/.openclaw prefixes, preserving allowlist enforcement. Add main/default agent workspace mapping to '/' when workspace is omitted to avoid /workspace-main lookups. Update integration tests and env/docs defaults so remap behavior and deployment config are consistent.
kalinon added 2 commits March 3, 2026 15:23
Always include built-in OpenClaw host-path remap prefixes, treat OPENCLAW_PATH_REMAP_PREFIXES as additive extras, and resolve remaps by longest prefix first to avoid nested /workspace path compounding. Also normalize explicit agent workspace values in /openclaw/agents output and align fallback archived workspace to virtual path semantics. Updated integration tests and API docs/env examples to reflect additive behavior and precedence.
@kalinon
Copy link
Copy Markdown
Contributor Author

kalinon commented Mar 3, 2026

Follow-up API alignment for Path Law v2.

New commit: 6b9dc49

Highlights:

  • removed legacy /workspace allowlist alias
  • fallback COO workspace now /
  • integration tests updated and added regression for /workspace rejection

Validation run:

  • npm run lint -- src/routes/openclaw.js src/routes/__tests__/openclaw.integration.test.js
  • npm test -- --runInBand src/routes/__tests__/openclaw.integration.test.js

- remap host workspace prefixes (~/.openclaw/workspace, /home/node/.openclaw/workspace) into /workspace/*\n- treat missing main/default agent workspaces as /workspace and align fallback COO path\n- allow /workspace and /workspace/* in strict path policy while rejecting bare /<file> paths\n- keep sub-agent/shared/config path rules unchanged\n- update integration tests for remap, allowlist, and agents mapping behavior
@kalinon
Copy link
Copy Markdown
Contributor Author

kalinon commented Mar 6, 2026

Superseded by # (), which rolls up all commits currently on moltar-forge:main relative to bymosbot:main.

@kalinon kalinon closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant