fix(vector): URL-encode DAV paths and unwrap TaskGroup exceptions
Two ingest-robustness fixes from card 309 (OHR-Bench smoke-test triage). WebDAV paths flowed through the client already URL-decoded (unquote on the PROPFIND/REPORT <d:href>, or raw MCP-tool input), so a '#' reached httpx as a URL fragment and silently truncated the request -> spurious 404 on otherwise valid files (e.g. law filenames with '#', commas, double/trailing spaces). Route every caller-path builder through a new _webdav_path helper that percent-encodes the path once (preserving separators); the MOVE/COPY Destination header is encoded too. Vector-sync runs inside anyio task groups, so a child-task failure surfaced as a BaseExceptionGroup whose str() is the useless "unhandled errors in a TaskGroup (N sub-exception)" -- hiding the real ConnectError operators need. Add format_exception_group to flatten the group to its leaf exceptions and use it at the broad catch/log sites in processor.py and oauth_sync.py. Refs: Deck board 12 card 309 (AC #4 filename handling, AC #2 observability). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
457c115ef4
commit
0388735593
@@ -30,6 +30,7 @@ from httpx import BasicAuth, HTTPStatusError
|
||||
from nextcloud_mcp_server.auth.storage import RefreshTokenStorage
|
||||
from nextcloud_mcp_server.client import NextcloudClient
|
||||
from nextcloud_mcp_server.config import get_settings
|
||||
from nextcloud_mcp_server.vector._errors import format_exception_group
|
||||
from nextcloud_mcp_server.vector.processor import process_document
|
||||
from nextcloud_mcp_server.vector.queue.ports import TaskProducer
|
||||
from nextcloud_mcp_server.vector.scanner import DocumentTask, scan_user_documents
|
||||
@@ -257,7 +258,7 @@ async def user_scanner_task(
|
||||
logger.error(
|
||||
"[BasicAuth] Scanner error for %s: %s (%s/%s)",
|
||||
user_id,
|
||||
e,
|
||||
format_exception_group(e),
|
||||
consecutive_errors,
|
||||
max_consecutive_errors,
|
||||
exc_info=True,
|
||||
@@ -347,12 +348,15 @@ async def multi_user_processor_task(
|
||||
worker_id,
|
||||
doc_task.doc_type,
|
||||
doc_task.doc_id,
|
||||
e,
|
||||
format_exception_group(e),
|
||||
exc_info=True,
|
||||
)
|
||||
else:
|
||||
logger.error(
|
||||
"[BasicAuth] Processor %s error: %s", worker_id, e, exc_info=True
|
||||
"[BasicAuth] Processor %s error: %s",
|
||||
worker_id,
|
||||
format_exception_group(e),
|
||||
exc_info=True,
|
||||
)
|
||||
|
||||
finally:
|
||||
@@ -481,7 +485,11 @@ async def user_manager_task(
|
||||
logger.info("[BasicAuth] Stopped %s scanner(s)", len(revoked_users))
|
||||
|
||||
except Exception as e:
|
||||
logger.error("[BasicAuth] User manager error: %s", e, exc_info=True)
|
||||
logger.error(
|
||||
"[BasicAuth] User manager error: %s",
|
||||
format_exception_group(e),
|
||||
exc_info=True,
|
||||
)
|
||||
|
||||
# Sleep until next poll
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user