After some more experimenting, the workaround seems to be the following:
cli_execute("edpiece owl");
visit_url("council.php");
doTest(10);
This might suggest that the issue would be with the visit_url call within the doTest function, but the doTest function works fine without the extra...