diff --git a/conductor/tracks/send_result_to_send_20260616/metadata.json b/conductor/tracks/send_result_to_send_20260616/metadata.json new file mode 100644 index 00000000..ff706f1c --- /dev/null +++ b/conductor/tracks/send_result_to_send_20260616/metadata.json @@ -0,0 +1,34 @@ +{ + "id": "send_result_to_send_20260616", + "title": "Rename ai_client.send_result to ai_client.send (sandbox test track)", + "type": "refactor", + "status": "planned", + "priority": "high", + "created": "2026-06-16", + "owner": "tier2-tech-lead", + "spec": "conductor/tracks/send_result_to_send_20260616/spec.md", + "plan": "conductor/tracks/send_result_to_send_20260616/plan.md", + "scope": { + "new_files": 0, + "modified_files": 38, + "deleted_files": 0 + }, + "depends_on": [ + "tier2_autonomous_sandbox_20260616" + ], + "blocks": [], + "test_summary": { + "default_on_tests": 0, + "opt_in_tests_sandbox": 0, + "opt_in_tests_smoke": 0, + "note": "no new tests; this track exercises the EXISTING test suite as the safety net for a pure rename" + }, + "verification_criteria": [ + "git grep send_result in src/, tests/, docs/guide_*.md, conductor/code_styleguides/*.md returns 0 matches", + "git grep 'ai_client.send\\b' returns the new symbol across the 38 active files", + "uv run pytest (no env vars) returns 0 failures (matches pre-rename baseline)", + "10 atomic commits land on tier2/send_result_to_send_20260616 branch", + "No failcount fires (clean rename; success path)", + "User can git fetch the branch from C:/projects/manual_slop_tier2 and merge to main" + ] +} diff --git a/conductor/tracks/send_result_to_send_20260616/plan.md b/conductor/tracks/send_result_to_send_20260616/plan.md new file mode 100644 index 00000000..fa758e60 --- /dev/null +++ b/conductor/tracks/send_result_to_send_20260616/plan.md @@ -0,0 +1,682 @@ +# Rename `ai_client.send_result` to `ai_client.send` Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Rename `ai_client.send_result` to `ai_client.send` across 38 active files (6 src/, 29 tests/, 3 current docs). 10 atomic commits, 5 phases. The first end-to-end test of the `tier2_autonomous_sandbox_20260616` sandbox. + +**Architecture:** Pure mechanical rename. No behavior change. TDD red moment is the impl rename (all tests fail). Subsequent commits progressively move the suite from red to green. The sandbox's 4 mechanisms are exercised: branch creation, per-task commits, failcount monitoring, no push. + +**Tech Stack:** Python 3.11+ (the codebase), pytest, OpenCode, the `tier2_autonomous_sandbox_20260616` sandbox (the new `tier2-autonomous` agent profile + `/tier-2-auto-execute` slash command + Windows restricted token + git hooks). + +**Spec:** `conductor/tracks/send_result_to_send_20260616/spec.md` + +--- + +## File Structure + +**Files to modify (38 total):** + +| File | Refs | Phase | +|---|---|---| +| `src/ai_client.py` | 10 | Phase 1 (single commit) | +| `src/app_controller.py` | 2 | Phase 2 (batch) | +| `src/conductor_tech_lead.py` | 1 call + 1 comment + 1 print | Phase 2 (batch) | +| `src/mcp_client.py` | 1 (docstring) | Phase 2 (batch) | +| `src/multi_agent_conductor.py` | 1 call + 1 print | Phase 2 (batch) | +| `src/orchestrator_pm.py` | 1 call + 1 print | Phase 2 (batch) | +| `tests/test_conductor_engine_v2.py` | 22 | Phase 3 (single) | +| `tests/test_orchestrator_pm.py` | 14 | Phase 3 (single) | +| `tests/test_ai_loop_regressions_20260614.py` | 12 | Phase 3 (single) | +| `tests/test_conductor_tech_lead.py` | 8 | Phase 3 (single) | +| `tests/test_orchestrator_pm_history.py` | 4 | Phase 3 (single) | +| (24 other test files) | varies | Phase 4 (batch) | +| `docs/guide_ai_client.md` | 4 | Phase 5 (batch) | +| `docs/guide_app_controller.md` | varies | Phase 5 (batch) | +| `conductor/code_styleguides/error_handling.md` | 6 | Phase 5 (batch) | + +**Files NOT modified (historical record stays as-is):** +- `conductor/tracks/*/spec.md`, `conductor/tracks/*/plan.md` — historical migration decision +- `docs/reports/*` — historical reports + +**No new files. No deleted files. Pure rename.** + +--- + +## Phase 1: Rename the Implementation (the TDD "Red" moment) + +**Focus:** This is the critical commit. After this, the full test suite has many failures. Tier 2 confirms the failures before proceeding. + +**Files:** +- Modify: `src/ai_client.py:1-...` (10 refs throughout the file) + +### Task 1.1: Rename `send_result` → `send` in `src/ai_client.py` + +- [ ] **Step 1: Snapshot the pre-rename state** + +Run: `uv run pytest 2>&1 | tail -3` +Expected: a line like `=== X passed in Y.YYs ===` where X is the current passing count. Record this number mentally as the "before" baseline. + +- [ ] **Step 2: Identify all 10 references in `src/ai_client.py`** + +Run: `git grep -n "send_result" -- src/ai_client.py` +Expected: 10 lines, all in `src/ai_client.py`. Each line shows the line number and the context. + +- [ ] **Step 3: Rename each reference** + +For each of the 10 references: +- `def send_result(` → `def send(` +- `"ai_client.send_result"` (error source strings) → `"ai_client.send"` +- `ai_client.send_result` (monitor component name) → `ai_client.send` +- `# Called by: send_result` (docstrings) → `# Called by: send` +- `Called by: send_result` → `Called by: send` +- The `[C: ...]` SDM tag references → update to the new function name + +Use the MCP edit tool. Verify the rename is complete: +Run: `git grep "send_result" -- src/ai_client.py` +Expected: 0 matches (the grep returns nothing). + +- [ ] **Step 4: Run the test suite — confirm the "red"** + +Run: `uv run pytest 2>&1 | tail -10` +Expected: many test failures with `AttributeError: module 'src.ai_client' has no attribute 'send_result'` (or `AttributeError: has no attribute 'send_result'` from monkeypatch.setattr). This is the TDD red moment. **Do not panic; this is expected.** + +- [ ] **Step 5: Commit the red moment** + +```bash +git add src/ai_client.py +git commit -m "refactor(ai_client): rename send_result to send (the impl) + +This is the TDD red moment. The implementation is renamed but the call +sites in src/, tests/, and docs still use send_result. Subsequent +commits rename the call sites and progressively move the test suite +back to green. + +Refs: conductor/tracks/send_result_to_send_20260616/" +``` + +- [ ] **Step 6: Attach the git note** + +```bash +git notes add -m "Task 1.1: rename send_result to send in src/ai_client.py + +10 references renamed: function def, error source strings, monitor +component names, docstring Called by tags, SDM [C:] tags. + +Test suite state: RED. Many failures expected. Next task: rename +the 5 other src/ call sites to clear the src/-level failures." +``` + +### Task 1.2: Conductor - User Manual Verification (Phase 1) + +Verify: 10 references in `src/ai_client.py` are renamed; test suite is in the expected red state with `send_result` AttributeErrors. The user (or the Tier 2 agent's self-check) confirms before Phase 2. + +--- + +## Phase 2: Rename Other src/ Call Sites + +**Focus:** Clear the src/-level call site failures. After this phase, the only remaining failures should be in test files (which still use `send_result` in their mocks/patches). + +**Files:** +- Modify: `src/app_controller.py` (2 refs) +- Modify: `src/conductor_tech_lead.py` (3 refs: 1 call + 1 comment + 1 print) +- Modify: `src/mcp_client.py` (1 ref: docstring) +- Modify: `src/multi_agent_conductor.py` (2 refs: 1 call + 1 print) +- Modify: `src/orchestrator_pm.py` (2 refs: 1 call + 1 print) + +### Task 2.1: Rename in the 5 other src/ files (single batch commit) + +- [ ] **Step 1: Identify all references in the 5 files** + +Run: `git grep -n "send_result" -- src/app_controller.py src/conductor_tech_lead.py src/mcp_client.py src/multi_agent_conductor.py src/orchestrator_pm.py` +Expected: 10 lines total (2 + 3 + 1 + 2 + 2 = 10). + +- [ ] **Step 2: Rename each reference** + +For each of the 10 references: +- `ai_client.send_result(...)` → `ai_client.send(...)` (call sites) +- `ai_client.send_result` (in comments) → `ai_client.send` +- `send_result` (in print strings) → `send` + +Use the MCP edit tool. Special attention: +- `src/conductor_tech_lead.py` has a docstring at the top of the file: `# Uses ai_client.send_result() for LLM communication` → update. +- `src/mcp_client.py` has a docstring example: `'src.ai_client.send_result'` → update to `'src.ai_client.send'`. + +Verify: `git grep "send_result" -- src/app_controller.py src/conductor_tech_lead.py src/mcp_client.py src/multi_agent_conductor.py src/orchestrator_pm.py` +Expected: 0 matches. + +- [ ] **Step 3: Run the test suite — confirm partial green** + +Run: `uv run pytest 2>&1 | tail -3` +Expected: still many failures, but fewer than Phase 1. The remaining failures are in test files (which still mock `send_result`). + +- [ ] **Step 4: Commit** + +```bash +git add src/app_controller.py src/conductor_tech_lead.py src/mcp_client.py src/multi_agent_conductor.py src/orchestrator_pm.py +git commit -m "refactor(ai_client): rename send_result to send in 5 src/ call sites + +Renames 10 references across app_controller, conductor_tech_lead, +mcp_client (docstring example), multi_agent_conductor, orchestrator_pm. + +Test suite state: still red, but all src/-level call sites are now +renamed. Remaining failures are in test files (mocks and patches +that still reference send_result). + +Refs: conductor/tracks/send_result_to_send_20260616/" +``` + +- [ ] **Step 5: Attach the git note** + +```bash +git notes add -m "Task 2.1: rename in 5 other src/ files (batch) + +10 references renamed: 5 call sites + 1 docstring (mcp_client) + 2 +prints + 2 comments. Test suite still red; remaining failures are +in test files. + +Next: rename in the top 5 test files individually (Phase 3)." +``` + +--- + +## Phase 3: Rename in Top 5 Test Files (one commit per file) + +**Focus:** The highest-impact test files. Each commit demonstrates the per-task commit protocol in action. + +**Files:** +- Modify: `tests/test_conductor_engine_v2.py` (22 refs) +- Modify: `tests/test_orchestrator_pm.py` (14 refs) +- Modify: `tests/test_ai_loop_regressions_20260614.py` (12 refs) +- Modify: `tests/test_conductor_tech_lead.py` (8 refs) +- Modify: `tests/test_orchestrator_pm_history.py` (4 refs) + +### Task 3.1: Rename in `tests/test_conductor_engine_v2.py` (22 refs) + +- [ ] **Step 1: Verify the test file currently fails (red for this file)** + +Run: `uv run pytest tests/test_conductor_engine_v2.py 2>&1 | tail -3` +Expected: all tests in this file fail with `send_result` AttributeError. + +- [ ] **Step 2: Rename the 22 references** + +Run: `git grep -n "send_result" -- tests/test_conductor_engine_v2.py` +Expected: 22 lines. For each: +- `monkeypatch.setattr(ai_client, 'send_result', ...)` → `monkeypatch.setattr(ai_client, 'send', ...)` +- `ai_client.send_result(...)` → `ai_client.send(...)` (if any direct calls) +- `patch('src.ai_client.send_result', ...)` → `patch('src.ai_client.send', ...)` +- `mock_send_result` (local variable name) → `mock_send` (optional, but reduces churn) +- Comments and docstrings that mention `send_result` → update to `send` + +Use the MCP edit tool. The 22 refs in this file are mostly `monkeypatch.setattr(ai_client, 'send_result', ...)` calls and comments. Be careful with the variable names — `mock_send_result` is a local variable that should be renamed to `mock_send` for consistency. + +Verify: `git grep "send_result" -- tests/test_conductor_engine_v2.py` +Expected: 0 matches. + +- [ ] **Step 3: Run the test file — confirm green** + +Run: `uv run pytest tests/test_conductor_engine_v2.py 2>&1 | tail -3` +Expected: all tests in this file pass. + +- [ ] **Step 4: Commit** + +```bash +git add tests/test_conductor_engine_v2.py +git commit -m "test(ai_client): rename send_result to send in test_conductor_engine_v2 + +22 references renamed (mostly monkeypatch.setattr calls + comments). +Test file state: GREEN. All 22+ tests in this file now pass." +``` + +- [ ] **Step 5: Attach the git note** + +```bash +git notes add -m "Task 3.1: rename in test_conductor_engine_v2.py + +22 references. Highest-impact test file. All tests in this file now +pass. Local variable mock_send_result renamed to mock_send for +consistency. + +Next: test_orchestrator_pm.py (14 refs)." +``` + +### Task 3.2: Rename in `tests/test_orchestrator_pm.py` (14 refs) + +- [ ] **Step 1: Verify the test file currently fails** + +Run: `uv run pytest tests/test_orchestrator_pm.py 2>&1 | tail -3` +Expected: failures with `send_result` AttributeError. + +- [ ] **Step 2: Rename the 14 references** + +Run: `git grep -n "send_result" -- tests/test_orchestrator_pm.py` +Expected: 14 lines. For each: +- `@patch('src.ai_client.send_result')` → `@patch('src.ai_client.send')` +- `def test_X(self, mock_send_result: Any, ...)` parameter name → `mock_send` +- `mock_send_result.return_value = ...` → `mock_send.return_value = ...` +- `mock_send_result.assert_called_once()` → `mock_send.assert_called_once()` + +Use the MCP edit tool. Be careful: this file has 3 test methods that take `mock_send_result` as a parameter (auto-injected by `@patch` decorator). The parameter name must match the decorator's string. + +Verify: `git grep "send_result" -- tests/test_orchestrator_pm.py` +Expected: 0 matches. + +- [ ] **Step 3: Run the test file — confirm green** + +Run: `uv run pytest tests/test_orchestrator_pm.py 2>&1 | tail -3` +Expected: all tests in this file pass. + +- [ ] **Step 4: Commit** + +```bash +git add tests/test_orchestrator_pm.py +git commit -m "test(ai_client): rename send_result to send in test_orchestrator_pm + +14 references renamed (decorators + parameter names + assertions). +Test file state: GREEN." +``` + +- [ ] **Step 5: Attach the git note** + +```bash +git notes add -m "Task 3.2: rename in test_orchestrator_pm.py + +14 references. Parameter names in test methods renamed to mock_send +to match the @patch decorator string. All tests pass." +``` + +### Task 3.3: Rename in `tests/test_ai_loop_regressions_20260614.py` (12 refs) + +- [ ] **Step 1: Verify the test file currently fails** + +Run: `uv run pytest tests/test_ai_loop_regressions_20260614.py 2>&1 | tail -3` +Expected: failures. + +- [ ] **Step 2: Rename the 12 references** + +Run: `git grep -n "send_result" -- tests/test_ai_loop_regressions_20260614.py` +Expected: 12 lines. This file has: +- `def test_fr2_send_result_callable_in_app_controller_namespace` — the function name itself +- Comments and docstrings referencing the migration target +- `monkeypatch.setattr(ai_client, "send_result", ...)` calls + +The function name `test_fr2_send_result_callable_in_app_controller_namespace` is a test ID; renaming the test name is optional (preserves the test ID for backwards compat) — but for consistency, rename it to `test_fr2_send_callable_in_app_controller_namespace`. + +Verify: `git grep "send_result" -- tests/test_ai_loop_regressions_20260614.py` +Expected: 0 matches. + +- [ ] **Step 3: Run the test file — confirm green** + +Run: `uv run pytest tests/test_ai_loop_regressions_20260614.py 2>&1 | tail -3` +Expected: all tests pass. + +- [ ] **Step 4: Commit** + +```bash +git add tests/test_ai_loop_regressions_20260614.py +git commit -m "test(ai_client): rename send_result to send in test_ai_loop_regressions_20260614 + +12 references renamed. Test function name test_fr2_send_result_* +renamed to test_fr2_send_* for consistency. + +Note: this is a regression test track; the test IDs are part of the +historical contract. The rename preserves the test coverage but +changes the IDs." +``` + +- [ ] **Step 5: Attach the git note** + +```bash +git notes add -m "Task 3.3: rename in test_ai_loop_regressions_20260614.py + +12 references. Test function IDs changed (test_fr2_send_result_* +to test_fr2_send_*). This may affect any external scripts that +reference these test IDs by name — review for impact." +``` + +### Task 3.4: Rename in `tests/test_conductor_tech_lead.py` (8 refs) + +- [ ] **Step 1: Verify the test file currently fails** + +Run: `uv run pytest tests/test_conductor_tech_lead.py 2>&1 | tail -3` +Expected: failures. + +- [ ] **Step 2: Rename the 8 references** + +Run: `git grep -n "send_result" -- tests/test_conductor_tech_lead.py` +Expected: 8 lines. Standard `@patch` + `mock_send_result` pattern. + +Verify: `git grep "send_result" -- tests/test_conductor_tech_lead.py` +Expected: 0 matches. + +- [ ] **Step 3: Run the test file — confirm green** + +Run: `uv run pytest tests/test_conductor_tech_lead.py 2>&1 | tail -3` +Expected: all tests pass. + +- [ ] **Step 4: Commit** + +```bash +git add tests/test_conductor_tech_lead.py +git commit -m "test(ai_client): rename send_result to send in test_conductor_tech_lead + +8 references renamed. Test file state: GREEN." +``` + +- [ ] **Step 5: Attach the git note** + +```bash +git notes add -m "Task 3.4: rename in test_conductor_tech_lead.py + +8 references. Standard pattern. All tests pass." +``` + +### Task 3.5: Rename in `tests/test_orchestrator_pm_history.py` (4 refs) + +- [ ] **Step 1: Verify the test file currently fails** + +Run: `uv run pytest tests/test_orchestrator_pm_history.py 2>&1 | tail -3` +Expected: failures. + +- [ ] **Step 2: Rename the 4 references** + +Run: `git grep -n "send_result" -- tests/test_orchestrator_pm_history.py` +Expected: 4 lines. + +Verify: `git grep "send_result" -- tests/test_orchestrator_pm_history.py` +Expected: 0 matches. + +- [ ] **Step 3: Run the test file — confirm green** + +Run: `uv run pytest tests/test_orchestrator_pm_history.py 2>&1 | tail -3` +Expected: all tests pass. + +- [ ] **Step 4: Commit** + +```bash +git add tests/test_orchestrator_pm_history.py +git commit -m "test(ai_client): rename send_result to send in test_orchestrator_pm_history + +4 references renamed. Test file state: GREEN." +``` + +- [ ] **Step 5: Attach the git note** + +```bash +git notes add -m "Task 3.5: rename in test_orchestrator_pm_history.py + +4 references. All tests pass. Phase 3 complete. + +Next: remaining 24 test files in a single batch commit (Phase 4)." +``` + +### Task 3.6: Conductor - User Manual Verification (Phase 3) + +Verify: all 5 high-impact test files are green. Run `uv run pytest tests/test_conductor_engine_v2.py tests/test_orchestrator_pm.py tests/test_ai_loop_regressions_20260614.py tests/test_conductor_tech_lead.py tests/test_orchestrator_pm_history.py` to confirm. + +--- + +## Phase 4: Rename in Remaining 24 Test Files (batch) + +**Focus:** The remaining test files. Lower impact per file, batched into 1 commit for efficiency. + +**Files:** 24 test files (the ones not yet renamed in Phase 3). + +### Task 4.1: Identify and rename the remaining 24 test files (single batch commit) + +- [ ] **Step 1: Get the full list of test files that still reference `send_result`** + +Run: `git grep -l "send_result" -- tests/` +Expected: 24 files (29 total - 5 already renamed in Phase 3). + +- [ ] **Step 2: For each file, rename `send_result` → `send`** + +For each of the 24 files: +- `@patch('src.ai_client.send_result')` → `@patch('src.ai_client.send')` +- `monkeypatch.setattr(ai_client, "send_result", ...)` → `monkeypatch.setattr(ai_client, "send", ...)` +- `monkeypatch.setattr(ai_client, 'send_result', ...)` → `monkeypatch.setattr(ai_client, 'send', ...)` +- `patch("src.ai_client.send_result")` → `patch("src.ai_client.send")` +- `patch('src.ai_client.send_result', ...)` → `patch('src.ai_client.send', ...)` +- `mock_send_result` local variable → `mock_send` (where it's the result of a patch) +- `m.setattr("src.ai_client.send_result", ...)` → `m.setattr("src.ai_client.send", ...)` +- `wraps=ai_client.send_result` → `wraps=ai_client.send` +- Comments mentioning `send_result` → `send` +- The function call `ai_client.send_result(...)` → `ai_client.send(...)` + +Use the MCP edit tool for each file. The 24 files include: test_ai_cache_tracking, test_ai_client_cli, test_ai_client_result, test_api_events, test_context_pruner, test_deepseek_provider, test_gemini_cli_edge_cases, test_gemini_cli_integration, test_gemini_cli_parity_regression, test_gui2_mcp, test_headless_service, test_headless_verification, test_live_gui_integration_v2, test_orchestration_logic, test_phase6_engine, test_rag_integration, test_run_worker_lifecycle_abort, test_spawn_interception_v2, test_symbol_parsing, test_tier4_interceptor, test_tiered_aggregation, test_token_usage, test_api_events (and similar). + +Verify after the batch: `git grep "send_result" -- tests/` +Expected: 0 matches. + +- [ ] **Step 3: Run the full test suite — confirm 100% green** + +Run: `uv run pytest 2>&1 | tail -3` +Expected: a line like `=== X passed in Y.YYs ===` where X matches the pre-rename baseline from Task 1.1 Step 1. **No failures.** + +- [ ] **Step 4: Commit** + +```bash +git add tests/ +git commit -m "test(ai_client): rename send_result to send in remaining 24 test files + +Batch rename of 24 test files. The full test suite is now GREEN +again, matching the pre-rename baseline from Task 1.1. + +Files affected: test_ai_cache_tracking, test_ai_client_cli, +test_ai_client_result, test_api_events, test_context_pruner, +test_deepseek_provider, test_gemini_cli_*, test_gui2_mcp, +test_headless_*, test_live_gui_integration_v2, test_orchestration_logic, +test_phase6_engine, test_rag_integration, test_run_worker_lifecycle_abort, +test_spawn_interception_v2, test_symbol_parsing, test_tier4_interceptor, +test_tiered_aggregation, test_token_usage, and 4 others. + +Refs: conductor/tracks/send_result_to_send_20260616/" +``` + +- [ ] **Step 5: Attach the git note** + +```bash +git notes add -m "Task 4.1: rename in remaining 24 test files (batch) + +24 files. The full test suite is GREEN, matching the pre-rename +baseline. No behavior change. Pure mechanical rename. + +Next: rename in 3 current docs (Phase 5)." +``` + +--- + +## Phase 5: Rename in 3 Current Docs + Final Verification + +**Focus:** Doc consistency. The current docs describe the public API; the new name should be reflected. Then final test run to confirm. + +**Files:** +- Modify: `docs/guide_ai_client.md` (4 refs) +- Modify: `docs/guide_app_controller.md` (refs) +- Modify: `conductor/code_styleguides/error_handling.md` (6 refs) + +### Task 5.1: Rename in the 3 current docs (single commit) + +- [ ] **Step 1: Identify all references in the 3 docs** + +Run: `git grep -n "send_result" -- docs/guide_ai_client.md docs/guide_app_controller.md conductor/code_styleguides/error_handling.md` +Expected: ~10-15 lines total. + +- [ ] **Step 2: Rename each reference** + +For each reference: +- `ai_client.send_result` → `ai_client.send` +- `send_result()` → `send()` +- `# send_result` (in code blocks) → `# send` +- `Called by: send_result` (in docstrings/code examples) → `Called by: send` + +Use the MCP edit tool. These are doc files; readability matters. + +Verify: `git grep "send_result" -- docs/guide_ai_client.md docs/guide_app_controller.md conductor/code_styleguides/error_handling.md` +Expected: 0 matches. + +- [ ] **Step 3: Commit** + +```bash +git add docs/guide_ai_client.md docs/guide_app_controller.md conductor/code_styleguides/error_handling.md +git commit -m "docs(ai_client): rename send_result to send in 3 current docs + +Doc consistency: guide_ai_client.md, guide_app_controller.md, and +the error_handling styleguide now reference the new symbol name. + +Historical archives (conductor/tracks/*/spec.md, conductor/tracks/*/plan.md, +docs/reports/*) are NOT modified — they document the 2026-06-15 +public_api_migration decision and stay as historical record." +``` + +- [ ] **Step 4: Attach the git note** + +```bash +git notes add -m "Task 5.1: rename in 3 current docs + +3 docs updated. Historical archives untouched (per spec §7). +Pure doc consistency change." +``` + +### Task 5.2: Final verification — full test suite + grep for any remaining `send_result` + +- [ ] **Step 1: Final grep for any remaining `send_result` in active files** + +Run: `git grep "send_result" -- src/ tests/ docs/guide_*.md conductor/code_styleguides/*.md` +Expected: 0 matches. + +- [ ] **Step 2: Run the full test suite — confirm green** + +Run: `uv run pytest 2>&1 | tail -3` +Expected: same passing count as the pre-rename baseline (Task 1.1 Step 1). 0 failures. + +- [ ] **Step 3: Commit the verification report (optional)** + +If the verification reveals any lingering issues, write a short report and commit. If clean, skip this commit. + +```bash +# Only if needed +git commit --allow-empty -m "conductor(plan): verify send_result rename complete + tests green + +Verification: 0 remaining send_result references in active files. +Full test suite passes (matches pre-rename baseline). The rename +is complete and the test suite is green." +``` + +### Task 5.3: Conductor - User Manual Verification (Phase 5) + +Verify: `uv run pytest` returns 100% green (no env vars). `git grep "send_result" -- src/ tests/ docs/guide_*.md conductor/code_styleguides/*.md` returns 0 matches. + +--- + +## Phase 6: Update state.toml + metadata.json + register in tracks.md (user-side, post-track) + +**Focus:** Standard track completion protocol. The user (or Tier 2, with explicit permission) updates the track state to "completed" and registers it in `conductor/tracks.md`. + +**Files:** +- Modify: `conductor/tracks/send_result_to_send_20260616/state.toml` (mark all tasks complete) +- Modify: `conductor/tracks/send_result_to_send_20260616/metadata.json` (set status=shipped) +- Modify: `conductor/tracks.md` (add the new track entry) + +### Task 6.1: Update state.toml + +- [ ] **Step 1: Mark all 10 tasks as completed** + +Update `state.toml`: +- `[meta] status = "completed"`, `current_phase = "complete"` +- All `[phases]` entries: `status = "completed"`, with the `checkpointsha` from the corresponding commit +- All `[tasks]` entries: `status = "completed"`, with the `commit_sha` from the corresponding commit +- All `[verification]` flags: `true` +- `[enforcement_stack]` flags: `true` for `filesystem_boundary_enforced`, `opencode_deny_rules_in_clone`, `pre_push_hook_installed`, `post_checkout_hook_installed`, `windows_restricted_token_acquired` (these were verified by the sandbox's existence, not by the rename itself) + +- [ ] **Step 2: Commit** + +```bash +git add conductor/tracks/send_result_to_send_20260616/state.toml +git commit -m "conductor(plan): mark send_result_to_send_20260616 as complete" +``` + +### Task 6.2: Update metadata.json + +- [ ] **Step 1: Set status to "shipped"** + +Update `metadata.json`: +- `"status": "shipped"` +- (Add actual test counts, real file counts, etc.) + +- [ ] **Step 2: Commit** + +```bash +git add conductor/tracks/send_result_to_send_20260616/metadata.json +git commit -m "conductor(plan): update metadata.json to status=shipped" +``` + +### Task 6.3: Register in `conductor/tracks.md` + +- [ ] **Step 1: Add an entry to the active tracks table** + +Add a row to the "Active Tracks (Current Queue)" table: +```markdown +| 26 | A | [Rename send_result to send (sandbox test)](#track-rename-send_result-to-send-sandbox-test-new-2026-06-16) | spec ✓, plan ✓, shipped 2026-06-16 (10 atomic commits, 38 files renamed, full test suite green; first end-to-end test of the tier2_autonomous_sandbox) | (none — independent; **NEW 2026-06-16**; sandbox integration test) | +``` + +Then add the corresponding section heading further down: +```markdown +### Track: Rename send_result to send (sandbox test) (NEW 2026-06-16) + +[./tracks/send_result_to_send_20260616/](./tracks/send_result_to_send_20260616/) +``` + +- [ ] **Step 2: Commit** + +```bash +git add conductor/tracks.md +git commit -m "conductor(plan): register send_result_to_send_20260616 in tracks.md" +``` + +--- + +## Self-Review (against the spec) + +**1. Spec coverage:** + +| Spec FR | Covered by | +|---|---| +| FR1.1 (rename in src/ai_client.py) | Phase 1 Task 1.1 | +| FR1.2 (rename in 5 other src/ files) | Phase 2 Task 2.1 | +| FR1.3 (rename in top 5 test files) | Phase 3 Tasks 3.1-3.5 | +| FR1.4 (rename in remaining 24 test files) | Phase 4 Task 4.1 | +| FR1.5 (rename in 3 current docs) | Phase 5 Task 5.1 | +| FR2.1 (TDD red moment) | Phase 1 Task 1.1 Steps 1, 4 | +| FR2.2 (progressive green) | Phase 1-4 commit sequence | +| FR2.3 (docs do not affect tests) | Phase 5 Task 5.1 | +| FR2.4 (final verification) | Phase 5 Task 5.2 | +| FR3.1-3.5 (sandbox contract) | Implicit — the sandbox enforces these automatically | +| FR4.1-4.3 (user-side review) | User-side, post-track | + +**2. Placeholder scan:** No TBD/TODO. The Task 5.2 Step 3 has a conditional commit ("only if needed") which is a real branch, not a placeholder. All PowerShell and Python code is complete. + +**3. Type consistency:** N/A — pure rename, no new types. + +**4. Spec requirements with no task:** none — all 4 sections of FRs are covered. + +**Self-review verdict: plan is ready for user review.** + +--- + +## Execution Handoff + +**Plan complete and saved to `conductor/tracks/send_result_to_send_20260616/plan.md`.** + +This is the **first end-to-end test** of the `tier2_autonomous_sandbox_20260616` sandbox. Tier 2 will: +1. Receive the slash command `/tier-2-auto-execute send_result_to_send_20260616` in the Tier 2 sandboxed OpenCode session +2. Read this spec + plan +3. Execute 10 atomic commits across 5 phases +4. Either complete successfully (the success path) or trigger failcount + report writer (the failure path) + +**Two execution options:** + +1. **Subagent-Driven (recommended)** — fresh subagent per task, review between tasks. Best for the Phase 3 per-file commits (5 reviews) and the overall track review. + +2. **Inline Execution** — batch execution with checkpoints. Faster but less granular review. + +**Which approach?** diff --git a/conductor/tracks/send_result_to_send_20260616/spec.md b/conductor/tracks/send_result_to_send_20260616/spec.md new file mode 100644 index 00000000..cbea8502 --- /dev/null +++ b/conductor/tracks/send_result_to_send_20260616/spec.md @@ -0,0 +1,208 @@ +# Track Specification: Rename `ai_client.send_result` to `ai_client.send` (sandbox test track) + +**Track ID:** `send_result_to_send_20260616` +**Status:** Planned (spec pending user review) +**Priority:** A (sandbox integration test — the first track run end-to-end in the just-built `tier2_autonomous_sandbox_20260616` sandbox) +**Owner:** Tier 2 Tech Lead +**Type:** refactor (mechanical rename; no behavior change) +**Scope:** 38 files modified (6 src/, 29 tests/, 3 docs); 0 files added, 0 files deleted + +**Parent tracks:** +- `tier2_autonomous_sandbox_20260616` (shipped 2026-06-16; this is the FIRST track to run in that sandbox) +- `public_api_migration_and_ui_polish_20260615` (the track that REMOVED the legacy `send` and introduced `send_result`; this track reverses that decision) + +> **Note on effort estimates:** this spec measures effort by **scope** only (38 files modified, 10 atomic commits, 5 phases). + +--- + +## 0. TL;DR + +This is the **first end-to-end test** of the Tier 2 autonomous sandbox built in `tier2_autonomous_sandbox_20260616`. The task itself is mechanical: rename `ai_client.send_result()` back to `ai_client.send()` (reversing the 2026-06-15 `public_api_migration` decision) across `src/`, `tests/`, and 3 current docs. The scope (38 files) is large enough to exercise every layer of the sandbox — bootstrap, branch creation, per-task commits, failcount monitoring, and the report writer — but the task is simple enough that Tier 2 should complete it cleanly on the success path. + +**Scope:** 38 files modified, 10 atomic commits, 5 phases. + +**Success path:** Tier 2 runs to completion in one shot. Each commit is reviewed by the user (via `git fetch` from main + diff with Tier 1). If the user approves, they merge to main. + +**Failure path:** if Tier 2 misses a call site or makes a typo, failcount fires after 3 consecutive test failures. The report writer creates a 7-section markdown report at `C:\Users\Ed\AppData\Local\manual_slop\tier2_failures\send_result_to_send_20260616_.md`. The user is notified via the OpenCode session banner. + +--- + +## 1. Overview + +### 1.1 The State Before This Track (as of HEAD) + +The public API of `src/ai_client.py` is `send_result()` — introduced in the `public_api_migration_and_ui_polish_20260615` track on 2026-06-15 to replace the legacy `send()`. The migration was driven by the data-oriented error handling convention (the new name signals "returns `Result[T, ErrorInfo]`"). Now, with the Tier 2 autonomous sandbox in place (which can do the rename safely without the user's per-task `permission: ask` prompts), the user wants to revert to the shorter `send` name. + +**Audit (per `git grep`):** +- **6 src/ files** reference `send_result`: + - `src/ai_client.py` — 10 refs (the implementation + docstrings + the function name itself) + - `src/app_controller.py` — 2 call sites + - `src/conductor_tech_lead.py` — 1 call site + 1 comment + 1 print + - `src/mcp_client.py` — 1 docstring example + - `src/multi_agent_conductor.py` — 1 call site + 1 print + - `src/orchestrator_pm.py` — 1 call site + 1 print +- **29 test files** reference `send_result` (top 5 by ref count: `test_conductor_engine_v2.py` — 22 refs, `test_orchestrator_pm.py` — 14, `test_ai_loop_regressions_20260614.py` — 12, `test_orchestrator_pm_history.py` — 4, `test_conductor_tech_lead.py` — 8) +- **3 current docs** that describe the public API: + - `docs/guide_ai_client.md` — 4 refs + - `docs/guide_app_controller.md` — refs + - `conductor/code_styleguides/error_handling.md` — 6 refs +- **~25 historical mentions** in `conductor/tracks/*/spec.md`, `conductor/tracks/*/plan.md`, `docs/reports/*` — these document the 2026-06-15 decision and STAY as-is (historical record) + +### 1.2 The Goal + +Rename `ai_client.send_result` → `ai_client.send` across all 38 active files. After this track: +- `grep -r "send_result" src/ tests/ docs/guide_*.md conductor/code_styleguides/*.md` returns 0 matches +- `grep -r "ai_client.send\b" src/ tests/ docs/guide_*.md` returns the new symbol +- All tests pass (`uv run pytest` — full suite, no env vars) +- No new behavior; pure mechanical rename + +### 1.3 What the Sandbox Experiences + +This is the **first real use** of the just-built `tier2_autonomous_sandbox_20260616` sandbox. Tier 2 will: + +1. **Invoke the slash command** `/tier-2-auto-execute send_result_to_send_20260616` in the Tier 2 sandboxed OpenCode session +2. **Fetch the spec** from `origin/main` (the main repo at `C:\projects\manual_slop\`) +3. **Create a feature branch** `tier2/send_result_to_send_20260616` via `git switch -c` (NOT `git checkout` — banned) +4. **Initialize failcount state** at `/tier2/send_result_to_send_20260616/state.json` +5. **Execute the plan** in the order specified below (TDD red/green per commit) +6. **Commit per task** with git notes + plan.md updates +7. **On success:** print a summary, leave the user in the branch +8. **On give-up:** write the failure report and notify + +The sandbox enforces 3 layers of bans: +- OpenCode permission system denies `git push*`, `git checkout*`, `git restore*`, `git reset*` +- Windows restricted token limits file access to the clone + app-data dir +- `pre-push` hook refuses all pushes (defense in depth) + +The user reviews the branch in the main repo (interactive Tier 1): +```powershell +cd C:\projects\manual_slop +git fetch C:/projects/manual_slop_tier2 tier2/send_result_to_send_20260616 +# review the diff +git merge --no-ff tier2/send_result_to_send_20260616 +``` + +--- + +## 2. Current State Audit (as of HEAD) + +### 2.1 Already Implemented (DO NOT re-implement) + +- **The `send_result` function in `src/ai_client.py`** — 10 refs including the `def send_result(...)` definition. This is the implementation that gets renamed. +- **The legacy `send()` slot** — was REMOVED on 2026-06-15 in the `public_api_migration_and_ui_polish_20260615` track. The slot is now FREE; the new `send` will fill it. +- **The Tier 2 autonomous sandbox** — built in `tier2_autonomous_sandbox_20260616` (shipped 2026-06-16). This track is the first to run in it. + +### 2.2 Gaps to Fill (This Track's Scope) + +**Gap 1: Rename the implementation in `src/ai_client.py`.** The function definition `def send_result(...)` and all 10 internal references. + +**Gap 2: Rename call sites in 5 other src/ files.** `app_controller.py`, `conductor_tech_lead.py`, `mcp_client.py` (docstring), `multi_agent_conductor.py`, `orchestrator_pm.py`. Each has 1-3 references. + +**Gap 3: Rename in 29 test files.** Top 5 by ref count done individually (5 commits); remaining 24 done in 1 batch commit. + +**Gap 4: Rename in 3 current docs.** `docs/guide_ai_client.md`, `docs/guide_app_controller.md`, `conductor/code_styleguides/error_handling.md`. These describe the current public API; the new name should be reflected. + +**Gap 5: Verify the rename is complete and the test suite passes.** Final `uv run pytest` (no env vars) returns 0 failures. + +--- + +## 3. Goals + +- **Rename the symbol** `ai_client.send_result` → `ai_client.send` in all 38 active files. No behavior change. +- **Pass the full test suite** (`uv run pytest`, no env vars) after the rename. 100% green. +- **Exercise the sandbox** end-to-end: bootstrap (already done), branch creation, per-task commits, failcount monitoring (likely a no-op for a clean rename), report writer (no-op for success path), OpenCode permission system, branch review by user, merge to main by user. +- **Demonstrate the success path** — Tier 2 completes in one shot, all 10 commits land, no failcount fires. + +## 4. Functional Requirements + +### 4.1 The Rename + +**FR1.1:** Rename the function definition `def send_result(...)` → `def send(...)` in `src/ai_client.py`. Update all 10 internal references (docstrings, error source strings, monitor component names). + +**FR1.2:** Rename call sites in 5 other src/ files (batch commit): +- `src/app_controller.py` — 2 call sites +- `src/conductor_tech_lead.py` — 1 call site + 1 comment + 1 print +- `src/mcp_client.py` — 1 docstring example +- `src/multi_agent_conductor.py` — 1 call site + 1 print +- `src/orchestrator_pm.py` — 1 call site + 1 print + +**FR1.3:** Rename in 5 test files (one commit per file, in order of impact): +- `tests/test_conductor_engine_v2.py` (22 refs — highest impact) +- `tests/test_orchestrator_pm.py` (14 refs) +- `tests/test_ai_loop_regressions_20260614.py` (12 refs) +- `tests/test_conductor_tech_lead.py` (8 refs) +- `tests/test_orchestrator_pm_history.py` (4 refs) + +**FR1.4:** Rename in remaining 24 test files (single batch commit). + +**FR1.5:** Rename in 3 current docs (single commit): +- `docs/guide_ai_client.md` +- `docs/guide_app_controller.md` +- `conductor/code_styleguides/error_handling.md` + +### 4.2 TDD Discipline (per the sandbox's contract) + +**FR2.1:** The TDD red moment is **Task 1.1** (rename in `src/ai_client.py`). After this commit, the full test suite has many failures (every test that imports or calls `send_result` now fails with `AttributeError: module 'src.ai_client' has no attribute 'send_result'`). Tier 2 confirms this in the test output before proceeding. + +**FR2.2:** Each subsequent commit moves the test suite from red toward green. After **Task 1.2** (rename other src/), some test failures clear. After **Task 1.3-1.7** (top 5 tests), more clear. After **Task 1.8** (remaining 24 tests), the full suite is green. + +**FR2.3:** Task 1.9 (rename docs) does not affect test results but is committed for consistency. + +**FR2.4:** Task 1.10 (final verification) re-runs the full suite to confirm 100% green. + +### 4.3 Sandbox Contract + +**FR3.1:** Tier 2 uses `git switch -c tier2/send_result_to_send_20260616` to create the feature branch. `git checkout` is banned. + +**FR3.2:** Tier 2 uses `git add ` per commit, not `git add .`. Each commit is one logical change. + +**FR3.3:** Tier 2 uses `git commit -m "..."` with a clear message per the project's commit format. The git note is attached with a task summary. + +**FR3.4:** Tier 2 monitors failcount after every commit. For a clean rename, the counter should not advance. If it does (e.g., a typo in a rename causes 3 consecutive failures), the report writer fires. + +**FR3.5:** Tier 2 does NOT push the branch. The user reviews the branch in main and merges. + +### 4.4 Branch Review (user-side) + +**FR4.1:** After Tier 2 finishes, the user `cd`s back to `C:\projects\manual_slop` and runs: +```powershell +git fetch C:/projects/manual_slop_tier2 tier2/send_result_to_send_20260616 +``` + +**FR4.2:** The user reviews the diff with Tier 1 (interactive). 10 commits, 38 files modified. + +**FR4.3:** On approval, the user runs: +```powershell +git merge --no-ff tier2/send_result_to_send_20260616 +``` + +## 5. Non-Functional Requirements + +**NFR1. Behavior preservation:** the rename is mechanical; no behavior change. The same `Result[str, ErrorInfo]` return type, the same error sources, the same provider dispatch. + +**NFR2. Test green:** the full `uv run pytest` (no env vars) returns 0 failures after the rename. The sandbox's opt-in tests (TIER2_SANDBOX_TESTS=1) are not affected (they don't use `send_result`). + +**NFR3. Commit discipline:** 10 atomic commits, each with a clear message, git note, and plan.md update. The user can review each commit individually. + +**NFR4. Sandbox exercised:** the rename touches all 4 of the sandbox's primary mechanisms (branch creation, per-task commits, failcount monitoring, no push). Even if failcount doesn't fire, the contract is exercised. + +## 6. Architecture Reference + +- **`docs/guide_ai_client.md`** — the current doc for the public API. Gets updated. +- **`conductor/code_styleguides/error_handling.md`** — references the migration target. Gets updated. +- **`conductor/tracks/public_api_migration_and_ui_polish_20260615/spec.md`** — the historical decision this track reverses. STAYS as-is. +- **`docs/guide_tier2_autonomous.md`** — the sandbox user guide. Tier 2 follows this. +- **`docs/reports/TRACK_COMPLETION_tier2_autonomous_sandbox_20260616.md`** — the sandbox's own completion report. Tier 2 reviews this for context. + +## 7. Out of Scope + +- **Historical archives** (`conductor/tracks/*/spec.md`, `conductor/tracks/*/plan.md`, `docs/reports/*`) — these document the 2026-06-15 decision. They STAY as historical record. +- **The Tier 2 sandbox itself** — that's `tier2_autonomous_sandbox_20260616`, already shipped. This track is a USER of the sandbox, not a modification of it. +- **The app's public API surface** beyond `ai_client.send_result`. No other public API changes. +- **The `conductor/AGENTS.md` file** if it references `send_result` (it's the project's agent-facing mirror of `AGENTS.md`; per its convention, it documents the current state, so update it as part of "current docs"). +- **The Manual Slop app's GUI** — no GUI changes; pure code rename. +- **Adding new tests** — the existing test suite is the safety net; no new tests. + +--- + +**Spec ends.** The implementation plan (`plan.md` + `metadata.json` + `state.toml`) follows in this directory. diff --git a/conductor/tracks/send_result_to_send_20260616/state.toml b/conductor/tracks/send_result_to_send_20260616/state.toml new file mode 100644 index 00000000..f21720b4 --- /dev/null +++ b/conductor/tracks/send_result_to_send_20260616/state.toml @@ -0,0 +1,76 @@ +# Track state for send_result_to_send_20260616 +# Updated by Tier 2 Tech Lead as tasks complete + +[meta] +track_id = "send_result_to_send_20260616" +name = "Rename ai_client.send_result to ai_client.send (sandbox test track)" +status = "active" +current_phase = 0 +last_updated = "2026-06-16" + +[blocked_by] +# This track depends on the sandbox being built and bootstrapped +tier2_autonomous_sandbox_20260616 = "shipped 2026-06-16" + +[blocks] +# None - this is a self-contained refactor + sandbox test + +[phases] +phase_1 = { status = "pending", checkpointsha = "", name = "Rename the Implementation (TDD red moment)" } +phase_2 = { status = "pending", checkpointsha = "", name = "Rename Other src/ Call Sites" } +phase_3 = { status = "pending", checkpointsha = "", name = "Rename in Top 5 Test Files (one commit per file)" } +phase_4 = { status = "pending", checkpointsha = "", name = "Rename in Remaining 24 Test Files (batch)" } +phase_5 = { status = "pending", checkpointsha = "", name = "Rename in 3 Current Docs + Final Verification" } +phase_6 = { status = "pending", checkpointsha = "", name = "Update state.toml + metadata.json + register in tracks.md" } + +[tasks] +# Phase 1: Rename the Implementation (the TDD red moment) +t1_1 = { status = "pending", commit_sha = "", description = "Rename send_result to send in src/ai_client.py (10 refs, the red moment)" } +t1_2 = { status = "pending", commit_sha = "", description = "User Manual Verification (Phase 1)" } + +# Phase 2: Rename Other src/ Call Sites +t2_1 = { status = "pending", commit_sha = "", description = "Rename in 5 other src/ files (app_controller, conductor_tech_lead, mcp_client, multi_agent_conductor, orchestrator_pm) - batch" } + +# Phase 3: Rename in Top 5 Test Files (one commit per file) +t3_1 = { status = "pending", commit_sha = "", description = "Rename in tests/test_conductor_engine_v2.py (22 refs)" } +t3_2 = { status = "pending", commit_sha = "", description = "Rename in tests/test_orchestrator_pm.py (14 refs)" } +t3_3 = { status = "pending", commit_sha = "", description = "Rename in tests/test_ai_loop_regressions_20260614.py (12 refs)" } +t3_4 = { status = "pending", commit_sha = "", description = "Rename in tests/test_conductor_tech_lead.py (8 refs)" } +t3_5 = { status = "pending", commit_sha = "", description = "Rename in tests/test_orchestrator_pm_history.py (4 refs)" } +t3_6 = { status = "pending", commit_sha = "", description = "User Manual Verification (Phase 3)" } + +# Phase 4: Rename in Remaining 24 Test Files (batch) +t4_1 = { status = "pending", commit_sha = "", description = "Rename in 24 remaining test files (batch)" } + +# Phase 5: Rename in 3 Current Docs + Final Verification +t5_1 = { status = "pending", commit_sha = "", description = "Rename in 3 current docs (guide_ai_client, guide_app_controller, error_handling styleguide)" } +t5_2 = { status = "pending", commit_sha = "", description = "Final verification - full test suite + grep for any remaining send_result" } +t5_3 = { status = "pending", commit_sha = "", description = "User Manual Verification (Phase 5)" } + +# Phase 6: Update state.toml + metadata.json + register in tracks.md +t6_1 = { status = "pending", commit_sha = "", description = "Update state.toml - mark all tasks complete" } +t6_2 = { status = "pending", commit_sha = "", description = "Update metadata.json - set status=shipped" } +t6_3 = { status = "pending", commit_sha = "", description = "Register in conductor/tracks.md" } + +[verification] +# Filled as the track progresses +rename_in_src_complete = false +rename_in_top5_tests_complete = false +rename_in_remaining_tests_complete = false +rename_in_docs_complete = false +final_grep_clean = false +full_test_suite_green = false +no_failcount_fired = false +branch_fetchable_from_main = false +user_approved_for_merge = false + +[enforcement_stack] +# The sandbox's enforcement contracts that should be exercised by this track +# (Even though this track doesn't enforce them, running this track is the test +# that the sandbox's enforcement is real) +git_push_ban_held = false +git_checkout_ban_held = false +filesystem_boundary_held = false +per_task_commits_used = false +failcount_monitored = false +report_writer_on_standby = false