fix: preserve task stop intent and guard remote execution boundaries

This commit is contained in:
Xin Wang
2026-10-23 19:53:17 +08:00
parent 8ac75a1873
commit 89c3bad58e
16 changed files with 199 additions and 20 deletions
+10
View File
@@ -5,6 +5,16 @@ from services.background_tasks.opencode import OpenCodeExecutor
class OpenCodeTaskTest(unittest.IsolatedAsyncioTestCase):
async def test_persisted_result_keeps_long_assistant_text(self):
text = "重要前提:仅完成部分修改。" + "结果" * 10000 + "仍有失败。"
async def respond(request):
if request.url.path.endswith("/message"):
return httpx.Response(200, json=[{"info": {"role": "assistant", "parentID": "msg_test", "time": {"completed": 1}}, "parts": [{"type": "text", "text": text}]}])
return httpx.Response(200, json={})
executor = OpenCodeExecutor({"url": "https://remote.test", "directory": "/demo"}, {}, transport=httpx.MockTransport(respond))
state = await executor.snapshot({"session_id": "ses_test", "message_id": "msg_test"})
self.assertEqual(state["result"], text)
async def test_correlated_completion_ignores_initial_idle_and_other_sessions(self):
handle = {"session_id": "ses_test", "message_id": "msg_test"}
submitted = False