[GH-ISSUE #8] [Bug]: Issues with Factory AI Droid #8

Closed
opened 2026-02-27 07:17:22 +03:00 by kerem · 9 comments
Owner

Originally created by @Kartvya69 on GitHub (Dec 18, 2025).
Original GitHub issue: https://github.com/jwadow/kiro-gateway/issues/8

Gateway Version

v1.0.6

What happened?

Though Droid is working fine but at a specific point of chat it just stops working.

I have enabled Debug logs in my env but I still somehow couldn't get them working for me.

`### Debug Logs

root ➜ /workspaces/1/kiro-openai-gateway (main) $ python3 main.py
2025-12-18 13:09:42 | INFO | main:validate_configuration:201 - Using refresh token from environment
2025-12-18 13:09:42 | INFO | main::290 - Starting Uvicorn server...
2025-12-18 13:09:42 | INFO | main:validate_configuration:201 - Using refresh token from environment
2025-12-18 13:09:42 | INFO | logging:callHandlers:1762 - Started server process [12545]
2025-12-18 13:09:42 | INFO | logging:callHandlers:1762 - Waiting for application startup.
2025-12-18 13:09:42 | INFO | main:lifespan:221 - Starting application... Creating state managers.
2025-12-18 13:09:42 | INFO | logging:callHandlers:1762 - Application startup complete.
2025-12-18 13:09:42 | INFO | logging:callHandlers:1762 - Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2025-12-18 13:09:47 | INFO | kiro_gateway.routes:chat_completions:195 - Request to /v1/chat/completions (model=claude-opus-4-5-20251101, stream=True)
2025-12-18 13:09:47 | DEBUG | kiro_gateway.routes:chat_completions:214 - Model cache is empty, skipping forced population
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_i_tARl7eTZO8tBMzhNovAA
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_OsAKKArkR9iVaZF9TxHKQw
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 2 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_-0InnVk8Rna4Z6P5tK-UNg
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_fSGCnjFVTxuE888mmg323A
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 2 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_c2o4NVysSuWtjsF3pSHb4g
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 1 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_plNpBJ1tSwqqvD1eL-YxAw
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_aR0JocGHRHGIJkBzmdohdg
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_LgRGmobORXih9q40b_AKrg
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_OvhJTxCCTbG9xq1P7tDUbA
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 4 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_6Tzpus97TK2RukWt9ZVodA
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_lnOEgZeATrOs2FuQ6hF28Q
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_JjzzOD_cSsqoYZrdfYDh5g
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_V1DTe2EmSlGuf8-AWEbNYw
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_vS9kN9dgSIaMFiotGbo2oQ
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 5 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_Jr8k8JoYThKFBU_gR5JbjA
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_PjZ3DsQGSuO1l9zCtW5Y3g
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_23GREefFS86yRlenRsuxSg
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_wmec6S5PQgWdh8xfNs-4-Q
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_1JQu60O0SRejcJTIOBrBMQ
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 5 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_tmxTq76MSwmzADRS-hIFBA
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_-QDL603LQbSOf8d4wyKwig
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 2 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_z8N27bdLR2qYpOAUMrXWVA
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_KmdHDk6dSrmwceow775fIg
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 2 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_AhrUFJ8RSkiRxLsy57Vdtg
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 1 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 -
Collected tool result for tool_call_id=tooluse_tCno7eVISBqXHLFZeN_s5w
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 -
Created user message with 1 tool results
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 -
Merged adjacent messages with role user
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 -
Merged adjacent messages with role user
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 -
Merged adjacent messages with role user
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 -
Merged adjacent messages with role user
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 -
Merged adjacent messages with role user
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 -
Merged adjacent messages with role user
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 -
Merged adjacent messages with role user
2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 -
Merged adjacent messages with role user
2025-12-18 13:09:47 | INFO | kiro_gateway.auth:_refresh_token_request:227 - Refreshing Kiro token...
2025-12-18 13:09:48 | INFO | kiro_gateway.auth:_refresh_token_request:262 - Token refreshed, expires: 2025-12-18T14:08:48+00:00
2025-12-18 13:09:52 | INFO | logging:callHandlers:1762 - 127.0.0.1:40446 - "POST /v1/chat/completions HTTP/1.1" 200
2025-12-18 13:10:07 | ERROR | kiro_gateway.streaming:stream_kiro_to_openai_internal:320 - Error during streaming:
2025-12-18 13:10:07 | DEBUG | kiro_gateway.streaming:stream_kiro_to_openai_internal:323 - Streaming completed
2025-12-18 13:10:07 | INFO | kiro_gateway.routes:stream_wrapper:322 - HTTP 200 - POST /v1/chat/completions (streaming) - completed
^C2025-12-18 13:10:10 | INFO | logging:callHandlers:1762 - Shutting down
2025-12-18 13:10:10 | INFO | logging:callHandlers:1762 - Waiting for application shutdown.
2025-12-18 13:10:10 | INFO | main:lifespan:236 - Shutting down application.
2025-12-18 13:10:10 | INFO | logging:callHandlers:1762 - Application shutdown complete.
2025-12-18 13:10:10 | INFO | logging:callHandlers:1762 - Finished server process [12545]`

Originally created by @Kartvya69 on GitHub (Dec 18, 2025). Original GitHub issue: https://github.com/jwadow/kiro-gateway/issues/8 ### Gateway Version v1.0.6 ### What happened? Though Droid is working fine but at a specific point of chat it just stops working. I have enabled Debug logs in my env but I still somehow couldn't get them working for me. `### Debug Logs root ➜ /workspaces/1/kiro-openai-gateway (main) $ python3 main.py 2025-12-18 13:09:42 | INFO | __main__:validate_configuration:201 - Using refresh token from environment 2025-12-18 13:09:42 | INFO | __main__:<module>:290 - Starting Uvicorn server... 2025-12-18 13:09:42 | INFO | main:validate_configuration:201 - Using refresh token from environment 2025-12-18 13:09:42 | INFO | logging:callHandlers:1762 - Started server process [12545] 2025-12-18 13:09:42 | INFO | logging:callHandlers:1762 - Waiting for application startup. 2025-12-18 13:09:42 | INFO | __main__:lifespan:221 - Starting application... Creating state managers. 2025-12-18 13:09:42 | INFO | logging:callHandlers:1762 - Application startup complete. 2025-12-18 13:09:42 | INFO | logging:callHandlers:1762 - Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) 2025-12-18 13:09:47 | INFO | kiro_gateway.routes:chat_completions:195 - Request to /v1/chat/completions (model=claude-opus-4-5-20251101, stream=True) 2025-12-18 13:09:47 | DEBUG | kiro_gateway.routes:chat_completions:214 - Model cache is empty, skipping forced population 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_i_tARl7eTZO8tBMzhNovAA 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_OsAKKArkR9iVaZF9TxHKQw 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 2 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_-0InnVk8Rna4Z6P5tK-UNg 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_fSGCnjFVTxuE888mmg323A 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 2 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_c2o4NVysSuWtjsF3pSHb4g 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 1 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_plNpBJ1tSwqqvD1eL-YxAw 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_aR0JocGHRHGIJkBzmdohdg 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_LgRGmobORXih9q40b_AKrg 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_OvhJTxCCTbG9xq1P7tDUbA 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 4 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_6Tzpus97TK2RukWt9ZVodA 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_lnOEgZeATrOs2FuQ6hF28Q 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_JjzzOD_cSsqoYZrdfYDh5g 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_V1DTe2EmSlGuf8-AWEbNYw 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_vS9kN9dgSIaMFiotGbo2oQ 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 5 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_Jr8k8JoYThKFBU_gR5JbjA 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_PjZ3DsQGSuO1l9zCtW5Y3g 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_23GREefFS86yRlenRsuxSg 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_wmec6S5PQgWdh8xfNs-4-Q 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_1JQu60O0SRejcJTIOBrBMQ 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 5 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_tmxTq76MSwmzADRS-hIFBA 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_-QDL603LQbSOf8d4wyKwig 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 2 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_z8N27bdLR2qYpOAUMrXWVA 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_KmdHDk6dSrmwceow775fIg 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 2 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_AhrUFJ8RSkiRxLsy57Vdtg 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 1 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:121 - Collected tool result for tool_call_id=tooluse_tCno7eVISBqXHLFZeN_s5w 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:132 - Created user message with 1 tool results 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 - Merged adjacent messages with role user 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 - Merged adjacent messages with role user 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 - Merged adjacent messages with role user 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 - Merged adjacent messages with role user 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 - Merged adjacent messages with role user 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 - Merged adjacent messages with role user 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 - Merged adjacent messages with role user 2025-12-18 13:09:47 | DEBUG | kiro_gateway.converters:merge_adjacent_messages:176 - Merged adjacent messages with role user 2025-12-18 13:09:47 | INFO | kiro_gateway.auth:_refresh_token_request:227 - Refreshing Kiro token... 2025-12-18 13:09:48 | INFO | kiro_gateway.auth:_refresh_token_request:262 - Token refreshed, expires: 2025-12-18T14:08:48+00:00 2025-12-18 13:09:52 | INFO | logging:callHandlers:1762 - 127.0.0.1:40446 - "POST /v1/chat/completions HTTP/1.1" 200 2025-12-18 13:10:07 | ERROR | kiro_gateway.streaming:stream_kiro_to_openai_internal:320 - Error during streaming: 2025-12-18 13:10:07 | DEBUG | kiro_gateway.streaming:stream_kiro_to_openai_internal:323 - Streaming completed 2025-12-18 13:10:07 | INFO | kiro_gateway.routes:stream_wrapper:322 - HTTP 200 - POST /v1/chat/completions (streaming) - completed ^C2025-12-18 13:10:10 | INFO | logging:callHandlers:1762 - Shutting down 2025-12-18 13:10:10 | INFO | logging:callHandlers:1762 - Waiting for application shutdown. 2025-12-18 13:10:10 | INFO | __main__:lifespan:236 - Shutting down application. 2025-12-18 13:10:10 | INFO | logging:callHandlers:1762 - Application shutdown complete. 2025-12-18 13:10:10 | INFO | logging:callHandlers:1762 - Finished server process [12545]`
kerem 2026-02-27 07:17:22 +03:00
  • closed this issue
  • added the
    bug
    fixed
    labels
Author
Owner

@jwadow commented on GitHub (Dec 18, 2025):

Hey @Kartvya69 thanks for the detailed report

I pushed a fix that should help - either it fixes the issue completely, or at least you'll get a proper error message instead of that empty one.

Can you try it from main? No release yet since I want to make sure it actually works for you first.

If you already have the repo:

git pull origin main
python3 main.py

Or fresh clone:

git clone https://github.com/Jwadow/kiro-openai-gateway.git
cd kiro-openai-gateway
python3 -m pip install -r requirements.txt
LOG_LEVEL=DEBUG python3 main.py

Let me know how it goes and i'll make release 1.0.7

<!-- gh-comment-id:3670699054 --> @jwadow commented on GitHub (Dec 18, 2025): Hey @Kartvya69 thanks for the detailed report I pushed a fix that should help - either it fixes the issue completely, or at least you'll get a proper error message instead of that empty one. Can you try it from main? No release yet since I want to make sure it actually works for you first. If you already have the repo: ```bash git pull origin main python3 main.py ``` Or fresh clone: ```bash git clone https://github.com/Jwadow/kiro-openai-gateway.git cd kiro-openai-gateway python3 -m pip install -r requirements.txt LOG_LEVEL=DEBUG python3 main.py ``` Let me know how it goes and i'll make release 1.0.7
Author
Owner

@Kartvya69 commented on GitHub (Dec 18, 2025):

Okay. Lemme try.

<!-- gh-comment-id:3670730165 --> @Kartvya69 commented on GitHub (Dec 18, 2025): Okay. Lemme try.
Author
Owner

@Kartvya69 commented on GitHub (Dec 18, 2025):

Seems like it's fixed thanks. A suggestion add a proxy system where we can add more than one refresh tokens.

Thank you.

<!-- gh-comment-id:3670817780 --> @Kartvya69 commented on GitHub (Dec 18, 2025): Seems like it's fixed thanks. A suggestion add a proxy system where we can add more than one refresh tokens. Thank you.
Author
Owner

@Kartvya69 commented on GitHub (Dec 18, 2025):

Nvm it's back.

`The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/workspaces/op/kiro-openai-gateway/main.py", line 292, in
uvicorn.run(
│ └ <function run at 0x7d7485eb0cc0>
└ <module 'uvicorn' from '/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/init.py'>
File "/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/main.py",
line 593, in run
server.run()
│ └ <function Server.run at 0x7d7485eb0540>
└ <uvicorn.server.Server object at 0x7d74860aed20>
File "/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory())
│ │ │ │ │ │ └ <function Config.get_loop_factory at 0x7d7485eb0040>
│ │ │ │ │ └ <uvicorn.config.Config object at 0x7d7486524b90>
│ │ │ │ └ <uvicorn.server.Server object at 0x7d74860aed20>
│ │ │ └ None
│ │ └ <function Server.serve at 0x7d7485eb05e0>
│ └ <uvicorn.server.Server object at 0x7d74860aed20>
└ <function run at 0x7d7486d53420>
File "/home/codespace/.python/current/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0x7d7485ed6500>
│ └ <function Runner.run at 0x7d7486dbac00>
└ <asyncio.runners.Runner object at 0x7d748635e690>
File "/home/codespace/.python/current/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /home/codespace/.python/current/lib/python3.12/site-packages/uvic...
│ │ └ <cyfunction Loop.run_until_complete at 0x7d7485c94580>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0x7d748635e690>

File "/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
result = await app( # type: ignore[func-returns-value]
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7d7485ec2480>
File "/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
│ │ │ │ └ <bound method RequestResponseCycle.send of
<uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859a42...
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ └ <fastapi.applications.FastAPI object at 0x7d748635e630>
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7d7485ec2480>
File "/home/codespace/.python/current/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
│ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859a42...
│ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
└ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859a42...
│ │ │ └ <bound method RequestResponseCycle.receive of
<uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7d7486c1f3b0>
└ <fastapi.applications.FastAPI object at 0x7d748635e630>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
│ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0x7d7485d332e0>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ └ <starlette.middleware.cors.CORSMiddleware object at 0x7d7485d3c2c0>
└ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7d7486c1f3b0>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
│ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0x7d7485d332e0>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7d7485d3c320>
└ <starlette.middleware.cors.CORSMiddleware object at 0x7d7485d3c2c0>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 63, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
│ │ │ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0x7d7485d332e0>
│ │ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ │ │ └ <starlette.requests.Request object at 0x7d74859a5cd0>
│ │ └ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7d7485d3c3b0>
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7d7485d3c320>
└ <function wrap_app_handling_exceptions at 0x7d7486446660>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7d7485d33b00>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
└ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7d7485d3c3b0>
File "/home/codespace/.python/current/lib/python3.12/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7d7485d33b00>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ └ <fastapi.routing.APIRouter object at 0x7d74860aedb0>
└ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7d7485d3c3b0>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/routing.py", line 716, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7d7485d33b00>
│ │ │ └ <bound method RequestResponseCycle.receive of
<uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7d74860aedb0>>
└ <fastapi.routing.APIRouter object at 0x7d74860aedb0>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/routing.py", line 736, in app
await route.handle(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7d7485d33b00>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ └ <function Route.handle at 0x7d7486447c40>
└ APIRoute(path='/v1/chat/completions', name='chat_completions', methods=['POST'])
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/routing.py", line 290, in handle
await self.app(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7d7485d33b00>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ └ <function request_response..app at 0x7d748610c0e0>
└ APIRoute(path='/v1/chat/completions', name='chat_completions', methods=['POST'])
File "/home/codespace/.python/current/lib/python3.12/site-packages/fastapi/routing.py", line 118, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
│ │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7d7485d33b00>
│ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
│ │ └ <starlette.requests.Request object at 0x7d74835ef200>
│ └ <function request_response..app..app at 0x7d7485d33060>
└ <function wrap_app_handling_exceptions at 0x7d7486446660>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7d74835a6980>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
└ <function request_response..app..app at 0x7d7485d33060>
File "/home/codespace/.python/current/lib/python3.12/site-packages/fastapi/routing.py", line 105, in app
await response(scope, receive, send)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0x7d74835a6980>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859...
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl...
└ <starlette.responses.StreamingResponse object at 0x7d74859a6000>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/responses.py", line 269, in call
with collapse_excgroups():
└ <function collapse_excgroups at 0x7d74865ecae0>
File "/home/codespace/.python/current/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
│ │ │ └ ExceptionGroup('unhandled errors in a TaskGroup', [ReadTimeout('')])
│ │ └ <method 'throw' of 'generator' objects>
│ └ <generator object collapse_excgroups at 0x7d7487f40e10>
└ <contextlib._GeneratorContextManager object at 0x7d748635e570>
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/responses.py", line 273, in wrap
await func()
└ functools.partial(<bound method StreamingResponse.stream_response of <starlette.responses.StreamingResponse object at 0x7d748...
File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/responses.py", line 253, in stream_response
async for chunk in self.body_iterator:
│ │ └ <async_generator object chat_completions..stream_wrapper at 0x7d74838b0880>
│ └ <starlette.responses.StreamingResponse object at 0x7d74859a6000>
└ b'data: [DONE]\n\n'
File "/workspaces/op/kiro-openai-gateway/kiro_gateway/routes.py", line 305, in stream_wrapper
async for chunk in stream_kiro_to_openai(
└ <function stream_kiro_to_openai at 0x7d74860e8b80>
File "/workspaces/op/kiro-openai-gateway/kiro_gateway/streaming.py", line 377, in stream_kiro_to_openai
async for chunk in stream_kiro_to_openai_internal(
└ <function stream_kiro_to_openai_internal at 0x7d74860e8720>
File "/workspaces/op/kiro-openai-gateway/kiro_gateway/streaming.py", line 170, in stream_kiro_to_openai_internal
async for chunk in byte_iterator:
│ └ <async_generator object Response.aiter_bytes at 0x7d7485a89a20>
└ b'\x00\x00\x00\xb2\x00\x00\x00R\x8a@\xb4\xc5\x0b:event-type\x07\x00\x0ctoolUseEvent\r:content-type\x07\x00\x10application/jso...
File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_models.py", line 997, in aiter_bytes
async for raw_bytes in self.aiter_raw():
│ │ └ <function Response.aiter_raw at 0x7d74862ac040>
│ └ <Response [200 OK]>
└ b'\x00\x00\x00\xb2\x00\x00\x00R\x8a@\xb4\xc5\x0b:event-type\x07\x00\x0ctoolUseEvent\r:content-type\x07\x00\x10application/jso...
File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_models.py", line 1055, in aiter_raw
async for raw_stream_bytes in self.stream:
│ │ └ <httpx._client.BoundAsyncStream object at 0x7d7482e26090>
│ └ <Response [200 OK]>
└ b'\x00\x00\x00\xb2\x00\x00\x00R\x8a@\xb4\xc5\x0b:event-type\x07\x00\x0ctoolUseEvent\r:content-type\x07\x00\x10application/jso...
File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_client.py", line 176, in aiter
async for chunk in self._stream:
│ │ └ <httpx._transports.default.AsyncResponseStream object at
0x7d7482e262d0>
│ └ <httpx._client.BoundAsyncStream object at 0x7d7482e26090>
└ b'\x00\x00\x00\xb2\x00\x00\x00R\x8a@\xb4\xc5\x0b:event-type\x07\x00\x0ctoolUseEvent\r:content-type\x07\x00\x10application/jso...
File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_transports/default.py", line 270, in aiter
with map_httpcore_exceptions():
└ <function map_httpcore_exceptions at 0x7d74862af6a0>
File "/home/codespace/.python/current/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
│ │ │ └ ReadTimeout(TimeoutError())
│ │ └ <method 'throw' of 'generator' objects>
│ └ <generator object map_httpcore_exceptions at 0x7d7485ceec40>
└ <contextlib._GeneratorContextManager object at 0x7d748397f800>
File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
raise mapped_exc(message) from exc
│ └ ''
└ <class 'httpx.ReadTimeout'>
httpx.ReadTimeout`

<!-- gh-comment-id:3670829643 --> @Kartvya69 commented on GitHub (Dec 18, 2025): Nvm it's back. `The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/workspaces/op/kiro-openai-gateway/main.py", line 292, in <module> uvicorn.run( │ └ <function run at 0x7d7485eb0cc0> └ <module 'uvicorn' from '/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/__init__.py'> File "/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/main.py", line 593, in run server.run() │ └ <function Server.run at 0x7d7485eb0540> └ <uvicorn.server.Server object at 0x7d74860aed20> File "/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory()) │ │ │ │ │ │ └ <function Config.get_loop_factory at 0x7d7485eb0040> │ │ │ │ │ └ <uvicorn.config.Config object at 0x7d7486524b90> │ │ │ │ └ <uvicorn.server.Server object at 0x7d74860aed20> │ │ │ └ None │ │ └ <function Server.serve at 0x7d7485eb05e0> │ └ <uvicorn.server.Server object at 0x7d74860aed20> └ <function run at 0x7d7486d53420> File "/home/codespace/.python/current/lib/python3.12/asyncio/runners.py", line 194, in run return runner.run(main) │ │ └ <coroutine object Server.serve at 0x7d7485ed6500> │ └ <function Runner.run at 0x7d7486dbac00> └ <asyncio.runners.Runner object at 0x7d748635e690> File "/home/codespace/.python/current/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) │ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /home/codespace/.python/current/lib/python3.12/site-packages/uvic... │ │ └ <cyfunction Loop.run_until_complete at 0x7d7485c94580> │ └ <uvloop.Loop running=True closed=False debug=False> └ <asyncio.runners.Runner object at 0x7d748635e690> > File "/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi result = await app( # type: ignore[func-returns-value] └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7d7485ec2480> File "/home/codespace/.python/current/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__ return await self.app(scope, receive, send) │ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859a42... │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ └ <fastapi.applications.FastAPI object at 0x7d748635e630> └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7d7485ec2480> File "/home/codespace/.python/current/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in __call__ await super().__call__(scope, receive, send) │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859a42... │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/applications.py", line 107, in __call__ await self.middleware_stack(scope, receive, send) │ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859a42... │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7d7486c1f3b0> └ <fastapi.applications.FastAPI object at 0x7d748635e630> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) │ │ │ │ └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7d7485d332e0> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ └ <starlette.middleware.cors.CORSMiddleware object at 0x7d7485d3c2c0> └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7d7486c1f3b0> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/middleware/cors.py", line 85, in __call__ await self.app(scope, receive, send) │ │ │ │ └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7d7485d332e0> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7d7485d3c320> └ <starlette.middleware.cors.CORSMiddleware object at 0x7d7485d3c2c0> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 63, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) │ │ │ │ │ │ └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7d7485d332e0> │ │ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ │ │ └ <starlette.requests.Request object at 0x7d74859a5cd0> │ │ └ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7d7485d3c3b0> │ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7d7485d3c320> └ <function wrap_app_handling_exceptions at 0x7d7486446660> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app raise exc File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7d7485d33b00> │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... └ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7d7485d3c3b0> File "/home/codespace/.python/current/lib/python3.12/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__ await self.app(scope, receive, send) │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7d7485d33b00> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ └ <fastapi.routing.APIRouter object at 0x7d74860aedb0> └ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7d7485d3c3b0> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/routing.py", line 716, in __call__ await self.middleware_stack(scope, receive, send) │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7d7485d33b00> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7d74860aedb0>> └ <fastapi.routing.APIRouter object at 0x7d74860aedb0> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/routing.py", line 736, in app await route.handle(scope, receive, send) │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7d7485d33b00> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ └ <function Route.handle at 0x7d7486447c40> └ APIRoute(path='/v1/chat/completions', name='chat_completions', methods=['POST']) File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/routing.py", line 290, in handle await self.app(scope, receive, send) │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7d7485d33b00> │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ └ <function request_response.<locals>.app at 0x7d748610c0e0> └ APIRoute(path='/v1/chat/completions', name='chat_completions', methods=['POST']) File "/home/codespace/.python/current/lib/python3.12/site-packages/fastapi/routing.py", line 118, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) │ │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7d7485d33b00> │ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... │ │ └ <starlette.requests.Request object at 0x7d74835ef200> │ └ <function request_response.<locals>.app.<locals>.app at 0x7d7485d33060> └ <function wrap_app_handling_exceptions at 0x7d7486446660> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app raise exc File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7d74835a6980> │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... └ <function request_response.<locals>.app.<locals>.app at 0x7d7485d33060> File "/home/codespace/.python/current/lib/python3.12/site-packages/fastapi/routing.py", line 105, in app await response(scope, receive, send) │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7d74835a6980> │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7d74859... │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8000), 'cl... └ <starlette.responses.StreamingResponse object at 0x7d74859a6000> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/responses.py", line 269, in __call__ with collapse_excgroups(): └ <function collapse_excgroups at 0x7d74865ecae0> File "/home/codespace/.python/current/lib/python3.12/contextlib.py", line 158, in __exit__ self.gen.throw(value) │ │ │ └ ExceptionGroup('unhandled errors in a TaskGroup', [ReadTimeout('')]) │ │ └ <method 'throw' of 'generator' objects> │ └ <generator object collapse_excgroups at 0x7d7487f40e10> └ <contextlib._GeneratorContextManager object at 0x7d748635e570> File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups raise exc File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/responses.py", line 273, in wrap await func() └ functools.partial(<bound method StreamingResponse.stream_response of <starlette.responses.StreamingResponse object at 0x7d748... File "/home/codespace/.python/current/lib/python3.12/site-packages/starlette/responses.py", line 253, in stream_response async for chunk in self.body_iterator: │ │ └ <async_generator object chat_completions.<locals>.stream_wrapper at 0x7d74838b0880> │ └ <starlette.responses.StreamingResponse object at 0x7d74859a6000> └ b'data: [DONE]\n\n' File "/workspaces/op/kiro-openai-gateway/kiro_gateway/routes.py", line 305, in stream_wrapper async for chunk in stream_kiro_to_openai( └ <function stream_kiro_to_openai at 0x7d74860e8b80> File "/workspaces/op/kiro-openai-gateway/kiro_gateway/streaming.py", line 377, in stream_kiro_to_openai async for chunk in stream_kiro_to_openai_internal( └ <function stream_kiro_to_openai_internal at 0x7d74860e8720> File "/workspaces/op/kiro-openai-gateway/kiro_gateway/streaming.py", line 170, in stream_kiro_to_openai_internal async for chunk in byte_iterator: │ └ <async_generator object Response.aiter_bytes at 0x7d7485a89a20> └ b'\x00\x00\x00\xb2\x00\x00\x00R\x8a@\xb4\xc5\x0b:event-type\x07\x00\x0ctoolUseEvent\r:content-type\x07\x00\x10application/jso... File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_models.py", line 997, in aiter_bytes async for raw_bytes in self.aiter_raw(): │ │ └ <function Response.aiter_raw at 0x7d74862ac040> │ └ <Response [200 OK]> └ b'\x00\x00\x00\xb2\x00\x00\x00R\x8a@\xb4\xc5\x0b:event-type\x07\x00\x0ctoolUseEvent\r:content-type\x07\x00\x10application/jso... File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_models.py", line 1055, in aiter_raw async for raw_stream_bytes in self.stream: │ │ └ <httpx._client.BoundAsyncStream object at 0x7d7482e26090> │ └ <Response [200 OK]> └ b'\x00\x00\x00\xb2\x00\x00\x00R\x8a@\xb4\xc5\x0b:event-type\x07\x00\x0ctoolUseEvent\r:content-type\x07\x00\x10application/jso... File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_client.py", line 176, in __aiter__ async for chunk in self._stream: │ │ └ <httpx._transports.default.AsyncResponseStream object at 0x7d7482e262d0> │ └ <httpx._client.BoundAsyncStream object at 0x7d7482e26090> └ b'\x00\x00\x00\xb2\x00\x00\x00R\x8a@\xb4\xc5\x0b:event-type\x07\x00\x0ctoolUseEvent\r:content-type\x07\x00\x10application/jso... File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_transports/default.py", line 270, in __aiter__ with map_httpcore_exceptions(): └ <function map_httpcore_exceptions at 0x7d74862af6a0> File "/home/codespace/.python/current/lib/python3.12/contextlib.py", line 158, in __exit__ self.gen.throw(value) │ │ │ └ ReadTimeout(TimeoutError()) │ │ └ <method 'throw' of 'generator' objects> │ └ <generator object map_httpcore_exceptions at 0x7d7485ceec40> └ <contextlib._GeneratorContextManager object at 0x7d748397f800> File "/home/codespace/.python/current/lib/python3.12/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions raise mapped_exc(message) from exc │ └ '' └ <class 'httpx.ReadTimeout'> httpx.ReadTimeout`
Author
Owner

@Kartvya69 commented on GitHub (Dec 18, 2025):

Ok but it's more interesting because now when I ask the agent to continue, It actually continues working

This is the error shared by the droid when the above error happened

Error: The socket connection was closed unexpectedly. For more information,
pass verbose: true in the second argument to fetch()
This might be a network issue. Please check:

  1. Your internet connection
  2. Any firewall or proxy settings

But after a few seconds the error is happening again.

<!-- gh-comment-id:3670840601 --> @Kartvya69 commented on GitHub (Dec 18, 2025): Ok but it's more interesting because now when I ask the agent to continue, It actually continues working This is the error shared by the droid when the above error happened > Error: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch() This might be a network issue. Please check: 1. Your internet connection 2. Any firewall or proxy settings But after a few seconds the error is happening again.
Author
Owner

@Kartvya69 commented on GitHub (Dec 18, 2025):

@jwadow Hey I made a pr which is currently working perfect for me. Can you review it.

<!-- gh-comment-id:3671005427 --> @Kartvya69 commented on GitHub (Dec 18, 2025): @jwadow Hey I made a pr which is currently working perfect for me. Can you review it.
Author
Owner

@jwadow commented on GitHub (Dec 18, 2025):

@Kartvya69 Now I can see the actual error: httpx.ReadTimeout

This is a network timeout - the connection to Kiro API is timing out mid-stream.

Quick fix - try increasing the timeout:

Add this to your .env:

FIRST_TOKEN_TIMEOUT=60 # or larger

This increases network timeouts from 15 to 60 seconds.

Also I noticed from the paths (/workspaces/, /home/codespace/) that you might be running on GitHub Codespaces. If so, that could be contributing to the issue - Codespaces adds extra network hops between your environment and Kiro API (AWS).

If you're on Codespaces and the problem persists even with higher timeout, consider:

  • Running locally instead
  • Or using own or friend's VPS, to avoid additional costs. The project does not consume much power.

Note: The "continue" workaround you found is actually working as expected - the model picks up where it left off. The "socket connection was closed unexpectedly" error from Droid is just it reporting the same timeout issue.

<!-- gh-comment-id:3671006517 --> @jwadow commented on GitHub (Dec 18, 2025): @Kartvya69 Now I can see the actual error: httpx.ReadTimeout This is a network timeout - the connection to Kiro API is timing out mid-stream. Quick fix - try increasing the timeout: Add this to your `.env`: ```env FIRST_TOKEN_TIMEOUT=60 # or larger ``` This increases network timeouts from 15 to 60 seconds. Also I noticed from the paths (`/workspaces/`, `/home/codespace/`) that you might be running on GitHub Codespaces. If so, that could be contributing to the issue - Codespaces adds extra network hops between your environment and Kiro API (AWS). If you're on Codespaces and the problem persists even with higher timeout, consider: - Running locally instead - Or using own or friend's VPS, to avoid additional costs. The project does not consume much power. **Note:** The "continue" workaround you found is actually working as expected - the model picks up where it left off. The "socket connection was closed unexpectedly" error from Droid is just it reporting the same timeout issue.
Author
Owner

@jwadow commented on GitHub (Dec 18, 2025):

@jwadow Hey I made a pr which is currently working perfect for me. Can you review it.

Ok, i'll check, thanks

<!-- gh-comment-id:3671007552 --> @jwadow commented on GitHub (Dec 18, 2025): > [@jwadow](https://github.com/jwadow) Hey I made a pr which is currently working perfect for me. Can you review it. Ok, i'll check, thanks
Author
Owner

@Kartvya69 commented on GitHub (Dec 18, 2025):

@Kartvya69 Now I can see the actual error: httpx.ReadTimeout

This is a network timeout - the connection to Kiro API is timing out mid-stream.

Quick fix - try increasing the timeout:

Add this to your .env:

FIRST_TOKEN_TIMEOUT=60 # or larger
This increases network timeouts from 15 to 60 seconds.

Also I noticed from the paths (/workspaces/, /home/codespace/) that you might be running on GitHub Codespaces. If so, that could be contributing to the issue - Codespaces adds extra network hops between your environment and Kiro API (AWS).

If you're on Codespaces and the problem persists even with higher timeout, consider:

  • Running locally instead
  • Or using own or friend's VPS, to avoid additional costs. The project does not consume much power.

Note: The "continue" workaround you found is actually working as expected - the model picks up where it left off. The "socket connection was closed unexpectedly" error from Droid is just it reporting the same timeout issue.

Okay thanks.

Thanks for the active support too. 😊

<!-- gh-comment-id:3671022607 --> @Kartvya69 commented on GitHub (Dec 18, 2025): > [@Kartvya69](https://github.com/Kartvya69) Now I can see the actual error: httpx.ReadTimeout > > This is a network timeout - the connection to Kiro API is timing out mid-stream. > > Quick fix - try increasing the timeout: > > Add this to your `.env`: > > FIRST_TOKEN_TIMEOUT=60 # or larger > This increases network timeouts from 15 to 60 seconds. > > Also I noticed from the paths (`/workspaces/`, `/home/codespace/`) that you might be running on GitHub Codespaces. If so, that could be contributing to the issue - Codespaces adds extra network hops between your environment and Kiro API (AWS). > > If you're on Codespaces and the problem persists even with higher timeout, consider: > > * Running locally instead > * Or using own or friend's VPS, to avoid additional costs. The project does not consume much power. > > **Note:** The "continue" workaround you found is actually working as expected - the model picks up where it left off. The "socket connection was closed unexpectedly" error from Droid is just it reporting the same timeout issue. Okay thanks. Thanks for the active support too. 😊
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/kiro-gateway-jwadow#8
No description provided.