[BUG] ChatAgent.reset() 从未清除 OpenAIModel 的 previous_response_id 链状态,因此池化代理的下一个任务可能会继续错误的对话
`OpenAIModel` stores the OpenAI Responses API chaining state (`previous_response_id`, message count) in two dicts keyed by a session key, written in `_save_response_chain_state` and read in `_prepare_responses_input_and_chain` (`camel/models/openai_model.py`). `ChatAgent.reset()` (`camel/agents/chat_agent.py:656`) clears the agent's own memory, tool-output history and terminators, but never calls `OpenAIModel._clear_response_chain_state`, so this state survives a reset. `ChatAgent.clone()` (`chat_agent.py:6193`) passes `model=self.model_backend.models`, the existing model backend, into the new agent rather than constructing a fresh one. `workforce.AgentPool` (`camel/societies/workforce/single_agent_worker.py`) builds its pool with `clone(with_memory=False)` and calls `agent.reset()` in both `get_agent()` and `return_agent()` to hand a pooled agent to the next unrelated task. Because the clone shares the same `OpenAIModel` instance, and `reset()` never clears its response-chain dicts, a pooled agent's next task inherits the previous task's `previous_response_id`. Two effects follow from this: the new task's turn is silently chained onto a different task's OpenAI conversation, and because `_prepare_responses_input_and_chain` only sends messages past the stored `last_message_count`, the new task's own system prompt can be dropped from what is actually sent to the API.
内容来源: camel-ai/camel