feat(maf): complete resilient roundtable workflow

This commit is contained in:
董宏凯 committed 2026-08-02 00:23:25 +08:00
1 parent bd4131b4e2
commit 21c4c898e7
23 files changed
+4810 -312

No files matched your search

@@ -474,3 +474,43 @@ async def test_identity_from_request_state_not_body(app_and_client):
headers={"X-Test-User": "bob"},
)
assert resp.status_code == 404
# ── Phase 3 resume / recover ──────────────────────────────────────────────
@pytest.mark.asyncio
async def test_resume_and_recover_conflict_when_not_eligible(app_and_client):
"""Resume requires waiting_approval; recover requires running|waiting_approval."""
app, client, _ = app_and_client
app.state.maf_auto_dispatch = False
resp = await client.post(
"/api/maf-roundtable/sessions",
json={"task_text": "t"},
headers={"X-Test-User": "alice"},
)
assert resp.status_code == 200
session_id = resp.json()["id"]
resp = await client.post(
f"/api/maf-roundtable/sessions/{session_id}/runs",
json={},
headers={"X-Test-User": "alice"},
)
assert resp.status_code == 200
run_id = resp.json()["id"]
# Pending runs (auto-dispatch off) are not eligible for resume/recover.
assert resp.json()["status"] == "pending"
resp = await client.post(
f"/api/maf-roundtable/runs/{run_id}/resume",
headers={"X-Test-User": "alice"},
)
assert resp.status_code == 409
resp = await client.post(
f"/api/maf-roundtable/runs/{run_id}/recover",
headers={"X-Test-User": "alice"},
)
assert resp.status_code == 409