feat(maf): conversation-driven MAF roundtable (R1/R2) + server-owned stage-3 dispatch
Backend:
- Conversation API at /api/maf-roundtable/conversations: create/list/detail,
paginated messages, atomic send+run start, owner-only isolation,
admin read-only diagnostic access
- SSE real-time event stream (GET /conversations/{id}/stream) backed by
ConversationEventHub + conversation_events store; multi-worker deployment doc
- Deterministic server-owned stage-3 dispatch contracts (dispatch_contracts.py):
routing resolved from trusted MAF deployment config instead of manager-chosen
agent ids; config.yaml keeps stage-3 routing deployment-owned
(default_manager_agent_id / seat ids / business_routes / max_seats_per_run)
- Conversation persistence (conversations/messages stores) + v2 migration script
- Tests: conversations, conversation stream, migration, phase3 conversation dispatch
Frontend:
- Vitest test infra for MAF (vitest.maf.config.ts + test:maf script) with
component tests for ApprovalCard/RunHeader/SessionsPage and use-maf-events
- Session form lib, flow-graph dialog / run-detail / sessions page updates,
routes and nav tweaks
- Docs: R0 legacy interaction baseline mapping, updated implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
df408831e5
commit
99642fca6c
46 files changed
+6358
-1306
No files matched your search
@@ -903,9 +903,10 @@ async def test_seat_matching_scopes_by_turn_index(svc, store):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_seat_matching_count_mismatch_fails(svc, store):
|
||||
"""P1b: a pending tool call that does not match EXACTLY one waiting action
|
||||
(by tool_call_id) fails the turn —the executor never guesses."""
|
||||
async def test_seat_matching_zero_hits_warns_and_skips(svc, store):
|
||||
"""A pending tool call that matches 0 waiting actions (e.g. unclassified
|
||||
tool, hallucinated tool name, or WriteGuard let it through as read) should
|
||||
log a warning and skip — NOT crash the entire workflow."""
|
||||
from app.maf_roundtable.workflow_executors import SeatExecutor
|
||||
|
||||
session = await svc.create_session(user_id="u1", body={"task_text": "t"})
|
||||
@@ -923,7 +924,39 @@ async def test_seat_matching_count_mismatch_fails(svc, store):
|
||||
executor = SeatExecutor(_FakeSeatAdapter(store, response), state, "seat-1",
|
||||
action_coordinator=ActionCoordinator(svc, user_id="u1"))
|
||||
|
||||
with pytest.raises(RuntimeError, match="expected exactly 1"):
|
||||
# Should NOT raise — the unmatched tool call is logged and skipped.
|
||||
await executor.handle("msg", _FakeSeatCtx())
|
||||
# The unmatched call was not added to pending_approvals.
|
||||
assert len(state.pending_approvals) == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_seat_matching_multiple_hits_raises(svc, store):
|
||||
""">1 match for a single tool call is a genuine data-integrity error —
|
||||
the executor refuses to guess and raises RuntimeError."""
|
||||
from app.maf_roundtable.workflow_executors import SeatExecutor
|
||||
|
||||
session = await svc.create_session(user_id="u1", body={"task_text": "t"})
|
||||
run = await svc.create_run(session_id=session["id"], user_id="u1")
|
||||
|
||||
# Two waiting actions with the same logical_action_id for turn 1.
|
||||
await store.actions.create_action({
|
||||
"session_id": session["id"], "run_id": run["id"], "agent_id": "seat-1",
|
||||
"tool_name": "update_task", "turn_index": 1, "logical_action_id": "call-1",
|
||||
"idempotency_key": "dup1", "risk_level": "R3", "status": "waiting_approval",
|
||||
})
|
||||
await store.actions.create_action({
|
||||
"session_id": session["id"], "run_id": run["id"], "agent_id": "seat-1",
|
||||
"tool_name": "update_task", "turn_index": 1, "logical_action_id": "call-1",
|
||||
"idempotency_key": "dup2", "risk_level": "R3", "status": "waiting_approval",
|
||||
})
|
||||
|
||||
state = _seat_state(session["id"], run["id"])
|
||||
response = _FakeSeatResponse(tool_calls=[{"name": "update_task", "id": "call-1", "args": {}}])
|
||||
executor = SeatExecutor(_FakeSeatAdapter(store, response), state, "seat-1",
|
||||
action_coordinator=ActionCoordinator(svc, user_id="u1"))
|
||||
|
||||
with pytest.raises(RuntimeError, match="refusing to guess"):
|
||||
await executor.handle("msg", _FakeSeatCtx())
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user