personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: remove deprecated sol call handoff alias and test code

+2 -149
+1 -56
tests/test_cogitate_coder.py
··· 1 1 # SPDX-License-Identifier: AGPL-3.0-only 2 2 # Copyright (c) 2026 sol pbc 3 3 4 - """Tests for cogitate coder mode: write flag, handoff command, coder agent.""" 4 + """Tests for cogitate coder mode: write flag, coder agent.""" 5 5 6 6 import asyncio 7 7 import importlib 8 8 from unittest.mock import AsyncMock, patch 9 - 10 - from typer.testing import CliRunner 11 - 12 - from think.call import call_app 13 - 14 - runner = CliRunner() 15 - 16 9 17 10 # --------------------------------------------------------------------------- 18 11 # Write flag — Anthropic provider ··· 183 176 184 177 cmd = mock_runner_cls.call_args.kwargs["cmd"] 185 178 assert "--allowed-tools" not in cmd 186 - 187 - 188 - # --------------------------------------------------------------------------- 189 - # sol call handoff command 190 - # --------------------------------------------------------------------------- 191 - 192 - 193 - class TestHandoffCommand: 194 - """Tests for sol call handoff subcommand.""" 195 - 196 - @patch("think.cortex_client.cortex_request", return_value="1710864123456") 197 - def test_handoff_success(self, mock_cortex): 198 - """Handoff reads stdin, calls cortex_request, prints agent_id.""" 199 - result = runner.invoke(call_app, ["handoff", "coder"], input="Fix the bug\n") 200 - 201 - assert result.exit_code == 0 202 - assert "1710864123456" in result.output 203 - mock_cortex.assert_called_once_with( 204 - prompt="Fix the bug", name="coder", config=None 205 - ) 206 - 207 - def test_handoff_empty_stdin(self): 208 - """Empty stdin produces error and exit code 1.""" 209 - result = runner.invoke(call_app, ["handoff", "coder"], input="") 210 - 211 - assert result.exit_code == 1 212 - assert ( 213 - "no prompt" in result.output.lower() 214 - or "no prompt" in (result.stderr or "").lower() 215 - ) 216 - 217 - def test_handoff_whitespace_only_stdin(self): 218 - """Whitespace-only stdin produces error.""" 219 - result = runner.invoke(call_app, ["handoff", "coder"], input=" \n \n") 220 - 221 - assert result.exit_code == 1 222 - 223 - @patch("think.cortex_client.cortex_request", return_value=None) 224 - def test_handoff_cortex_failure(self, mock_cortex): 225 - """When cortex_request returns None, handoff reports error.""" 226 - result = runner.invoke(call_app, ["handoff", "coder"], input="Fix the bug\n") 227 - 228 - assert result.exit_code == 1 229 - assert ( 230 - "failed" in result.output.lower() 231 - or "failed" in (result.stderr or "").lower() 232 - ) 233 - 234 179 235 180 # --------------------------------------------------------------------------- 236 181 # muse/coder.md existence and frontmatter
-19
tests/test_engage.py
··· 20 20 return runner.invoke(_engage_app(), [*args], input=input_text) 21 21 22 22 23 - def _call_app(): 24 - call_mod = importlib.reload(importlib.import_module("think.call")) 25 - return call_mod.call_app 26 - 27 - 28 23 class TestEngage: 29 24 def test_fire_and_forget(self): 30 25 with patch( ··· 139 134 mock_cr.assert_called_once_with( 140 135 prompt="do stuff", name="coder", config={"day": "20260404"} 141 136 ) 142 - 143 - 144 - class TestHandoffDeprecated: 145 - def test_handoff_still_works(self): 146 - with patch("think.cortex_client.cortex_request", return_value="agent-123"): 147 - result = runner.invoke(_call_app(), ["handoff", "coder"], input="fix the bug\n") 148 - 149 - assert result.exit_code == 0 150 - assert "agent-123" in result.output 151 - 152 - def test_handoff_hidden(self): 153 - result = runner.invoke(_call_app(), ["--help"]) 154 - 155 - assert "handoff" not in result.output
-56
tests/test_handoff.py
··· 1 - # SPDX-License-Identifier: AGPL-3.0-only 2 - # Copyright (c) 2026 sol pbc 3 - 4 - """Tests for the handoff CLI command.""" 5 - 6 - import importlib 7 - from unittest.mock import patch 8 - 9 - from typer.testing import CliRunner 10 - 11 - runner = CliRunner() 12 - 13 - 14 - def _call_app(): 15 - call_mod = importlib.reload(importlib.import_module("think.call")) 16 - return call_mod.call_app 17 - 18 - 19 - def _invoke_handoff(*args, input_text=""): 20 - return runner.invoke(_call_app(), ["handoff", *args], input=input_text) 21 - 22 - 23 - def _assert_handoff_success(): 24 - with patch( 25 - "think.cortex_client.cortex_request", return_value="agent-123" 26 - ) as mock_cr: 27 - result = _invoke_handoff("coder", input_text="fix the bug\n") 28 - assert result.exit_code == 0 29 - assert "agent-123" in result.output 30 - mock_cr.assert_called_once_with(prompt="fix the bug", name="coder", config=None) 31 - 32 - 33 - def _assert_handoff_empty_stdin(): 34 - result = _invoke_handoff("coder", input_text="") 35 - assert result.exit_code == 1 36 - assert ( 37 - "no prompt" in result.output.lower() 38 - or "no prompt" in (result.stderr or "").lower() 39 - ) 40 - 41 - 42 - def _assert_handoff_cortex_failure(): 43 - with patch("think.cortex_client.cortex_request", return_value=None): 44 - result = _invoke_handoff("coder", input_text="fix the bug\n") 45 - assert result.exit_code == 1 46 - 47 - 48 - class TestHandoff: 49 - def test_success(self): 50 - _assert_handoff_success() 51 - 52 - def test_empty_stdin(self): 53 - _assert_handoff_empty_stdin() 54 - 55 - def test_cortex_failure(self): 56 - _assert_handoff_cortex_failure()
-16
think/call.py
··· 13 13 14 14 import importlib 15 15 import logging 16 - import sys 17 16 from pathlib import Path 18 17 19 18 import typer ··· 109 108 if facet: 110 109 parts.append(f"[{facet}]") 111 110 typer.echo(f"Navigate: {' '.join(parts)}") 112 - 113 - 114 - @call_app.command("handoff", hidden=True) 115 - def handoff( 116 - agent: str = typer.Argument(help="Agent name to hand off to (e.g. coder)."), 117 - ) -> None: 118 - """Spawn a cogitate agent with a request from stdin (fire-and-forget).""" 119 - prompt = sys.stdin.read() 120 - if not prompt.strip(): 121 - typer.echo("Error: no prompt provided on stdin.", err=True) 122 - raise typer.Exit(1) 123 - 124 - from think.engage import _engage 125 - 126 - _engage(agent, prompt.strip()) 127 111 128 112 129 113 def main() -> None:
+1 -2
think/engage.py
··· 3 3 4 4 """CLI for delegating work to cogitate agents. 5 5 6 - Provides ``sol engage <name>`` as the primary agent delegation command, 7 - replacing ``sol call handoff`` with richer options. 6 + Provides ``sol engage <name>`` for delegating work to cogitate agents. 8 7 """ 9 8 10 9 import sys