[BUG] Trino connector: relative verify CA path resolves against CWD, not a stable root
Bug
When a relative path is provided for the verify SSL kwarg in TrinoConnectionInfo.kwargs (e.g. verify: certs/ca-chain.pem), it is passed as-is through _build_trino_connect_kwargs → _apply_trino_ssl_overrides → trino.dbapi.connect() → requests.
The requests library resolves relative paths against os.getcwd(). This means the CA bundle is only found when the process happens to start from the project root. If the application is launched from a different working directory (e.g. as a subprocess of another service, from an IDE, or a CI runner), the connection fails with a certificate error even though the file exists at the expected relative location.
Where
wren/connector/trino.py — _apply_trino_ssl_overrides() already coerces string values like "false" / "true" into proper booleans, but does not resolve relative file paths.
Expected behavior
A relative verify path should be resolved to an absolute path before being passed to trino.dbapi.connect(), so SSL verification works regardless of the process's current working directory.
Suggested fix
In _apply_trino_ssl_overrides, after coercion, resolve relative paths with pathlib.Path:
from pathlib import Path
def _apply_trino_ssl_overrides(connect_kwargs: dict) -> dict:
if "verify" in connect_kwargs:
coerced = _coerce_trino_verify(connect_kwargs.pop("verify"))
if coerced is not None:
# Resolve relative CA paths so they don't depend on CWD
if isinstance(coerced, str) and not Path(coerced).is_absolute():
coerced = str(Path(coerced).resolve())
connect_kwargs["verify"] = coerced
# ... rest of function unchangedAlternatively, accept an optional root_path parameter to resolve against, which would let callers anchor to their project root rather than relying on Path.resolve() (which still depends on CWD).
Reproduction
import os
os.chdir("/tmp") # any directory that isn't the project root
from wren import DataSource, WrenEngine
# configure with verify: "certs/my-ca.pem" (relative path)
# connection fails — requests looks for /tmp/certs/my-ca.pemEnvironment
- wrenai 0.14.0
- Python 3.14
- macOS / Linux
Source: Canner/WrenAI