fix(app_controller): _offload_entry_payload unwraps Result from session_logger

Regression fix: session_logger.log_tool_call was partially migrated to return
Result[data=str(ps1_path) | None] but the call site in _offload_entry_payload
still did Path(ref_path).name on the Result object, raising TypeError.

The fix wraps the call to log_tool_call in an isinstance(ref_result, Result)
guard and unwraps .ok / .data to produce the [REF:filename] reference. On
errors, a logging.debug is emitted (per Heuristic #19) and the payload is
preserved unchanged.

Also adds import logging to the module top and rom src.result_types
import Result, ErrorInfo, ErrorKind to support the convention's 'AND over OR'
pattern at this call site.

The log_tool_output call site is unchanged because log_tool_output still
returns Optional[str] (not Result); applying the unwrap pattern there would
crash. The spec's illustrative code treated both functions as Result-based,
but only log_tool_call was actually half-migrated.

Refs: conductor/tracks/result_migration_app_controller_20260618 (FR5)
Refs: tests/test_app_controller_offloading.py:test_offload_entry_payload_tool_call_unwraps_result
Refs: tests/test_app_controller_offloading.py:test_offload_entry_payload_preserves_script_on_log_tool_call_error
This commit is contained in:
ed
2026-06-18 19:32:08 -04:00
parent 58fe3063d8
commit 26e5757760
2 changed files with 8 additions and 4 deletions
@@ -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" }