chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-09-04: - update .custodian-brief.md for rein-aharness Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a06ba0-10aa-7ea0-b20a-4f3fac39efe9
This commit is contained in:
parent
7641fcde40
commit
f01b765668
20 changed files with 1027 additions and 165 deletions
|
|
@ -111,11 +111,58 @@ def test_execute_streaming_raises_timeout(tmp_path) -> None:
|
|||
def test_execute_blocking_path_unchanged_without_callback(tmp_path) -> None:
|
||||
adapter = AgenticClaudeCodeAdapter(workdir=tmp_path)
|
||||
config = RunConfig(timeout_seconds=30)
|
||||
fake_result = MagicMock(returncode=0, stdout="plain output", stderr="")
|
||||
proc = MagicMock()
|
||||
proc.communicate.return_value = ("plain output", "")
|
||||
proc.returncode = 0
|
||||
proc.poll.return_value = 0
|
||||
|
||||
with patch("rein_aharness.adapter.subprocess.run", return_value=fake_result) as run:
|
||||
with patch("rein_aharness.adapter.subprocess.Popen", return_value=proc) as popen:
|
||||
response = adapter.execute_prompt("do it", config)
|
||||
|
||||
assert response.content == "plain output"
|
||||
argv = run.call_args.args[0]
|
||||
argv = popen.call_args.args[0]
|
||||
assert "--output-format" not in argv
|
||||
proc.communicate.assert_called_once()
|
||||
|
||||
|
||||
def test_blocking_cancel_kills_process_and_raises(tmp_path) -> None:
|
||||
from rein_aharness.execution_cancel import ExecutionCancel, ExecutionCancelled
|
||||
|
||||
cancel = ExecutionCancel()
|
||||
adapter = AgenticClaudeCodeAdapter(workdir=tmp_path, cancel=cancel)
|
||||
config = RunConfig(timeout_seconds=30)
|
||||
proc = MagicMock()
|
||||
proc.poll.return_value = None
|
||||
|
||||
def _communicate(input=None, timeout=None): # noqa: A002
|
||||
cancel.cancel("lease-loss")
|
||||
raise RuntimeError("subprocess interrupted")
|
||||
|
||||
proc.communicate.side_effect = _communicate
|
||||
|
||||
with patch("rein_aharness.adapter.subprocess.Popen", return_value=proc):
|
||||
with pytest.raises(ExecutionCancelled, match="lease-loss"):
|
||||
adapter.execute_prompt("do it", config)
|
||||
proc.kill.assert_called_once()
|
||||
|
||||
|
||||
def test_streaming_cancel_refuses_nonzero_exit(tmp_path) -> None:
|
||||
from rein_aharness.execution_cancel import ExecutionCancel, ExecutionCancelled
|
||||
|
||||
cancel = ExecutionCancel()
|
||||
adapter = AgenticClaudeCodeAdapter(
|
||||
workdir=tmp_path, on_tool_event=lambda e: None, cancel=cancel
|
||||
)
|
||||
config = RunConfig(timeout_seconds=30)
|
||||
proc = _fake_proc([])
|
||||
proc.poll.return_value = None
|
||||
|
||||
def _wait(timeout=None):
|
||||
cancel.cancel("signal")
|
||||
return 1
|
||||
|
||||
proc.wait.side_effect = _wait
|
||||
|
||||
with patch("rein_aharness.adapter.subprocess.Popen", return_value=proc):
|
||||
with pytest.raises(ExecutionCancelled, match="signal"):
|
||||
adapter.execute_prompt("do it", config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue