diff --git a/src/daemon/dispatcher.py b/src/daemon/dispatcher.py index cdf91d8..fcdfed8 100644 --- a/src/daemon/dispatcher.py +++ b/src/daemon/dispatcher.py @@ -238,9 +238,11 @@ class Dispatcher: return "\n".join(parts) def _record_routing(self, task: Task, decision: Dict[str, Any], - outcome: str, detail: Optional[str]) -> None: + outcome: str, detail: Optional[str], + override_db_path: Optional[Path] = None) -> None: """写路由审计日志到 routing_decisions 表""" - if not self.db_path: + effective_db = override_db_path or self.db_path + if not effective_db: return try: conn = sqlite3.connect(str(self.db_path)) diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index d91b259..bbeb3d0 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -383,7 +383,7 @@ class Ticker: result = await self.dispatcher.dispatch( task, action_type="review", - project_config={"project_id": project_id}, + project_config={"project_id": project_id, "db_path": db_path}, ) if result["status"] == "dispatched": dispatched.append(task.id)