diff --git a/conductor/tracks/result_migration_app_controller_20260618/state.toml b/conductor/tracks/result_migration_app_controller_20260618/state.toml index 9acfce92..c027a95d 100644 --- a/conductor/tracks/result_migration_app_controller_20260618/state.toml +++ b/conductor/tracks/result_migration_app_controller_20260618/state.toml @@ -27,7 +27,7 @@ phase_5 = { status = "pending", checkpointsha = "", name = "Verify, document, en # Phase 1: Setup + Fix the regression t1_1 = { status = "pending", commit_sha = "", description = "Create sub-track folder (spec.md exists; plan.md, metadata.json, state.toml)" } t1_2 = { status = "pending", commit_sha = "", description = "Update conductor/tracks.md with the new sub-track row" } -t1_3 = { status = "pending", commit_sha = "", description = "Fix _offload_entry_payload call site in src/app_controller.py:3709-3725 (unwrap Result from log_tool_output/log_tool_call)" } +t1_3 = { status = "completed", commit_sha = "", description = "Fix _offload_entry_payload call site in src/app_controller.py:3709-3725 (unwrap Result from log_tool_call; log_tool_output already returns Optional[str])" } t1_4 = { status = "pending", commit_sha = "", description = "Add 2 unwrap-path tests in tests/test_app_controller_offloading.py" } t1_5 = { status = "pending", commit_sha = "", description = "Run targeted regression test (test_tool_ask_approval + test_execution_sim_live); verify both pass" } t1_6 = { status = "pending", commit_sha = "", description = "Phase 1 checkpoint commit" } diff --git a/src/app_controller.py b/src/app_controller.py index 7b1ad232..2e0d4527 100644 --- a/src/app_controller.py +++ b/src/app_controller.py @@ -3,6 +3,7 @@ from __future__ import annotations import copy import inspect import json +import logging import os import re import signal @@ -37,6 +38,7 @@ from src import shell_runner from src import theme_2 as theme from src import thinking_parser from src import tool_presets +from src.result_types import Result, ErrorInfo, ErrorKind from src.context_presets import ContextPresetManager from src.file_cache import ASTParser @@ -3718,10 +3720,12 @@ class AppController: payload["output"] = f"[REF:{filename}]" if kind == "tool_call" and "script" in payload: script = payload["script"] - ref_path = session_logger.log_tool_call(script, "LOG_ONLY", None) - if ref_path: - filename = Path(ref_path).name + ref_result = session_logger.log_tool_call(script, "LOG_ONLY", None) + if isinstance(ref_result, Result) and ref_result.ok and ref_result.data: + filename = Path(ref_result.data).name payload["script"] = f"[REF:{filename}]" + elif isinstance(ref_result, Result) and ref_result.errors: + logging.getLogger(__name__).debug("offload tool_call failed: %s", ref_result.errors[0].ui_message()) return optimized def _on_api_event(self, event_name: str = "generic_event", **kwargs: Any) -> None: