ajuste no contas

This commit is contained in:
T3782834
2026-09-01 11:24:03 -03:00
parent 9ed4782f9d
commit 397b831fd3
428 changed files with 2294 additions and 4648 deletions

View File

@@ -413,7 +413,12 @@ async def _process_gateway_message(req: GatewayRequest, emit_sse: bool = False)
}
)
await checkpoints.put(agent_session_id, {"state": result, "message_id": message_id})
# IMPORTANT: the LangGraph checkpointer uses ``thread_id == agent_session_id``
# in the same checkpoint repository. Writing a gateway/debug snapshot under
# that same key overwrites the native LangGraph checkpoint and drops live
# transactional channels (active_transaction, pending_tool_call, confirmation
# snapshot, etc.). Keep the human/debug snapshot in a separate namespace.
await checkpoints.put(f"gateway:{agent_session_id}", {"state": result, "message_id": message_id})
await sse_hub.emit(agent_session_id, "workflow.completed", {"session_id": agent_session_id, "route": result.get("route"), "intent": result.get("intent")}) if emit_sse else None
answer = result.get("final_answer") or result.get("answer") or ""
@@ -658,7 +663,7 @@ async def get_session_messages(session_id: str, limit: int = 50):
@app.get("/sessions/{session_id}/checkpoint")
async def get_session_checkpoint(session_id: str):
return {"session_id": session_id, "checkpoint": await checkpoints.get_latest(session_id)}
return {"session_id": session_id, "checkpoint": await checkpoints.get_latest(f"gateway:{session_id}")}
@app.on_event("shutdown")