Per plan Task 7.2: marked the 'Public API deprecation' section as
RESOLVED 2026-06-15. The section now describes the canonical public
API (send_result()) and points to the public_api_migration_and_ui_polish_20260615
track as the source of the migration.
Verification: rg -i 'send.*deprecat|deprecat.*send' conductor/product-guidelines.md
returns 0 hits.
Per plan Task 7.1: removed all deprecation language about ai_client.send()
from docs/guide_ai_client.md:
- Removed the 'Public API > ai_client.send(...) deprecated' section
- Updated 'Migration Notes for Existing Callers' to reflect the
public_api_migration_and_ui_polish_20260615 completion
- Updated 'Public API Result Migration' line in the see-also section
to mark the follow-up track as COMPLETED (not 'planned')
Verification: rg -i 'deprecat.*send|send.*deprecat' docs/guide_ai_client.md
returns 0 hits (the only remaining 'deprecat' mention is the resolved
Public API Result Migration bullet which now describes the resolution
path, not a deprecation).
Removes the filterwarnings entry that silenced the DeprecationWarning
emitted by the now-removed send() function. The filter was added in
data_oriented_error_handling_20260606 (commit 73cf321c) specifically
to silence the send() deprecation; no other deprecation in the
codebase was silenced by it. Now that send() is gone, the filter is
obsolete.
Verification: 'uv run rg ignore:Use ai_client.send_result pyproject.toml'
returns 0 hits.
Per plan Task 6.3: both tests in test_deprecation_warnings.py are obsolete
after the send() function was removed in Phase 6.1:
- test_send_deprecated_warning_emitted_once_per_site: literally cannot
run without ai_client.send (AttributeError)
- test_send_result_does_not_emit_deprecation: trivially true after
send() is removed (no deprecation source)
The test_send_result_does_not_emit_deprecation regression test is
preserved in tests/test_ai_client_result.py (added in Phase 2.7 as the
renamed test). The pre-Phase-2.7 test_send_deprecated_emits_warning
was deleted in Phase 2.7.
Verification: pytest tests/test_deprecation_warnings.py reports
'ERROR: file or directory not found'.
Removes the @deprecated send() function (was at src/ai_client.py:2939-3000)
and the from typing_extensions import deprecated import (line 38). The
function is replaced by send_result() which has been the canonical public
API since the data_oriented_error_handling_20260606 track (commit 9f86b2be).
All 3 production call sites (src/conductor_tech_lead.py:68,
src/orchestrator_pm.py:86, src/multi_agent_conductor.py:591) and 18 test
files were migrated in Phases 1-2; 4 pre-existing failures were fixed in
Phases 3-4. No remaining callers of ai_client.send(.
Verification:
- uv run rg 'def send\\(' src/ai_client.py returns 0 hits
- import src.ai_client; hasattr(ai, 'send') is False
- 73/73 migrated tests pass
The test used src.find() which locates the first occurrence of
'Refresh Registry' in the comment block (line 2090 in src/gui_2.py),
not the actual code (line 2111). The 400-char snippet window doesn't
reach the code, so the assertion for 'load_registry' fails.
Production code is already correct (in-place load_registry()) at
src/gui_2.py:2111-2112 (user commit df7bda6e). This test just needs
to use rfind() to locate the actual code, not the comment.
Change: src.find(marker) -> src.rfind(marker)
1 test passes (was 1 pre-existing failure).
The test used src.find() which locates the first occurrence of
'Keep Pairs:' in the comment block (line 5113 in src/gui_2.py), not
the actual code (line 5130). The 200-char snippet window only reaches
the comment, so the assertions for set_next_item_width(140) and
drag_int fail.
Production code is already correct (set_next_item_width(140) +
drag_int) at src/gui_2.py:5130-5131 (user commit d0b06575). This
test just needs to use rfind() to locate the actual code, not the
comment.
Change: src.find(marker) -> src.rfind(marker)
1 test passes (was 1 pre-existing failure).
The 2 tests in test_symbol_parsing.py mock src.ai_client.send but
production now uses send_result (migrated by doeh_test_thinking_cleanup_20260615
commit 24ba2499). Mocks receive 0 calls; tests fail with
"send was called 0 times".
Changes:
- Replace patch(src.ai_client.send) with patch(src.ai_client.send_result)
- Rename mock_send to mock_send_result
- Set return_value=Result(data="mocked response")
- Add "from src.result_types import Result" import
All 2 tests in test_symbol_parsing.py pass (were 2 pre-existing failures).
The _send_qwen() function returns Result[str] after the
data_oriented_error_handling_20260606 refactor (commit 64d6ba2d),
but 2 tests in test_qwen_provider.py were asserting against the
raw str type. They were 2 of the 10 pre-existing failures documented
in the track spec.
Changes (mirrors the doeh_test_thinking_cleanup_20260615 pattern for
grok/llama/llama_native):
- Replace assert result == "hi from qwen" with assert result.ok and result.data == "hi from qwen"
- Replace assert "cat" in result.lower() with assert result.ok and "cat" in result.data.lower()
- Add "from src.result_types import Result" import
All 5 tests in test_qwen_provider.py now pass (was 3/5).
Phase 2.13 missed the test_run_worker_lifecycle_blocked test in
test_orchestration_logic.py - it also mocked src.ai_client.send.
The test was failing with "Worker send_result failed for T1: ...
[Errno 2] No such file or directory: .beads_mock/beads.json" because
the unmocked send_result fell through to the real provider which
tried to read beads.json.
Changes:
- Replace patch(src.ai_client.send) with patch(src.ai_client.send_result)
- Wrap mock return_value with Result(data="BLOCKED because of missing info")
All 8 tests in test_orchestration_logic.py now pass.
The test_ai_client_passes_qa_callback test calls ai_client.send() with
qa_callback=lambda. The qa_callback is passed through to the provider
function (_send_gemini).
Per plan note: the test has complex callback setup; the Result handling
needs the mock to return Result(data="ok") so the qa_callback passes
through and the test succeeds.
Changes:
- Rename ai_client.send(...) to ai_client.send_result(...)
- Add assert result.ok
- Mock _send_gemini to return Result(data="ok") instead of relying on
the default (which would call the real provider)
- Add "from src.result_types import Result" import
7 tests pass (the migrated test_ai_client_passes_qa_callback was
previously broken because the send() call hit the real provider and
either failed or returned empty; the mock now provides a clean response).
Changes:
- Rename ai_client.send(...) to ai_client.send_result(...) (2 sites)
- Add assert result.ok (1 site; the second test only checks result is not None)
- Add "from src.result_types import Result" import
2 tests pass.
All 6 sites in test_deepseek_provider.py call ai_client.send(...). Each
assertion pattern is slightly different (==, "in", call_args inspection);
migration follows the same pattern: rename to send_result(), add
assert result.ok, and use result.data for the response text.
Changes:
- Rename ai_client.send(...) to ai_client.send_result(...) (6 sites)
- Add assert result.ok (6 sites)
- Replace result == "x" with result.data == "x" (or "x" in result.data)
- Add "from src.result_types import Result" import
7 tests pass (1 unrelated test_deepseek_model_selection + 6 migrated).
Per plan Task 2.7:
- DELETE test_send_deprecated_emits_warning (obsolete after Phase 6; send()
is being removed)
- RENAME test_send_extracts_data_from_result -> test_send_result_does_not_emit_deprecation
(this is the regression test the plan said to KEEP; it now asserts the new
API does not emit a deprecation warning, instead of testing the old behavior)
- MIGRATE test_send_extracts_data_from_result (renamed to the above)
- MIGRATE test_send_returns_empty_string_on_error_result ->
test_send_result_returns_empty_data_with_error_on_auth_failure (asserts
the Result has data="" and not ok)
5 tests pass (down from 6; the deleted test removed 1; the renamed
test_send_extracts_data_from_result became test_send_result_does_not_emit_deprecation).
The test_mcp_tool_call_is_dispatched test calls ai_client.send() and
asserts the MCP dispatch function was called. Migrating to send_result()
+ assert result.ok.
Changes:
- Rename ai_client.send(...) to ai_client.send_result(...)
- Add assert result.ok
- Add "from src.result_types import Result" import
1 test passes.
The test_send_invokes_adapter_send test calls ai_client.send() and
asserts the return value. Migrating to send_result() with
assert res.ok and res.data == "Hello from mock adapter".
Changes:
- Rename ai_client.send(...) to ai_client.send_result(...)
- Add assert res.ok before accessing res.data
- Add "from src.result_types import Result" import
1 test passes.
The test_gemini_cli_loop_termination test calls ai_client.send() and
asserts the return value. Migrating to send_result() with
assert result.ok and result.data == "Final answer".
Changes:
- Rename ai_client.send(...) to ai_client.send_result(...)
- Add assert result.ok before accessing result.data
- Add "from src.result_types import Result" import
3 tests pass.
The test calls ai_client.send() but does not check the return value -
it only verifies the side effect on gemini cache stats. Migrating to
send_result() and asserting result.ok is enough.
Changes:
- Rename ai_client.send(...) to ai_client.send_result(...)
- Add assert result.ok (the return value is unused)
- Add "from src.result_types import Result" import
2 tests pass.
Replaces the deprecated ai_client.send() call with ai_client.send_result()
in the test. The mock for GeminiCliAdapter is unchanged (it is patched
to return a dict that send_result unwraps internally).
Changes:
- Rename response = ai_client.send(...) to result = ai_client.send_result(...)
- Add assert result.ok before accessing result.data
- Add "from src.result_types import Result" import
1 test passes.
Phase 1.3 migrated run_worker_lifecycle to send_result(). The mock_ai_client
fixture in test_spawn_interception_v2.py mocked src.ai_client.send and
returned a string. The test_run_worker_lifecycle_approved test asserts
on the call_args (user_message + md_content), which still works with
the new mock name.
Changes:
- Replace patch(src.ai_client.send) with patch(src.ai_client.send_result)
- Rename mock_send to mock_send_result
- Wrap mock return_value with Result(data="Task completed")
- Add "from src.result_types import Result" import
All 3 tests in test_spawn_interception_v2.py pass.
Phase 1.3 migrated run_worker_lifecycle to send_result(). This test
mocks src.ai_client.send and asserts it is NOT called (abort fires
before the AI dispatch). Migrating the mock to send_result is purely
for consistency and future-proofing; the test still passes either way.
Changes:
- Rename patch(src.ai_client.send) to patch(src.ai_client.send_result)
- Rename mock_send to mock_send_result
- Comment updated to reference send_result
Phase 1.3 migrated src/multi_agent_conductor.py:591 (run_worker_lifecycle)
to send_result(). The test_worker_streaming_intermediate test mocked
src.ai_client.send, which would break once Phase 1.3 was applied.
(Confirmed: test failed after Phase 1.3 commit.)
Changes:
- Replace patch(src.ai_client.send) with patch(src.ai_client.send_result)
- Rename mock_send to mock_send_result
- Wrap mock side_effect return with Result(data="DONE")
- Add "from src.result_types import Result" import
All 3 tests in test_phase6_engine.py pass.
Phase 1.2 migrated src/orchestrator_pm.py:86 to send_result(). The
test_generate_tracks_with_history test mocked src.ai_client.send,
which would break once Phase 1.2 was applied. (Confirmed: test failed
after Phase 1.2 commit.)
Changes:
- Replace @patch(src.ai_client.send) with @patch(src.ai_client.send_result)
- Rename mock_send to mock_send_result
- Wrap mock return_value with Result(data="[]")
- Add "from src.result_types import Result" import
All 3 tests in test_orchestrator_pm_history.py pass.
Phase 1.2 migrated src/orchestrator_pm.py:86 to send_result(). The 3
tests in TestOrchestratorPM mocked src.ai_client.send, which would
break once Phase 1.2 was applied. (Confirmed: tests failed after
Phase 1.2 commit.)
Changes:
- Replace @patch(src.ai_client.send) with @patch(src.ai_client.send_result)
- Rename mock_send to mock_send_result throughout
- Wrap mock return_value with Result(data=json.dumps(...))
- Add "from src.result_types import Result" import
All 3 tests pass.
Phase 1.1 + 1.2 migrated the production code to send_result(). The
test_generate_tracks and test_generate_tickets tests mocked
src.ai_client.send, causing "send was called 0 times" failures.
Changes:
- Replace patch(src.ai_client.send) with patch(src.ai_client.send_result)
- Wrap mock return_value with Result(data=mock_response)
- Add "from src.result_types import Result" import
All 8 tests in tests/test_orchestration_logic.py pass (2 migrated + 6
unaffected tests).
Phase 1.1 migrated src/conductor_tech_lead.py:68 from ai_client.send() to
ai_client.send_result(). The 3 tests in TestConductorTechLead mocked
src.ai_client.send which is no longer called by the production code,
causing "send was called 0 times" failures.
Changes:
- Replace patch("src.ai_client.send") with patch("src.ai_client.send_result")
- Wrap mock return_value with Result(data=...) and mock side_effect with
Result(data=...) values
- Add "from src.result_types import Result" import
All 9 tests in tests/test_conductor_tech_lead.py pass (3 migrated + 6
unaffected topological sort tests).
- src/conductor_tech_lead.py:68 (G1, commit bbb3d597): 2-arg call, no callbacks
- src/orchestrator_pm.py:86 (G2, commit 7ea802ab): 3-arg call with enable_tools
- src/multi_agent_conductor.py:591 (G3, commit bdd46299): 8-arg call with 5 callbacks
(the hardest; per-ticket error handling routes the error to comms +
pushes a 'response' event with status='error' + marks ticket.status='error')
Verified: uv run rg 'ai_client\.send\(' src/ returns 0 hits in production code
(line 8 of conductor_tech_lead.py is a docstring mention only).
Pending: 7 test files broken by these production migrations need
send_result() mocks instead of send() mocks. These are scheduled in
Phase 2.12-2.18 (added in the plan update bb3b3056).
Replaces deprecated ai_client.send(...) with ai_client.send_result(...) for
the 8-arg worker dispatch in run_worker_lifecycle. The new code branches on
result.ok:
- On success: response = result.data (continue as before)
- On error: log via comms + push a 'response' event with status='error' +
push ticket_completed + mark ticket.status='error' + return None
This is the hardest of the 3 production migrations (5 callbacks:
pre_tool_callback, qa_callback, patch_callback, stream_callback + the
worker_comms_callback already wired up).
The 2 tests in test_phase6_engine.py + test_spawn_interception_v2.py now
fail because they mock src.ai_client.send. These will be fixed in
Phase 2.16/2.18 by mocking send_result instead. test_run_worker_lifecycle_abort
still passes because the abort check fires before the send call.
Replaces deprecated ai_client.send(md_content='', user_message=user_message,
enable_tools=False) with ai_client.send_result(...) and branches on
result.ok. On error, logs the ui_message() and returns [] (the function
returns a list of track definitions or [] on failure).
The 3 tests in test_orchestrator_pm.py + 1 in test_orchestrator_pm_history.py
now fail because they mock src.ai_client.send. These will be fixed in
Phase 2.14-2.15 by mocking send_result instead.
Replaces deprecated ai_client.send(md_content='', user_message=user_message)
with ai_client.send_result(...) and branches on result.ok. On error, logs
the ui_message() and returns None (the function returns a list of ticket
definitions or None on failure).
The previous code called the @deprecated send() shim which silently
returns '' on error. The empty string would then be passed to json.loads,
causing JSONDecodeError and 3 retry attempts. The new code short-circuits
on the first error and returns None immediately.
This is the easiest of the 3 production migrations (2-arg call with no
callbacks). See plan.md Phase 1.1. Test fixes for the production-affected
mocks in test_conductor_tech_lead.py and test_orchestration_logic.py are
in Phase 2.12 and Phase 2.13.
NOTE: 4 tests now fail (3 in test_conductor_tech_lead.py + 1 in
test_orchestration_logic.py) because they mock src.ai_client.send.
These will be fixed in Phase 2.12/2.13 by mocking send_result instead.
The original Phase 2 covered 12 test files that *call* ai_client.send(...).
Phase 1.1 implementation revealed 7 additional test files that *mock*
ai_client.send (via patch()) for tests of the production code paths.
When production migrates to send_result(), these mocks receive 0 calls
and the tests fail with 'send was called 0 times'.
Adding Phase 2.12-2.18 to cover:
- test_conductor_tech_lead.py (3 mocks; breaks after Phase 1.1)
- test_orchestration_logic.py (1 mock; breaks after Phase 1.1)
- test_orchestrator_pm.py (3 mocks; pre-empt Phase 1.2)
- test_orchestrator_pm_history.py (1 mock; pre-empt Phase 1.2)
- test_phase6_engine.py (1 mock; pre-empt Phase 1.3)
- test_run_worker_lifecycle_abort.py (1 mock; pre-empt Phase 1.3)
- test_spawn_interception_v2.py (1 mock; pre-empt Phase 1.3)
test_rag_integration.py mock migration deferred to RAG track (OOS1).
Also adds state.toml for the track (7 phases, 28 tasks, audit fields).