fix: unify task workspace directory resolution

This commit is contained in:
theshy
2026-04-14 16:44:31 +08:00
parent d5d9693581
commit 055474360e
11 changed files with 192 additions and 56 deletions

View File

@ -5,6 +5,7 @@ from pathlib import Path
import re
from biliup_next.core.models import ActionRecord, SessionBinding, TaskContext, utc_now_iso
from biliup_next.infra.workspace_paths import resolve_task_work_dir
class SessionDeliveryService:
@ -222,10 +223,10 @@ class SessionDeliveryService:
return None
return bvid
def _full_video_bvid_path(self, task_title: str) -> Path:
session_dir = Path(str(self.settings["paths"]["session_dir"])) / task_title
session_dir.mkdir(parents=True, exist_ok=True)
return session_dir / "full_video_bvid.txt"
def _full_video_bvid_path(self, task) -> Path: # type: ignore[no-untyped-def]
work_dir = resolve_task_work_dir(task)
work_dir.mkdir(parents=True, exist_ok=True)
return work_dir / "full_video_bvid.txt"
def _upsert_session_binding_for_context(self, context: TaskContext, full_video_bvid: str, now: str) -> None:
self.repo.upsert_session_binding(
@ -253,6 +254,6 @@ class SessionDeliveryService:
context.updated_at = now
self.repo.upsert_task_context(context)
self._upsert_session_binding_for_context(context, full_video_bvid, now)
path = self._full_video_bvid_path(task.title)
path = self._full_video_bvid_path(task)
path.write_text(full_video_bvid, encoding="utf-8")
return path