SimiaCryptus/intellij-aicoder

Hangs on "Running CodeChat Server"

Closed this issue · 5 comments

npt commented

I installed the plugin and configured my API keys. When I select the 'Patch Chat' or 'Code Chat' action, I get a notification/progress bar "Running CodeChat Server on 8081" that persists forever; nothing else happens.

Looking at running processes, pycharm doesn't have any new child processes, suggesting that whatever's supposed to start isn't starting at all.

Are you running mac by chance? It should have opened a browser window. If you can run it from a console terminal you may see some useful logs. I will try to create some error handling / backup ui for this. Thanks for the report.

npt commented

Linux.

I see that PyCharm is listening on 8081. The plugin does try to open a browser, but it doesn't happen, and there is no error message, just

09:59:34.251 [Thread-98] INFO com.github.simiacryptus.aicoder.actions.BaseAction$Companion -- Opening browser to http://localhost:8081/#G-20241107-nV2T

When I go to localhost:8081, a page loads but the "Running CodeChat Server" background task is still there. (Maybe this is intentional, but it's distracting to have the animated progress bar in the status bar, with no apparent way to stop the server.) However, when I use the UI to send a message, nothing happens (well, the message is cleared and the button becomes "Sending...", and a couple seconds later returns to "Send", and nothing else).

It's not clear if there's anything relevant to that failure in the log, but there is this:

GET /ws?sessionId=[object%20Promise] HTTP/1.1
Host: localhost:8081
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Upgrade: websocket
Origin: http://localhost:8081
Sec-WebSocket-Version: 13
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: en-US,en;q=0.9
Cookie: sb-localhost-auth-token=%5B%22eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNzAyOTI4NDc0LCJpYXQiOjE3MDIzMjM2NzQsImlzcyI6Imh0dHA6Ly8xMjcuMC4wLjE6NTQzMjEvYXV0aC92MSIsInN1YiI6IjAwMGM3NGY4LWE3ZTctNDZkNC1iYmU1LTU0NTllYjMzYjFmMSIsImVtYWlsIjoiZXhhbX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iMWI5ZDI0MzYtY2NlZC00YjgzLWFjMTYtNTdkMTc2ZTc5YTQxIn0.BsusOk397dyb30YPyVYTLj_Y8bZ38jDkCj-XBcOZJuM%22%2C%22thiPnBLQb-nc7nFhUx8HnQ%22%2Cnull%2Cnull%2Cnull%5D
Sec-WebSocket-Key: dxwf6nDamZ2pyro+bUDytg==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits


10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.HttpChannelOverHttp -- upgrade HttpChannelOverHttp@13777c45{s=HttpChannelState@34c7a621{s=IDLE rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0},r=1,c=false/false,a=IDLE,uri=http://localhost:8081/ws?sessionId=[object%20Promise],age=0} Upgrade: websocket
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.HttpChannelOverHttp -- No factory for Upgrade: websocket in ServerConnector@2b8b1e9f{HTTP/1.1, (http/1.1)}{localhost:8081}
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.HttpConnection -- HttpConnection@7e5f6e07::SocketChannelEndPoint@60a93f78[{l=/127.0.0.1:8081,r=/127.0.0.1:53284,OPEN,fill=-,flush=-,to=0/30000}{io=0/0,kio=0,kro=1}]->[HttpConnection@7e5f6e07[p=HttpParser{s=CONTENT,0 of -1},g=HttpGenerator@7f9907be{s=START}]=>HttpChannelOverHttp@13777c45{s=HttpChannelState@34c7a621{s=IDLE rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0},r=1,c=false/false,a=IDLE,uri=http://localhost:8081/ws?sessionId=[object%20Promise],age=0}] parsed true HttpParser{s=CONTENT,0 of -1}
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.HttpConnection -- releaseRequestBuffer HttpConnection@7e5f6e07::SocketChannelEndPoint@60a93f78[{l=/127.0.0.1:8081,r=/127.0.0.1:53284,OPEN,fill=-,flush=-,to=0/30000}{io=0/0,kio=0,kro=1}]->[HttpConnection@7e5f6e07[p=HttpParser{s=CONTENT,0 of -1},g=HttpGenerator@7f9907be{s=START}]=>HttpChannelOverHttp@13777c45{s=HttpChannelState@34c7a621{s=IDLE rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0},r=1,c=false/false,a=IDLE,uri=http://localhost:8081/ws?sessionId=[object%20Promise],age=0}]
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.HttpChannel -- handle http://localhost:8081/ws?sessionId=[object%20Promise] HttpChannelOverHttp@13777c45{s=HttpChannelState@34c7a621{s=IDLE rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0},r=1,c=false/false,a=IDLE,uri=http://localhost:8081/ws?sessionId=[object%20Promise],age=0} 
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.HttpChannelState -- handling HttpChannelState@34c7a621{s=IDLE rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0}
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.HttpChannel -- action DISPATCH HttpChannelOverHttp@13777c45{s=HttpChannelState@34c7a621{s=HANDLING rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0},r=1,c=false/false,a=HANDLING,uri=http://localhost:8081/ws?sessionId=[object%20Promise],age=0}
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.Server -- REQUEST GET /ws ?sessionId=[object%20Promise] on HttpChannelOverHttp@13777c45{s=HttpChannelState@34c7a621{s=HANDLING rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0},r=1,c=false/false,a=HANDLING,uri=http://localhost:8081/ws?sessionId=[object%20Promise],age=0}
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.handler.ContextHandler -- scope null||/ws @ o.e.j.w.WebAppContext@268c632c{/,jar:file:/home/nick/.local/share/JetBrains/PyCharm2024.2/intellij-aicoder/lib/webui-1.2.16.jar!/application,AVAILABLE}
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.handler.ContextHandler -- context=||/ws @ o.e.j.w.WebAppContext@268c632c{/,jar:file:/home/nick/.local/share/JetBrains/PyCharm2024.2/intellij-aicoder/lib/webui-1.2.16.jar!/application,AVAILABLE}
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.session.SessionHandler -- Entering scope org.eclipse.jetty.server.session.SessionHandler473811041==dftMaxIdleSec=-1, dispatch=REQUEST asyncstarted=false
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.server.session.SessionHandler -- sessionHandler=org.eclipse.jetty.server.session.SessionHandler473811041==dftMaxIdleSec=-1 session=null
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.servlet.ServletHandler -- servlet |/ws|null|ServletPathMapping{matchValue=ws, pattern=/ws, servletName=SessionProxyServer/ws, mappingMatch=EXACT, servletPath=/ws, pathInfo=null} -> SessionProxyServer/ws==com.simiacryptus.skyenet.webui.chat.ChatServer$WebSocketHandler@78fc3670{jsp=null,order=-1,inst=true,async=true,src=EMBEDDED:null,STARTED}
10:06:09.145 [qtp884780923-205] DEBUG org.eclipse.jetty.servlet.ServletHandler -- chain=Chain@458abe31(com.simiacryptus.skyenet.webui.application.ApplicationServer$$Lambda$7847/0x00000008031d6f28-b993b63==com.simiacryptus.skyenet.webui.application.ApplicationServer$$Lambda$7847/0x00000008031d6f28@b993b63{inst=true,async=true,src=EMBEDDED:null})->ChainEnd@745f3d0a(SessionProxyServer/ws==com.simiacryptus.skyenet.webui.chat.ChatServer$WebSocketHandler@78fc3670{jsp=null,order=-1,inst=true,async=true,src=EMBEDDED:null,STARTED})
10:06:09.146 [qtp884780923-205] DEBUG org.eclipse.jetty.websocket.core.server.WebSocketMappings -- WebSocket Negotiated detected on /ws for endpoint CreatorNegotiator@1f554fa1{org.eclipse.jetty.websocket.server.JettyWebSocketServlet$WrappedJettyCreator@3f800c9b,JettyServerFrameHandlerFactory@21c15697{STARTED}}
10:06:09.146 [qtp884780923-205] DEBUG org.eclipse.jetty.websocket.core.server.internal.AbstractHandshaker -- negotiation RFC6455Negotiation@434a1898{uri=/ws,oe=null,op=null}
10:06:09.146 [qtp884780923-205] DEBUG com.simiacryptus.skyenet.webui.chat.ChatServer -- Error configuring websocket
java.lang.IllegalArgumentException: Invalid session ID: [object Promise]
        at com.simiacryptus.skyenet.core.platform.Session.validateSessionId(Session.kt:55)
        at com.simiacryptus.skyenet.core.platform.Session.<init>(Session.kt:13)
        at com.simiacryptus.skyenet.webui.chat.ChatServer$WebSocketHandler.configure$lambda$1(ChatServer.kt:40)
        at org.eclipse.jetty.websocket.server.JettyWebSocketServlet$WrappedJettyCreator.createWebSocket(JettyWebSocketServlet.java:276)
        at org.eclipse.jetty.websocket.core.server.internal.CreatorNegotiator.lambda$negotiate$0(CreatorNegotiator.java:64)
        at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1448)
        at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1485)
        at org.eclipse.jetty.websocket.core.server.internal.CreatorNegotiator.negotiate(CreatorNegotiator.java:63)
        at org.eclipse.jetty.websocket.core.server.internal.AbstractHandshaker.upgradeRequest(AbstractHandshaker.java:76)
        at org.eclipse.jetty.websocket.core.server.internal.HandshakerSelector.upgradeRequest(HandshakerSelector.java:39)
        at org.eclipse.jetty.websocket.core.server.WebSocketMappings.upgrade(WebSocketMappings.java:241)
        at org.eclipse.jetty.websocket.server.JettyWebSocketServlet.service(JettyWebSocketServlet.java:181)
        at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
        at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
        at com.simiacryptus.skyenet.webui.application.ApplicationServer.configure$lambda$14(ApplicationServer.kt:149)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:598)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
        at org.eclipse.jetty.server.Server.handle(Server.java:563)
        at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
        at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
        at java.base/java.lang.Thread.run(Thread.java:840)

Due to your review, this issue will be closed.

The webserver progress bar can indeed be cancelled, which is why it is there. The cancel button doesn't render correctly, but that's a larger intellij issue. However, feedback taken; it is probably time to promote this to a dedicated ui element. Thank you for the feedback.

As far as the specific issue you are seeing, it looks like you are opening the page with the wrong session id (the json bookmark). I will look at improving this ui to track current/previous sessions.

Fixed in pending release 1.8.4