Problem
The CB TE has no way to create a new conversation via the OpenAI endpoint. If no conversation_id is passed, it always falls back to the single persistent Imperator conversation. The get_context response includes a conversation_id but the Imperator ignores it, and the chat response never returns it to the client.
Context
The pMAD template is being split into two base TE packages:
base-pmad-te-ncb — PostgresSaver-backed, no CB dependency (default)
base-pmad-te-cb — CB-backed, calls get_context/store_message
Both will support three modes via the conversation_id field on the OpenAI endpoint:
- Pass an ID → resume that conversation
- Pass nothing → resume the default Imperator thread
- Pass
"new" → create a new conversation, return its ID in the response
The nCB variant handles this natively via LangGraph PostgresSaver thread_ids. The CB variant needs to:
- When receiving
"new", call get_context without a conversation_id so the CB creates one
- Capture the returned conversation_id from the
get_context response (currently ignored at imperator_flow.py init_context_node)
- Return the conversation_id in the chat completions response (currently missing)
What needs to change in context-broker
- The TE
init_context_node must read and propagate the conversation_id from the get_context response
- The chat response must include the
conversation_id so clients can continue the conversation
- Support the
"new" sentinel value to trigger new conversation creation
Problem
The CB TE has no way to create a new conversation via the OpenAI endpoint. If no conversation_id is passed, it always falls back to the single persistent Imperator conversation. The
get_contextresponse includes aconversation_idbut the Imperator ignores it, and the chat response never returns it to the client.Context
The pMAD template is being split into two base TE packages:
base-pmad-te-ncb— PostgresSaver-backed, no CB dependency (default)base-pmad-te-cb— CB-backed, calls get_context/store_messageBoth will support three modes via the conversation_id field on the OpenAI endpoint:
"new"→ create a new conversation, return its ID in the responseThe nCB variant handles this natively via LangGraph PostgresSaver thread_ids. The CB variant needs to:
"new", callget_contextwithout a conversation_id so the CB creates oneget_contextresponse (currently ignored at imperator_flow.py init_context_node)What needs to change in context-broker
init_context_nodemust read and propagate theconversation_idfrom theget_contextresponseconversation_idso clients can continue the conversation"new"sentinel value to trigger new conversation creation