Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
Feat/shared temp upload decouple (#4054)
Jiahui Zhoud08d9b99e6d7
diff --git a/docs/en/api/02-resources.md b/docs/en/api/02-resources.mdindex 4319fe6c7..6c175ba74 100644--- a/docs/en/api/02-resources.md+++ b/docs/en/api/02-resources.md@@ -112,7 +112,7 @@ Resource incremental updates are implemented via the **Watch Task** mechanism:#### Watch Task Creation- Set `watch_interval > 0` (in minutes) when calling `add_resource` with a re-readable source, such as a URL, sitemap, or RSS feed, to create a watch task-- Uploaded content referenced by `temp_file_id` is consumed as a one-time snapshot and cannot be watched; re-add it when the local source changes+- Uploaded content referenced by `temp_file_id` is a static snapshot and cannot be watched; re-add it when the local source changes- You may specify `to` to define the target URI; if omitted, the task binds to the `root_uri` returned by this import- Pointing a watch at a sitemap/RSS/Atom URL keeps the **whole site** in sync: each refresh re-reads the feed and rebuilds the tree, so newly published pages are added and removed pages drop automatically- `WatchManager` handles task persistence@@ -134,7 +134,7 @@ Resource incremental updates are implemented via the **Watch Task** mechanism:### add_resource-Add a resource to the knowledge base. The SDK supports local files/directories, URLs, and other sources. Raw HTTP calls accept remote URLs through `path` or uploaded local files through `temp_file_id`. Uploaded content is a one-time snapshot, so it cannot be combined with `watch_interval > 0`.+Add a resource to the knowledge base. The SDK supports local files/directories, URLs, and other sources. Raw HTTP calls accept remote URLs through `path` or uploaded local files through `temp_file_id`. Uploaded content is a static snapshot, so it cannot be combined with `watch_interval > 0`.#### 1. API Implementation Overview@@ -178,7 +178,7 @@ This endpoint is the core entry point for resource management, supporting adding| directly_upload_media | bool | No | True | Whether to directly upload media files || preserve_structure | bool | No | None | Whether to preserve directory structure || args | object | No | `{}` | Parser-specific import options forwarded to the source parser/accessor. Native HTTPS Git imports and watches accept HTTP Basic credentials over TLS as `args.auth_config={"username":"oauth2","token":"..."}`; `username` defaults to `oauth2`. Git `branch` or `commit` remains at the top level of `args`. `args.parse_mode` accepts `default` (existing splitting behavior) or `no_split` (parse and convert each source document to one Markdown body). E.g. `args.site=true/false` forces/opts out of whole-site (sitemap/RSS) ingestion, `args.max_pages` etc. override the `webfeed` config; the recursive web crawler accepts `args.depth`, `args.max_pages`, `args.include_paths`, `args.exclude_paths`, `args.allow_external_links`, `args.skip_download_links`; Feishu user-token imports pass `args.feishu_access_token`. Core `add_resource` fields such as `path`, `to`, `watch_interval`, `include`, and `exclude` are not allowed inside `args` |-| watch_interval | float | No | 0 | Scheduled update interval (minutes). >0 creates a task for a re-readable URL/sitemap/RSS source; uploaded `temp_file_id` content is a one-time snapshot and must be re-added when it changes. <=0 cancels a task; explicit `to` wins, otherwise binds to the imported `root_uri` |+| watch_interval | float | No | 0 | Scheduled update interval (minutes). >0 creates a task for a re-readable URL/sitemap/RSS source; uploaded `temp_file_id` content is a static snapshot and must be re-added when it changes. <=0 cancels a task; explicit `to` wins, otherwise binds to the imported `root_uri` || processing_mode | string | No | `semantic_and_vectors` | Post-ingest processing mode. `semantic_and_vectors` is the normal flow: generate semantic artifacts (`.abstract.md`, `.overview.md`) and vectors. `vectors_only` skips semantic understanding/VLM summarization and only vectorizes current resource files || telemetry | TelemetryRequest | No | False | Whether to return telemetry data |@@ -613,8 +613,9 @@ Notes:- The default is `local`, so existing clients keep the original behavior unless they explicitly opt into `shared`.- Use `upload_mode=shared` only when you explicitly want distributed shared temporary uploads.-- `shared` mode returns a one-time `temp_file_id` in the `shared_<upload_id>` form.-- Shared upload objects live under the internal `viking://upload/...` namespace and are not part of the normal filesystem browsing surface.+- `shared` mode returns a `temp_file_id` in the `shared_<upload_id>` form. The same account can consume it repeatedly while it remains available.+- New shared uploads create an internal `viking://upload/<created_at_ms>-<uuid>/` directory containing `content` and `meta`. The 13-digit Unix-millisecond timestamp in the directory name is the upload creation time; `meta` is written last and marks a completed upload. These objects are not part of the normal filesystem browsing surface.+- Shared uploads remain for `server.temp_upload.ttl_seconds` (12 hours by default). Each new shared upload makes one listing of the internal upload root, parses the creation timestamp from each first-level upload directory, and recursively removes expired directories without relying on filesystem modification times.#### 3. Usage Examplesdiff --git a/docs/en/guides/01-configuration.md b/docs/en/guides/01-configuration.mdindex ad10a71d6..ad356be50 100644--- a/docs/en/guides/01-configuration.md+++ b/docs/en/guides/01-configuration.md@@ -1557,7 +1557,7 @@ When running OpenViking as an HTTP service, add a `server` section to `ov.conf`:"temp_upload": {"default_mode": "local","shared_max_size_bytes": 536870912,- "shared_prefix": "viking://upload"+ "ttl_seconds": 43200},"user_config_defaults": {"add_targets": {@@ -1582,9 +1582,9 @@ When running OpenViking as an HTTP service, add a `server` section to `ov.conf`:| `cors_origins` | list | Allowed CORS origins | `["*"]` || `public_base_url` | str | Public-facing base URL emitted in MCP-issued upload instructions. Resolution order: env var `OPENVIKING_PUBLIC_BASE_URL` → this field → `X-Forwarded-Host`/`X-Forwarded-Proto` request headers → `Host` request header → listen-address fallback. Set this (or the env var) when the server runs behind a reverse proxy that does not forward `X-Forwarded-*` headers. | `null` || `upload_signed_ttl_seconds` | int | TTL in seconds for the one-shot tokens minted by the MCP `add_resource` tool for local-file uploads via `POST /api/v1/resources/temp_upload?token=...`. | `600` (10 minutes) |-| `temp_upload.default_mode` | str | Server-side default for `POST /api/v1/resources/temp_upload` when the client does not send `upload_mode`: `"local"` (per-instance disk, current single-node behavior) or `"shared"` (distributed shared store usable across replicas). | `"local"` |+| `temp_upload.default_mode` | str | Server-side default for `POST /api/v1/resources/temp_upload` when the client does not send `upload_mode`: `"local"` (per-instance disk, current single-node behavior) or `"shared"` (distributed shared store usable across replicas). New shared uploads are stored in internal `viking://upload/<created_at_ms>-<uuid>/content` and `meta` objects, and can be consumed repeatedly for `ttl_seconds`. | `"local"` || `temp_upload.shared_max_size_bytes` | int | Maximum size accepted in `shared` mode, in bytes. Requests above this size are rejected before object-store write. | `536870912` (512 MiB) |-| `temp_upload.shared_prefix` | str | URI prefix used when allocating shared `temp_file_id` objects. | `"viking://upload"` |+| `temp_upload.ttl_seconds` | int | Retention time shared by local and shared temporary uploads, in seconds. Each upload cleans files older than this for its mode; shared cleanup uses one upload-root listing, parses creation time from each first-level directory name, and recursively removes expired directories without filesystem modification times. Set to `0` to disable automatic cleanup. | `43200` (12 hours) || `user_config_defaults.add_targets.resource_uri` | str | Deployment default resource add directory used when `add_resource` omits both `to` and `parent`. `viking://user/...` resolves per request user. | `null` || `user_config_defaults.add_targets.skill_uri` | str | Deployment default skill add root used when `add_skill` omits `target_uri`. Only `viking://user/skills` and `viking://agent/skills` are accepted. | `null` || `agent_evolution.enabled` | bool | Instance-wide Agent Evolution switch. When enabled, session commits may generate or update cases, trajectories, and experiences according to the session `memory_policy`. When disabled, production of these memory types stops for every account and user. Existing memories remain readable and searchable. | `false` |diff --git a/docs/plans/2026-08-17-shared-temp-upload-timestamp-directory.md b/docs/plans/2026-08-17-shared-temp-upload-timestamp-directory.mdnew file mode 100644index 000000000..e83a24af3--- /dev/null+++ b/docs/plans/2026-08-17-shared-temp-upload-timestamp-directory.md@@ -0,0 +1,112 @@+# Shared Temp Upload Timestamp Directory Implementation Plan++> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.++**Goal:** Store each shared temporary upload in a timestamp-prefixed directory so cleanup can determine expiry from one root listing without filesystem modification times.++**Architecture:** Generate shared upload IDs as a fixed-width Unix-millisecond timestamp followed by a UUID. Use that ID as the directory name under `viking://upload`, with `content` written before `meta`. Consumers construct both paths directly from `temp_file_id`; cleanup parses timestamps from first-level directory names and removes expired directories recursively.++**Tech Stack:** Python async server, VikingFS, pytest, Markdown documentation.++---++### Task 1: Define directory-layout cleanup behavior++**Files:**+- Modify: `tests/server/test_temp_upload_store.py`++**Step 1: Write the failing test**++Replace the flat-object cleanup test with a test that returns first-level timestamp directories and verifies only expired valid directories are removed recursively without `modTime`.++**Step 2: Run test to verify it fails**++Run: `uv run --active pytest tests/server/test_temp_upload_store.py -q`++Expected: FAIL because cleanup still expects `.content` and `.meta` objects.++**Step 3: Implement minimal cleanup behavior**++Parse a fixed-width millisecond timestamp from directory names, skip malformed entries, and remove only expired directories.++**Step 4: Run test to verify it passes**++Run: `uv run --active pytest tests/server/test_temp_upload_store.py -q`++Expected: PASS.++### Task 2: Switch shared upload save and resolve paths++**Files:**+- Modify: `openviking/server/temp_upload_store.py`+- Modify: `tests/server/test_api_resources.py`++**Step 1: Write the failing test**++Assert uploaded shared files are stored in `viking://upload/<timestamp>-<uuid>/content` and `meta`, while the returned `temp_file_id` stays `shared_<upload_id>`.++**Step 2: Run test to verify it fails**++Run: `uv run --active pytest tests/server/test_api_resources.py -q -k shared_temp_upload`++Expected: FAIL because the implementation writes flat `.content` and `.meta` objects.++**Step 3: Implement minimal storage behavior**++Generate timestamp-prefixed IDs, construct directory child URIs, write content before metadata, and clean up the directory recursively after a partial write failure.++**Step 4: Run test to verify it passes**++Run: `uv run --active pytest tests/server/test_api_resources.py -q -k shared_temp_upload`++Expected: PASS.++### Task 3: Update user-deletion cleanup++**Files:**+- Modify: `openviking/service/user_deletion.py`+- Modify: `tests/server/test_temp_upload_store.py`++**Step 1: Write the failing test**++Make user deletion list upload directories, read each directory’s `meta`, and remove only directories owned by the deleted user.++**Step 2: Run test to verify it fails**++Run: `uv run --active pytest tests/server/test_temp_upload_store.py -q`++Expected: FAIL because deletion still scans root-level `.meta` objects.++**Step 3: Implement minimal deletion behavior**++Read `viking://upload/<upload_id>/meta` for each valid upload directory and recursively remove the owned directory.++**Step 4: Run test to verify it passes**++Run: `uv run --active pytest tests/server/test_temp_upload_store.py -q`++Expected: PASS.++### Task 4: Document and verify the layout++**Files:**+- Modify: `docs/en/api/02-resources.md`+- Modify: `docs/zh/api/02-resources.md`+- Modify: `docs/en/guides/01-configuration.md`+- Modify: `docs/zh/guides/01-configuration.md`++**Step 1: Update documentation**++Describe the timestamp-prefixed directory layout and timestamp-based one-listing cleanup, without referring to object modification times.++**Step 2: Run focused verification**++Run:++```bash+uv run --active pytest tests/test_config_loader.py tests/server/test_temp_upload_store.py -q+uv run --active pytest tests/server/test_api_resources.py -q -k shared_temp_upload+uv run --active ruff check openviking/server/temp_upload_store.py openviking/service/user_deletion.py tests/server/test_temp_upload_store.py tests/server/test_api_resources.py+```++Expected: all commands pass.diff --git a/docs/zh/api/02-resources.md b/docs/zh/api/02-resources.mdindex 6eaf34ce1..bad0f1011 100644--- a/docs/zh/api/02-resources.md+++ b/docs/zh/api/02-resources.md@@ -621,8 +621,9 @@ task_id uuid-xxx- 默认值是 `local`,所以现有客户端在不改动的情况下仍保持原有行为。- 只有在你明确需要分布式共享临时上传时,才应显式使用 `upload_mode=shared`。-- `shared` 模式下返回的一次性 `temp_file_id` 形如 `shared_<upload_id>`。-- shared 上传对象存放在内部 `viking://upload/...` 命名空间下,不属于普通文件系统浏览空间。+- `shared` 模式下返回的 `temp_file_id` 形如 `shared_<upload_id>`;同一 account 在文件保留期间可以重复消费。+- 新的 shared 上传会创建内部目录 `viking://upload/<created_at_ms>-<uuid>/`,目录内包含 `content` 和 `meta`。目录名中的 13 位 Unix 毫秒时间戳即上传创建时间;`meta` 最后写入,代表上传已完整完成。这些对象不属于普通文件系统浏览空间。+- shared 上传会保留 `server.temp_upload.ttl_seconds` 指定的时长(默认 12 小时)。每次新的 shared 上传会对内部上传根目录执行一次列举,从每个一级上传目录名解析创建时间戳,并递归删除过期目录,不依赖文件系统修改时间。#### 3. 使用示例diff --git a/docs/zh/guides/01-configuration.md b/docs/zh/guides/01-configuration.mdindex a3ada0f23..38f860d2d 100644--- a/docs/zh/guides/01-configuration.md+++ b/docs/zh/guides/01-configuration.md@@ -1639,7 +1639,7 @@ openviking add-resource ./docs --exclude "*.tmp""temp_upload": {"default_mode": "local","shared_max_size_bytes": 536870912,- "shared_prefix": "viking://upload"+ "ttl_seconds": 43200},"user_config_defaults": {"add_targets": {@@ -1664,9 +1664,9 @@ openviking add-resource ./docs --exclude "*.tmp"| `cors_origins` | list | CORS 允许的来源 | `["*"]` || `public_base_url` | str | MCP `add_resource` 工具向客户端返回的上传指令里使用的对外可见 base URL。解析顺序:环境变量 `OPENVIKING_PUBLIC_BASE_URL` → 本字段 → 请求头 `X-Forwarded-Host` / `X-Forwarded-Proto` → 请求头 `Host` → 监听地址兜底。当 server 部署在反向代理后且代理不转发 `X-Forwarded-*` 时,请显式设置本字段(或环境变量)。 | `null` || `upload_signed_ttl_seconds` | int | MCP `add_resource` 为本地文件上传 mint 的一次性 token 的过期时间(秒),走 `POST /api/v1/resources/temp_upload?token=...`。 | `600`(10 分钟) |-| `temp_upload.default_mode` | str | `POST /api/v1/resources/temp_upload` 的服务端默认模式(客户端未显式传 `upload_mode` 时使用):`"local"`(仅当前实例本地磁盘,单机默认行为)或 `"shared"`(分布式共享存储,多副本部署可跨实例消费)。 | `"local"` |+| `temp_upload.default_mode` | str | `POST /api/v1/resources/temp_upload` 的服务端默认模式(客户端未显式传 `upload_mode` 时使用):`"local"`(仅当前实例本地磁盘,单机默认行为)或 `"shared"`(分布式共享存储,多副本部署可跨实例消费)。新的 shared 上传会固定写入内部 `viking://upload/<created_at_ms>-<uuid>/content` 和 `meta` 对象,在 `ttl_seconds` 指定的时间内可重复消费。 | `"local"` || `temp_upload.shared_max_size_bytes` | int | `shared` 模式下接受的最大文件大小(字节)。超过此阈值的请求会在写入对象存储之前被拒绝。 | `536870912`(512 MiB) |-| `temp_upload.shared_prefix` | str | 分配 shared `temp_file_id` 对象时使用的 URI 前缀。 | `"viking://upload"` |+| `temp_upload.ttl_seconds` | int | local 和 shared 临时上传文件共用的保留时间(秒)。每次对应模式的上传会清理超过此时间的文件;shared 只需一次上传根目录列举,从每个一级目录名解析创建时间,并递归删除过期目录,不依赖文件系统修改时间;设为 `0` 时禁用自动清理。 | `43200`(12 小时) || `user_config_defaults.add_targets.resource_uri` | str | `add_resource` 未传 `to` 和 `parent` 时使用的部署级默认资源添加目录。`viking://user/...` 会按请求用户解析。 | `null` || `user_config_defaults.add_targets.skill_uri` | str | `add_skill` 未传 `target_uri` 时使用的部署级默认技能添加根目录。仅允许 `viking://user/skills` 和 `viking://agent/skills`。 | `null` || `agent_evolution.enabled` | bool | 实例级 Agent 进化开关。开启时,session commit 可按 session `memory_policy` 生成或更新 cases、trajectories 和 experiences;关闭时,所有账号和用户均停止生产这三类记忆。已有记忆仍可读取和检索。 | `false` |diff --git a/openviking/server/app.py b/openviking/server/app.pyindex 895011855..a4f572a69 100644--- a/openviking/server/app.py+++ b/openviking/server/app.py@@ -144,7 +144,6 @@ async def _initialize_runtime_state(app.state.user_deletion_service = await setup_user_deletion(service=service,manager=app.state.api_key_manager,- shared_upload_prefix=config.temp_upload.shared_prefix,oauth_store=getattr(app.state, "oauth_store", None),usage_audit_runtime=getattr(app.state, "usage_audit_runtime", None),)diff --git a/openviking/server/config.py b/openviking/server/config.pyindex 3eb6dfd70..0bdd74889 100644--- a/openviking/server/config.py+++ b/openviking/server/config.py@@ -246,7 +246,7 @@ class TempUploadConfig(BaseModel):default_mode: Literal["local", "shared"] = "local"shared_max_size_bytes: int = 512 * 1024 * 1024- shared_prefix: str = "viking://upload"+ ttl_seconds: int = Field(12 * 60 * 60, ge=0)model_config = {"extra": "forbid"}diff --git a/openviking/server/resource_ingest.py b/openviking/server/resource_ingest.pyindex 83480425c..08fb487ba 100644--- a/openviking/server/resource_ingest.py+++ b/openviking/server/resource_ingest.py@@ -4,8 +4,8 @@Used by both the MCP ``add_resource`` tool (``temp_file_id`` branch) and the signed``temp_upload`` route (automatic post-upload ingestion). Resolves the temp file, calls-``ResourceService.add_resource`` (async, ``wait=False``), and drives the ``TempUploadStore``-lifecycle: mark_consumed on success / mark_failed on error, always cleaning up.+``ResourceService.add_resource`` (async, ``wait=False``), then cleans up the local+working copy."""from __future__ import annotations@@ -38,10 +38,9 @@ async def ingest_temp_upload(``root_uri``) or a business-error dict (``{"status": "error", ...}``) that ``add_resource``returns WITHOUT raising. Callers MUST inspect ``status``: HTTP callers pass it through``response_from_result`` (which maps errors to the right status code); the MCP tool formats- it — so an ingestion failure is never reported as success. The upload is marked consumed- only on success (mark_failed on business error or exception), and its temp file is always- cleaned up. ``resolve_for_consume`` may raise (PermissionDenied / InvalidArgument) before- anything is resolved — the caller surfaces that.+ it — so an ingestion failure is never reported as success. ``resolve_for_consume`` may+ raise (PermissionDenied / InvalidArgument) before anything is resolved — the caller+ surfaces that."""resolved = await store.resolve_for_consume(temp_file_id, ctx)try:@@ -64,12 +63,7 @@ async def ingest_temp_upload(tag_mode=tag_mode,)except Exception:- await store.mark_failed(resolved, ctx)raise- if isinstance(result, dict) and result.get("status") == "error":- await store.mark_failed(resolved, ctx)- else:- await store.mark_consumed(resolved, ctx)finally:await resolved.cleanup()diff --git a/openviking/server/routers/admin.py b/openviking/server/routers/admin.pyindex e79ac44e6..df626ea19 100644--- a/openviking/server/routers/admin.py+++ b/openviking/server/routers/admin.py@@ -346,6 +346,7 @@ async def delete_account(account_prefixes = ["viking://user/","viking://resources/",+ "viking://upload/",]for prefix in account_prefixes:try:diff --git a/openviking/server/routers/pack.py b/openviking/server/routers/pack.pyindex bfb15e508..56b266c07 100644--- a/openviking/server/routers/pack.py+++ b/openviking/server/routers/pack.py@@ -186,10 +186,7 @@ async def import_ovpack(vector_mode=body.vector_mode,)except Exception:- await store.mark_failed(resolved, ctx)raise- else:- await store.mark_consumed(resolved, ctx)finally:await resolved.cleanup()@@ -216,10 +213,7 @@ async def restore_ovpack(vector_mode=body.vector_mode,)except Exception:- await store.mark_failed(resolved, ctx)raise- else:- await store.mark_consumed(resolved, ctx)finally:await resolved.cleanup()diff --git a/openviking/server/routers/resources.py b/openviking/server/routers/resources.pyindex 4fc9d73d8..a254cf6bb 100644--- a/openviking/server/routers/resources.py+++ b/openviking/server/routers/resources.py@@ -219,18 +219,18 @@ async def add_resource(allow_local_path_resolution = Falseoriginal_filename = Noneresolved = None- store = Noneif request.temp_file_id:if request.watch_interval > 0:raise InvalidArgumentError("watch_interval > 0 is not supported for uploaded content: an "- "upload is consumed as a one-time snapshot at ingest, so the "- "watch would re-process stale content forever. Watch a URL / "+ "upload is a static snapshot, so the watch would re-process "+ "stale content forever. Watch a URL / ""sitemap / RSS source instead, or re-add the resource when the ""source changes.")- store = TempUploadStore.build(http_request.app.state.config)- resolved = await store.resolve_for_consume(request.temp_file_id, _ctx)+ resolved = await TempUploadStore.build(http_request.app.state.config).resolve_for_consume(+ request.temp_file_id, _ctx+ )path = resolved.local_pathoriginal_filename = resolved.original_filenameallow_local_path_resolution = True@@ -284,12 +284,8 @@ async def add_resource(**kwargs,)except Exception:- if resolved and store:- await store.mark_failed(resolved, _ctx)raiseelse:- if resolved and store:- await store.mark_consumed(resolved, _ctx)return resultfinally:if resolved:@@ -335,8 +331,6 @@ async def add_skill(source_metadata["original_filename"] = resolved.original_filenamesource_path_hint = resolved.original_filename if resolved else None- store = TempUploadStore.build(http_request.app.state.config) if resolved else None-async def _add() -> dict[str, Any]:try:result = await service.resources.add_skill(@@ -350,12 +344,8 @@ async def add_skill()await persist_skill_source_metadata(service, _ctx, result, source_metadata)except Exception:- if resolved and store:- await store.mark_failed(resolved, _ctx)raiseelse:- if resolved and store:- await store.mark_consumed(resolved, _ctx)return resultfinally:if resolved:diff --git a/openviking/server/routers/skills.py b/openviking/server/routers/skills.pyindex 73631cb45..4fe2cd71d 100644--- a/openviking/server/routers/skills.py+++ b/openviking/server/routers/skills.py@@ -556,8 +556,9 @@ async def update_skill("operation": "update",}if request.temp_file_id:- store = TempUploadStore.build(http_request.app.state.config)- resolved = await store.resolve_for_consume(request.temp_file_id, _ctx)+ resolved = await TempUploadStore.build(http_request.app.state.config).resolve_for_consume(+ request.temp_file_id, _ctx+ )data = Path(resolved.local_path)allow_local_path_resolution = Trueif request.source_metadata is None:@@ -571,8 +572,6 @@ async def update_skill(source_metadata["original_filename"] = resolved.original_filenamesource_path_hint = resolved.original_filename if resolved else None- store = TempUploadStore.build(http_request.app.state.config) if resolved else None-async def _update() -> Dict[str, Any]:# Derive backup root from the actual skill root URI to keep backup in the same scope.skill_root_parent = root_uri.rsplit("/", 1)[0]@@ -637,14 +636,10 @@ async def update_skill(await _restore_skill_privacy(service, _ctx, skill_name, previous_privacy)except Exception:pass- if resolved and store:- await store.mark_failed(resolved, _ctx)raiseelse:if backup_created:await service.fs.rm(backup_uri, ctx=_ctx, recursive=True)- if resolved and store:- await store.mark_consumed(resolved, _ctx)result["action"] = "update"return resultfinally:diff --git a/openviking/server/temp_upload_store.py b/openviking/server/temp_upload_store.pyindex 290394cc7..801ade169 100644--- a/openviking/server/temp_upload_store.py+++ b/openviking/server/temp_upload_store.py@@ -5,6 +5,7 @@from __future__ import annotationsimport json+import loggingimport osimport tempfileimport time@@ -17,12 +18,14 @@ from typing import Any, Optionalfrom openviking.server.config import ServerConfig, TempUploadConfigfrom openviking.server.identity import RequestContext, Rolefrom openviking.server.local_input_guard import _read_upload_meta-from openviking.storage.errors import LockAcquisitionError-from openviking.storage.viking_fs import get_viking_fs+from openviking.storage.viking_fs import LS_ALL_NODES, get_viking_fsfrom openviking_cli.exceptions import InvalidArgumentError, PermissionDeniedErrorfrom openviking_cli.utils.config.open_viking_config import get_openviking_config_CHUNK_SIZE = 1024 * 1024+_SHARED_UPLOAD_ROOT = "viking://upload"++logger = logging.getLogger(__name__)@dataclass@@ -31,14 +34,8 @@ class ResolvedTempUpload:temp_file_id: stroriginal_filename: Optional[str]local_path: str- lock_handle: Any = Noneasync def cleanup(self) -> None:- if self.lock_handle is not None:- with suppress(Exception):- await get_viking_fs()._async_agfs.pathlock_release(self.lock_handle)- self.lock_handle = None-if self.mode == "shared" and self.local_path:with suppress(FileNotFoundError):os.unlink(self.local_path)@@ -48,20 +45,12 @@ def get_temp_upload_config(server_config: ServerConfig) -> TempUploadConfig:return server_config.temp_upload-def _shared_prefix(cfg: TempUploadConfig) -> str:- return cfg.shared_prefix.rstrip("/")---def _shared_upload_uri(cfg: TempUploadConfig, ctx: RequestContext, upload_id: str) -> str:- return f"{_shared_prefix(cfg)}/{upload_id}"+def _shared_content_uri(upload_id: str) -> str:+ return f"{_SHARED_UPLOAD_ROOT}/{upload_id}/content"-def _shared_content_uri(cfg: TempUploadConfig, ctx: RequestContext, upload_id: str) -> str:- return f"{_shared_upload_uri(cfg, ctx, upload_id)}/content"---def _shared_meta_uri(cfg: TempUploadConfig, ctx: RequestContext, upload_id: str) -> str:- return f"{_shared_upload_uri(cfg, ctx, upload_id)}/meta.json"+def _shared_meta_uri(upload_id: str) -> str:+ return f"{_SHARED_UPLOAD_ROOT}/{upload_id}/meta"def _parse_shared_temp_file_id(temp_file_id: str) -> Optional[str]:@@ -73,6 +62,23 @@ def _parse_shared_temp_file_id(temp_file_id: str) -> Optional[str]:return upload_id+def _new_shared_upload_id() -> str:+ return f"{time.time_ns() // 1_000_000:013d}-{uuid.uuid4().hex}"+++def _shared_upload_created_at(upload_id: str) -> Optional[float]:+ timestamp_ms, separator, nonce = upload_id.partition("-")+ if (+ not separator+ or len(timestamp_ms) != 13+ or not timestamp_ms.isdigit()+ or len(nonce) != 32+ or any(char not in "0123456789abcdef" for char in nonce)+ ):+ return None+ return int(timestamp_ms) / 1_000++async def _stream_upload_to_local_temp(upload_file: Any, max_size_bytes: int) -> tuple[str, int]:suffix = Path(upload_file.filename or "upload.tmp").suffix or ".tmp"fd, temp_path = tempfile.mkstemp(prefix="ov_http_upload_", suffix=suffix)@@ -135,44 +141,6 @@ class TempUploadStore:return self._resolve_local(temp_file_id)return await self._resolve_shared(temp_file_id, shared_id, ctx)- async def mark_failed(self, resolved: ResolvedTempUpload, ctx: RequestContext) -> None:- shared_id = _parse_shared_temp_file_id(resolved.temp_file_id)- if shared_id is None or resolved.lock_handle is None:- return- meta = await self._read_shared_meta(shared_id, ctx)- meta["state"] = "uploaded"- meta["updated_at"] = int(time.time())- await self._write_shared_meta(- shared_id,- ctx,- meta,- lease_ref=resolved.lock_handle,- )-- async def mark_consumed(self, resolved: ResolvedTempUpload, ctx: RequestContext) -> None:- shared_id = _parse_shared_temp_file_id(resolved.temp_file_id)- if shared_id is None:- return- uri = _shared_upload_uri(self.temp_cfg, ctx, shared_id)- await get_viking_fs().rm(- uri,- recursive=True,- ctx=self._internal_ctx(ctx),- lease_ref=resolved.lock_handle,- )-- async def try_cleanup_invalid_or_expired(- self,- temp_file_id: str,- ctx: RequestContext,- ) -> None:- shared_id = _parse_shared_temp_file_id(temp_file_id)- if shared_id is None:- return- uri = _shared_upload_uri(self.temp_cfg, ctx, shared_id)- with suppress(Exception):- await get_viking_fs().rm(uri, recursive=True, ctx=self._internal_ctx(ctx))-async def _save_local(self, upload_file: Any) -> str:config = get_openviking_config()temp_dir = config.storage.get_upload_temp_dir()@@ -210,20 +178,18 @@ class TempUploadStore:return temp_filenameasync def _save_shared(self, upload_file: Any, ctx: RequestContext) -> str:+ await self._cleanup_shared_uploads(ctx)temp_path, total_size = await _stream_upload_to_local_temp(upload_file, self.temp_cfg.shared_max_size_bytes)- upload_id = uuid.uuid4().hex+ upload_id = _new_shared_upload_id()temp_file_id = f"shared_{upload_id}"vfs = get_viking_fs()internal_ctx = self._internal_ctx(ctx)- content_uri = _shared_content_uri(self.temp_cfg, ctx, upload_id)- meta_uri = _shared_meta_uri(self.temp_cfg, ctx, upload_id)- now = int(time.time())+ content_uri = _shared_content_uri(upload_id)+ meta_uri = _shared_meta_uri(upload_id)meta = {- "version": 1,- "upload_mode": "shared",- "upload_id": upload_id,+ "version": 2,"temp_file_id": temp_file_id,"account": ctx.account_id,"user": ctx.user.user_id,@@ -231,11 +197,7 @@ class TempUploadStore:"content_type": getattr(upload_file, "content_type", None),"file_ext": Path(upload_file.filename or "").suffix,"size": total_size,- "sha256": None,"storage_uri": content_uri,- "state": "uploaded",- "created_at": now,- "updated_at": now,}try:@@ -246,7 +208,11 @@ class TempUploadStore:return temp_file_idexcept Exception:with suppress(Exception):- await self.try_cleanup_invalid_or_expired(temp_file_id, ctx)+ await vfs.rm(+ f"{_SHARED_UPLOAD_ROOT}/{upload_id}",+ recursive=True,+ ctx=internal_ctx,+ )raisefinally:with suppress(FileNotFoundError):@@ -313,79 +279,37 @@ class TempUploadStore:vfs = get_viking_fs()internal_ctx = self._internal_ctx(ctx)if not await vfs.exists(content_uri, ctx=internal_ctx):- await self.try_cleanup_invalid_or_expired(temp_file_id, ctx)raise PermissionDeniedError("Temporary upload is invalid: content missing.")- lock_path = vfs._uri_to_path(- _shared_upload_uri(self.temp_cfg, ctx, upload_id),- ctx=internal_ctx,- )- try:- lease = await vfs._async_agfs.pathlock_acquire_tree(lock_path, timeout_secs=0.0)- except LockAcquisitionError:- raise PermissionDeniedError("Temporary upload is being consumed.")-+ file_ext = meta.get("file_ext") or ".tmp"+ fd, temp_path = tempfile.mkstemp(prefix="ov_shared_upload_", suffix=file_ext)+ os.close(fd)try:- meta = await self._read_shared_meta(upload_id, ctx)- now = int(time.time())- if meta.get("state") != "uploaded":- raise PermissionDeniedError("Temporary upload is being consumed.")-- meta["state"] = "consuming"- meta["updated_at"] = now- await self._write_shared_meta(upload_id, ctx, meta, lease_ref=lease)-- file_ext = meta.get("file_ext") or ".tmp"- fd, temp_path = tempfile.mkstemp(prefix="ov_shared_upload_", suffix=file_ext)- os.close(fd)- try:- content = await vfs.read_file_bytes(content_uri, ctx=internal_ctx)- with open(temp_path, "wb") as f:- f.write(content)- except Exception:- with suppress(FileNotFoundError):- os.unlink(temp_path)- raise-- return ResolvedTempUpload(- mode="shared",- temp_file_id=temp_file_id,- original_filename=meta.get("original_filename") or None,- local_path=temp_path,- lock_handle=lease,- )+ content = await vfs.read_file_bytes(content_uri, ctx=internal_ctx)+ with open(temp_path, "wb") as f:+ f.write(content)except Exception:- with suppress(Exception):- await vfs._async_agfs.pathlock_release(lease)+ with suppress(FileNotFoundError):+ os.unlink(temp_path)raise+ return ResolvedTempUpload(+ mode="shared",+ temp_file_id=temp_file_id,+ original_filename=meta.get("original_filename") or None,+ local_path=temp_path,+ )async def _read_shared_meta(self, upload_id: str, ctx: RequestContext) -> dict[str, Any]:- meta_uri = _shared_meta_uri(self.temp_cfg, ctx, upload_id)+ vfs = get_viking_fs()+ internal_ctx = self._internal_ctx(ctx)try:- raw = await get_viking_fs().read_file(meta_uri, ctx=self._internal_ctx(ctx))- data = json.loads(raw)+ data = json.loads(await vfs.read_file(_shared_meta_uri(upload_id), ctx=internal_ctx))except Exception as exc:raise PermissionDeniedError("Temporary upload metadata is invalid or missing.") from excif not isinstance(data, dict):raise PermissionDeniedError("Temporary upload metadata is invalid or missing.")return data- async def _write_shared_meta(- self,- upload_id: str,- ctx: RequestContext,- meta: dict[str, Any],- lease_ref: Any = None,- ) -> None:- """Write shared-upload metadata under an optional existing pathlock lease."""- meta_uri = _shared_meta_uri(self.temp_cfg, ctx, upload_id)- await get_viking_fs().write_file(- meta_uri,- json.dumps(meta, ensure_ascii=False),- ctx=self._internal_ctx(ctx),- lease_ref=lease_ref,- )-def _validate_shared_meta(self,meta: dict[str, Any],@@ -397,17 +321,82 @@ class TempUploadStore:if meta.get("account") != ctx.account_id:raise PermissionDeniedError("Temporary upload does not belong to current account.")- @staticmethod- def _cleanup_local_temp_files(temp_dir: Path, max_age_hours: int = 1) -> None:+ async def _cleanup_shared_uploads(self, ctx: RequestContext) -> None:+ if self.temp_cfg.ttl_seconds == 0:+ return+ vfs = get_viking_fs()+ internal_ctx = self._internal_ctx(ctx)+ try:+ uploads = await vfs.ls(+ _SHARED_UPLOAD_ROOT,+ show_all_hidden=True,+ node_limit=LS_ALL_NODES,+ ctx=internal_ctx,+ )+ except Exception:+ logger.warning(+ "Shared temp upload cleanup list failed account=%s",+ ctx.account_id,+ exc_info=True,+ )+ return++ now = time.time()+ cutoff = now - self.temp_cfg.ttl_seconds+ logger.debug(+ "Shared temp upload cleanup account=%s ttl_seconds=%s upload_count=%s "+ "now=%s cutoff=%s",+ ctx.account_id,+ self.temp_cfg.ttl_seconds,+ len(uploads),+ now,+ cutoff,+ )+ for upload in uploads:+ if not upload.get("isDir"):+ continue+ uri = str(upload.get("uri") or "").rstrip("/")+ upload_id = uri.removeprefix(f"{_SHARED_UPLOAD_ROOT}/")+ if not uri.startswith(f"{_SHARED_UPLOAD_ROOT}/") or "/" in upload_id:+ continue+ created_at = _shared_upload_created_at(upload_id)+ if created_at is None:+ logger.debug("Shared temp upload cleanup skipped malformed uri=%s", uri)+ continue+ age_seconds = now - created_at+ expired = created_at < cutoff+ logger.debug(+ "Shared temp upload cleanup candidate uri=%s created_at=%s "+ "age_seconds=%s expired=%s",+ uri,+ created_at,+ age_seconds,+ expired,+ )+ if not expired:+ continue+ try:+ await vfs.rm(uri, recursive=True, ctx=internal_ctx)+ except Exception:+ logger.warning(+ "Shared temp upload cleanup remove failed uri=%s",+ uri,+ exc_info=True,+ )+ else:+ logger.debug("Shared temp upload cleanup removed uri=%s", uri)++ def _cleanup_local_temp_files(self, temp_dir: Path) -> None:+ if self.temp_cfg.ttl_seconds == 0:+ returnif not temp_dir.exists():returnnow = time.time()- max_age_seconds = max_age_hours * 3600for file_path in temp_dir.iterdir():if not file_path.is_file():continuefile_age = now - file_path.stat().st_mtime- if file_age > max_age_seconds:+ if file_age > self.temp_cfg.ttl_seconds:file_path.unlink(missing_ok=True)if not file_path.name.endswith(".ov_upload.meta"):meta_path = temp_dir / f"{file_path.name}.ov_upload.meta"diff --git a/openviking/service/resource_service.py b/openviking/service/resource_service.pyindex 25eba470d..a0a96d2ec 100644--- a/openviking/service/resource_service.py+++ b/openviking/service/resource_service.py@@ -281,15 +281,12 @@ class ResourceService:"Pass 'to' explicitly, or add a resource type that returns root_uri.")if processor_kwargs.get("temp_file_id"):- # An uploaded source is a one-time snapshot: the staged upload is- # consumed at ingest, so a watch task recorded against it would- # re-process the frozen snapshot every interval — silently ignoring- # all edits to the client-side source — instead of watching anything- # live. Reject at creation instead of pretending to watch.+ # An uploaded source is a static snapshot, so a watch task recorded+ # against it would re-process the frozen snapshot every interval.raise InvalidArgumentError("watch_interval > 0 is not supported for uploaded content: an "- "upload is consumed as a one-time snapshot at ingest, so the "- "watch would re-process stale content forever. Watch a URL / "+ "upload is a static snapshot, so the watch would re-process "+ "stale content forever. Watch a URL / ""sitemap / RSS source instead, or re-add the resource when the ""source changes.")@@ -983,14 +980,12 @@ class ResourceService:kwargs.update(normalized_args.processor_kwargs)git_repo_source = is_git_repo_url(path)if watch_interval > 0 and kwargs.get("temp_file_id"):- # Fail fast, before any ingestion: an uploaded source is a one-time- # snapshot, so a watch on it can never observe the live source (see the- # matching guard in _manage_watch_if_needed, the watch-creation choke- # point that protects all other call paths).+ # Fail fast: a watch on a static upload snapshot can never observe the+ # live source.raise InvalidArgumentError("watch_interval > 0 is not supported for uploaded content: an "- "upload is consumed as a one-time snapshot at ingest, so the "- "watch would re-process stale content forever. Watch a URL / "+ "upload is a static snapshot, so the watch would re-process "+ "stale content forever. Watch a URL / ""sitemap / RSS source instead, or re-add the resource when the ""source changes.")diff --git a/openviking/service/user_deletion.py b/openviking/service/user_deletion.pyindex fc85c8f24..7e8423d28 100644--- a/openviking/service/user_deletion.py+++ b/openviking/service/user_deletion.py@@ -25,6 +25,7 @@ logger = get_logger(__name__)TASK_TYPE = "user_delete"_CANCEL_WAIT_SECONDS = 10 * 60+_SHARED_UPLOAD_ROOT = "viking://upload"_ACTIVE_TASK_STATUSES = (TaskStatus.PENDING,TaskStatus.RUNNING,@@ -65,14 +66,12 @@ class UserDeletionService:service: Any,manager: Any,service_loop: asyncio.AbstractEventLoop,- shared_upload_prefix: str,oauth_store: Any = None,usage_audit_runtime: Any = None,) -> None:self._service = serviceself._manager = managerself._service_loop = service_loop- self._shared_upload_prefix = shared_upload_prefix.rstrip("/")self._oauth_store = oauth_storeself._usage_audit_runtime = usage_audit_runtimeself._request_lock = asyncio.Lock()@@ -435,7 +434,7 @@ class UserDeletionService:viking_fs = self._service.viking_fstry:uploads = await viking_fs.ls(- self._shared_upload_prefix,+ _SHARED_UPLOAD_ROOT,show_all_hidden=True,node_limit=LS_ALL_NODES,ctx=ctx,@@ -444,14 +443,22 @@ class UserDeletionService:returnfor upload in uploads:- uri = upload.get("uri") or f"{self._shared_upload_prefix}/{upload.get('name', '')}"- uri = uri.rstrip("/")- if not uri or uri == self._shared_upload_prefix:+ uri = str(upload.get("uri") or "").rstrip("/")+ if not uri or uri == _SHARED_UPLOAD_ROOT:continue+ upload_id = uri.removeprefix(f"{_SHARED_UPLOAD_ROOT}/")+ if (+ not upload.get("isDir")+ or not uri.startswith(f"{_SHARED_UPLOAD_ROOT}/")+ or not upload_id+ or "/" in upload_id+ ):+ continue+ meta_uri = f"{uri}/meta"try:- meta = json.loads(await viking_fs.read_file(f"{uri}/meta.json", ctx=ctx))+ meta = json.loads(await viking_fs.read_file(meta_uri, ctx=ctx))except Exception:- logger.warning("Skipping shared upload with unreadable metadata: %s", uri)+ logger.warning("Skipping shared upload with unreadable metadata: %s", meta_uri)continueif meta.get("account") == ctx.account_id and meta.get("user") == ctx.user.user_id:await viking_fs.rm(uri, recursive=True, ctx=ctx)@@ -520,7 +527,6 @@ async def setup_user_deletion(*,service: Any,manager: Any,- shared_upload_prefix: str,oauth_store: Any = None,usage_audit_runtime: Any = None,) -> Optional[UserDeletionService]:@@ -531,7 +537,6 @@ async def setup_user_deletion(service=service,manager=manager,service_loop=asyncio.get_running_loop(),- shared_upload_prefix=shared_upload_prefix,oauth_store=oauth_store,usage_audit_runtime=usage_audit_runtime,)diff --git a/tests/server/test_admin_api.py b/tests/server/test_admin_api.pyindex 1aaab287c..82b378ab5 100644--- a/tests/server/test_admin_api.py+++ b/tests/server/test_admin_api.py@@ -180,7 +180,6 @@ async def admin_app(admin_service):app.state.user_deletion_service = await setup_user_deletion(service=admin_service,manager=manager,- shared_upload_prefix=config.temp_upload.shared_prefix,)# Set auth plugin (lifespan not triggered in ASGI tests)@@ -641,7 +640,7 @@ async def test_remove_user(admin_service: OpenVikingService,admin_app: FastAPI,):- """Deletion revokes the user and removes their private data and task records."""+ """Deletion revokes the user and removes only their private data, uploads, and tasks."""acct = _uid()await admin_client.post("/api/v1/admin/accounts",@@ -657,6 +656,15 @@ async def test_remove_user(bob_ctx = RequestContext(user=UserIdentifier(acct, "bob"), role=Role.USER)private_uri = "viking://user/bob/memories/private.md"await admin_service.viking_fs.write_file(private_uri, "private", ctx=bob_ctx)+ alice_upload_uri = "viking://upload/1800000000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"+ bob_upload_uri = "viking://upload/1800000000000-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"+ upload_ctx = RequestContext(user=UserIdentifier(acct, "alice"), role=Role.ROOT)+ for upload_uri, user_id in ((alice_upload_uri, "alice"), (bob_upload_uri, "bob")):+ await admin_service.viking_fs.write_file(+ f"{upload_uri}/meta",+ json.dumps({"account": acct, "user": user_id}),+ ctx=upload_ctx,+ )bob_task = await get_task_tracker().create("session_commit",resource_id="bob-session",@@ -679,6 +687,8 @@ async def test_remove_user(deletion_task = await _wait_for_task(admin_client, task_id)assert deletion_task["status"] == "completed"assert not await admin_service.viking_fs.exists(private_uri, ctx=bob_ctx)+ assert not await admin_service.viking_fs.exists(bob_upload_uri, ctx=upload_ctx)+ assert await admin_service.viking_fs.exists(alice_upload_uri, ctx=upload_ctx)assert not admin_app.state.api_key_manager.has_user(acct, "bob")assert (await get_task_tracker().get(diff --git a/tests/server/test_api_resources.py b/tests/server/test_api_resources.pyindex 5c3b14422..82cccc694 100644--- a/tests/server/test_api_resources.py+++ b/tests/server/test_api_resources.py@@ -13,7 +13,6 @@ import pytestfrom openviking.server.identity import RequestContext, Rolefrom openviking.server.routers import resources as resources_routerfrom openviking.server.routers.resources import AddResourceRequest-from openviking.storage.viking_fs import get_viking_fsfrom openviking.telemetry import get_current_telemetryfrom openviking_cli.session.user_id import UserIdentifier@@ -836,7 +835,7 @@ async def test_add_resource_accepts_temp_uploaded_file(assert body["result"]["root_uri"].startswith("viking://")-async def test_shared_temp_upload_and_add_resource_deletes_upload_dir(+async def test_shared_temp_upload_can_be_added_repeatedly(client: httpx.AsyncClient,service,):@@ -849,21 +848,15 @@ async def test_shared_temp_upload_and_add_resource_deletes_upload_dir(temp_file_id = upload_resp.json()["result"]["temp_file_id"]assert temp_file_id.startswith("shared_")- upload_id = temp_file_id[len("shared_") :]- upload_root = f"viking://upload/{upload_id}"- vfs = get_viking_fs()- assert await vfs.exists(f"{upload_root}/meta.json")- assert await vfs.exists(f"{upload_root}/content")-- resp = await client.post(- "/api/v1/resources",- json={"temp_file_id": temp_file_id, "reason": "shared upload", "wait": True},- )- assert resp.status_code == 200- body = resp.json()- assert body["status"] == "ok"- assert body["result"]["root_uri"].startswith("viking://")- assert not await vfs.exists(upload_root)+ for reason in ("first shared upload", "second shared upload"):+ resp = await client.post(+ "/api/v1/resources",+ json={"temp_file_id": temp_file_id, "reason": reason, "wait": True},+ )+ assert resp.status_code == 200+ body = resp.json()+ assert body["status"] == "ok"+ assert body["result"]["root_uri"].startswith("viking://")@pytest.mark.parametrize("upload_mode", ["local", "shared"])@@ -924,6 +917,7 @@ async def test_shared_temp_upload_failed_consume_is_retryable(async def fake_add_resource(**kwargs):raise RuntimeError("boom")+ original_add_resource = service.resources.add_resourcemonkeypatch.setattr(service.resources, "add_resource", fake_add_resource)transport = httpx.ASGITransport(app=app, raise_app_exceptions=False)async with httpx.AsyncClient(transport=transport, base_url="http://testserver") as http_client:@@ -933,10 +927,13 @@ async def test_shared_temp_upload_failed_consume_is_retryable()assert resp.status_code == 500- upload_id = temp_file_id[len("shared_") :]- meta_uri = f"viking://upload/{upload_id}/meta.json"- meta_raw = await get_viking_fs().read_file(meta_uri)- assert '"state": "uploaded"' in meta_raw+ monkeypatch.setattr(service.resources, "add_resource", original_add_resource)+ retry = await client.post(+ "/api/v1/resources",+ json={"temp_file_id": temp_file_id, "reason": "retry shared upload", "wait": True},+ )+ assert retry.status_code == 200+ assert retry.json()["status"] == "ok"async def test_shared_upload_content_read_rejects_internal_scope(@@ -953,7 +950,7 @@ async def test_shared_upload_content_read_rejects_internal_scope(resp = await client.get("/api/v1/content/read",- params={"uri": f"viking://upload/{upload_id}/meta.json"},+ params={"uri": f"viking://upload/{upload_id}/meta"},)assert resp.status_code == 400body = resp.json()diff --git a/tests/server/test_resource_ingest_parse_mode.py b/tests/server/test_resource_ingest_parse_mode.pyindex 072facb86..b152f24fe 100644--- a/tests/server/test_resource_ingest_parse_mode.py+++ b/tests/server/test_resource_ingest_parse_mode.py@@ -22,8 +22,6 @@ async def test_ingest_temp_upload_forwards_no_split(monkeypatch: pytest.MonkeyPa)store = SimpleNamespace(resolve_for_consume=AsyncMock(return_value=resolved),- mark_consumed=AsyncMock(),- mark_failed=AsyncMock(),)add_resource = AsyncMock(return_value={"status": "success", "root_uri": "viking://resources/upload"}diff --git a/tests/service/test_resource_service_watch.py b/tests/service/test_resource_service_watch.pyindex aa5955cf1..dd20ba04c 100644--- a/tests/service/test_resource_service_watch.py+++ b/tests/service/test_resource_service_watch.py@@ -175,7 +175,7 @@ class TestWatchTaskCreation:async def test_watch_interval_rejected_for_uploaded_snapshot_source(self, resource_service: ResourceService, request_context: RequestContext):- """A temp-upload source is a one-time snapshot: watching it would silently+ """A temp-upload source is a static snapshot: watching it would silentlyre-process stale content forever, so creation must fail loudly."""to_uri = "viking://resources/uploaded_resource"