{"record":{"id":"b37b6df32ce33b8a","repo":"can1357/oh-my-pi","slug":"timed-out-waiting-for-an-extension-ui-request","errorCode":null,"errorMessage":"Timed out waiting for an extension UI request","messagePattern":"Timed out waiting for an extension UI request","errorType":"exception","errorClass":"RpcTimeoutError","httpStatus":null,"severity":"warning","filePath":"python/omp-rpc/src/omp_rpc/client.py","lineNumber":893,"sourceCode":"            if request.method == \"input\":\n                if input_value is not None:\n                    self.send_ui_value(request.id, input_value)\n                else:\n                    self.cancel_ui_request(request.id)\n                return\n            if request.method == \"editor\":\n                if editor_value is not None:\n                    self.send_ui_value(request.id, editor_value)\n                else:\n                    self.cancel_ui_request(request.id)\n\n        return self.on_ui_request(handle)\n\n    def next_ui_request(self, timeout: float | None = None) -> ExtensionUiRequest:\n        try:\n            return self._ui_requests.get(timeout=timeout)\n        except queue.Empty as exc:\n            raise RpcTimeoutError(\n                \"Timed out waiting for an extension UI request\"\n            ) from exc\n\n    def send_ui_value(self, request_id: str, value: str) -> None:\n        self._send_notification(\n            {\"type\": \"extension_ui_response\", \"id\": request_id, \"value\": value}\n        )\n\n    def send_ui_confirmation(self, request_id: str, confirmed: bool) -> None:\n        self._send_notification(\n            {\"type\": \"extension_ui_response\", \"id\": request_id, \"confirmed\": confirmed}\n        )\n\n    def cancel_ui_request(self, request_id: str, *, timed_out: bool = False) -> None:\n        payload: JsonObject = {\n            \"type\": \"extension_ui_response\",\n            \"id\": request_id,\n            \"cancelled\": True,","sourceCodeStart":875,"sourceCodeEnd":911,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/omp-rpc/src/omp_rpc/client.py#L875-L911","documentation":"next_ui_request() blocks on an internal queue of pending extension UI requests (questions/prompts the server wants the host UI to render). If no request arrives before the optional timeout expires, queue.Empty is caught and re-raised as RpcTimeoutError. It signals 'no extension UI interaction was requested in time', not a protocol failure.","triggerScenarios":"Calling next_ui_request(timeout=N) when the server sends no extension/ui request within N seconds; calling with no timeout on an idle session where the server never issues a UI request.","commonSituations":"Test harnesses waiting for an agent question that never fires (agent finished or errored earlier); timeouts set too short for slow model responses; polling loop that forgot the session already answered the pending UI request.","solutions":["Increase or drop the timeout argument (timeout=None waits indefinitely)","Before waiting, confirm the prompt/agent run is actually active and can produce a UI request","Catch RpcTimeoutError and either re-poll or treat the run as complete","Check server-side logs/state to see whether an extension UI request was ever emitted"],"exampleFix":"# before\nrequest = client.next_ui_request(timeout=2)  # raises on slow agents\n\n# after\ntry:\n    request = client.next_ui_request(timeout=30)\nexcept RpcTimeoutError:\n    request = None  # no UI interaction pending; continue or finish","handlingStrategy":"try-catch","validationCode":"# ensure a run is active before waiting for UI requests\nstate = client.get_state()\nready = state is not None and getattr(state, \"active\", False)\n","typeGuard":null,"tryCatchPattern":"try:\n    request = client.next_ui_request(timeout=30)\nexcept RpcTimeoutError:\n    request = None  # no pending UI interaction; proceed or finish\n","preventionTips":["Always pass an explicit, generous timeout instead of blocking forever","Confirm the agent run is active before calling next_ui_request","Only consume one UI request per prompt cycle; re-poll after answering","Treat RpcTimeoutError as 'nothing pending', not a fatal error, in harnesses"],"tags":["rpc","timeout","ui-request","queue"],"backgroundTag":"rpc-request-timeout","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}