{"record":{"id":"1053ce33a2a525bc","repo":"binary-husky/gpt_academic","slug":"error-1053ce","errorCode":null,"errorMessage":"等待用户输入超时","messagePattern":"等待用户输入超时","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"warning","filePath":"crazy_functions/agent_fns/general.py","lineNumber":61,"sourceCode":"\n    def gpt_academic_get_human_input(self, user_proxy, message):\n        # ⭐⭐ run in subprocess\n        patience = 300\n        begin_waiting_time = time.time()\n        self.child_conn.send(PipeCom(\"interact\", message))\n        while True:\n            time.sleep(0.5)\n            if self.child_conn.poll():\n                wait_success = True\n                break\n            if time.time() - begin_waiting_time > patience:\n                self.child_conn.send(PipeCom(\"done\", \"\"))\n                wait_success = False\n                break\n        if wait_success:\n            return self.child_conn.recv().content\n        else:\n            raise TimeoutError(\"等待用户输入超时\")\n\n    def define_agents(self):\n        raise NotImplementedError\n\n    def exe_autogen(self, input):\n        # ⭐⭐ run in subprocess\n        input = input.content\n        code_execution_config = {\"work_dir\": self.autogen_work_dir, \"use_docker\": self.use_docker}\n        agents = self.define_agents()\n        user_proxy = None\n        assistant = None\n        for agent_kwargs in agents:\n            agent_cls = agent_kwargs.pop('cls')\n            kwargs = {\n                'llm_config':self.llm_kwargs,\n                'code_execution_config':code_execution_config\n            }\n            kwargs.update(agent_kwargs)","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/crazy_functions/agent_fns/general.py#L43-L79","documentation":"AutoGen's get_human_input hook sends an interact prompt through the multiprocess pipe and polls for a reply every 0.5 seconds. If no reply arrives within 300 seconds, it sends a done message and raises TimeoutError to end the agent run.","triggerScenarios":"An AutoGen agent calls get_human_input and the user does not answer in the web UI, the UI session is closed or disconnected, or the pipe message is consumed elsewhere so child_conn.poll() never sees it.","commonSituations":"Unattended or background agent runs; a chat agent configured to ask clarifying questions; the user switches tabs or loses the session; a subprocess/UI protocol mismatch; long-running work after the prompt exceeds five minutes.","solutions":["Watch for the interact prompt and reply before the 300-second deadline.","Configure agents to avoid human input for autonomous runs.","Increase patience if interactive sessions legitimately need more time.","Catch TimeoutError and report that user input was not received instead of leaving a generic AutoGen failure.","Keep the parent UI/process alive while the agent is waiting."],"exampleFix":"# before\npatience = 300\n\n# after\npatience = int(os.environ.get(\"AUTOGEN_HUMAN_INPUT_TIMEOUT\", \"300\"))\n","handlingStrategy":"try-catch","validationCode":"if not interactive_session_active:\n    configure_agents_without_human_input()\n","typeGuard":null,"tryCatchPattern":"try:\n    user_input = self.gpt_academic_get_human_input(user_proxy, message)\nexcept TimeoutError:\n    send_agent_status(\"Timed out waiting for user input\")\n    raise\n","preventionTips":["Configure unattended agents to use defaults instead of human input.","Surface interact prompts immediately and audibly to the user.","Set patience from configuration for different deployment modes.","Treat the timeout as a normal end condition, not a crash."],"tags":["autogen","timeout","multiprocessing","user-input"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}