Giter VIP home page Giter VIP logo

Comments (14)

phodal avatar phodal commented on June 20, 2024

如果只是上述的代码,我测试了一下,应该只会执行一次。估计,可能受什么代码影响 —— Agent 回传。

from auto-dev.

phodal avatar phodal commented on June 20, 2024

应该还是执行多次导致的,能提交一个复现的步骤吗。我这边除非手动点多次执行,要不无法复现。

from auto-dev.

ymli0215 avatar ymli0215 commented on June 20, 2024

我目前測試起來,一樣的prompt,一樣的agent
剛開啟intellij的時候,就只寫一次
接著再跑一次相同的agent,就會重複寫了(這時候為了好分辨,我是把產生檔案的內容清空,再跳個幾行,比較清楚辨認)

感覺起來就像是前一次的資料還留著
跑第一次,就出現一次內容
跑第二次,會出現兩次內容
跑第三次,會出現三次內容
...

from auto-dev.

phodal avatar phodal commented on June 20, 2024

应该是重复多次,执行的缘故。

from auto-dev.

ymli0215 avatar ymli0215 commented on June 20, 2024

目前看起來是這樣,寫入資料的時候,intellij他會跳出 Writing to file:xxxx 的訊息
的確是執行多次就會跳出多次

from auto-dev.

ymli0215 avatar ymli0215 commented on June 20, 2024

重複測試了一下,這應該就原本就有的問題
只是我加上了L1-L2這樣才比較明顯出現
原本沒有設定L1-L2,其實也是有重複執行,但是它就是取代整個檔案,所以就沒有感覺到重複的問題
但是intellij會跳出多個 Writing to file: 的訊息視窗,這其實就表示 WriteInsCommand 被執行多次

from auto-dev.

phodal avatar phodal commented on June 20, 2024

估计有可能是之前那个处理 Agent 返回继续处理引起的

from auto-dev.

ymli0215 avatar ymli0215 commented on June 20, 2024

追蹤起來,好像是DevInsProgramRunner的

override fun runFinish(string: String, event: ProcessEvent, scriptPath: String) {
                environment.project.service<DevInsProcessProcessor>().process(string, event, scriptPath)
}

被執行好幾次....

這跟Agent的調整有關係嗎??

from auto-dev.

phodal avatar phodal commented on June 20, 2024

调用的地方应该是 DevInsRunConfigurationProfileState,看上去 processTerminated 被调用了多次?

from auto-dev.

ymli0215 avatar ymli0215 commented on June 20, 2024

DevInsRunConfigurationProfileState的processTerminated只送了一次message
但是DevInsProgramRunner的connection.subscribe那邊收到多次message
因此觸發寫多次的寫入

我加了一個追蹤的參數來確認,DevInsProgramRunner收到的多次message都是由DevInsRunConfigurationProfileState發出來
ProcessEvent都是同一個...

from auto-dev.

phodal avatar phodal commented on June 20, 2024

你清空一下右下角的 idea 告警试试,我本地会出现一个错误:

java.lang.Exception: error when processing com.intellij.execution.process.ProcessEvent[source={processTerminatedListener=com.intellij.execution.process.ProcessTerminatedListener@325de1f6}] by class cc.unitmesh.devti.language.run.DevInsRunConfigurationProfileState$execute$1
	at com.intellij.execution.process.ProcessHandler$2.processTerminated(ProcessHandler.java:268)
	at com.intellij.execution.process.ProcessHandler.lambda$notifyTerminated$2(ProcessHandler.java:207)
	at com.intellij.execution.process.ProcessHandler$TasksRunner.execute(ProcessHandler.java:325)
	at com.intellij.execution.process.ProcessHandler.notifyTerminated(ProcessHandler.java:190)
	at com.intellij.execution.process.ProcessHandler.notifyProcessTerminated(ProcessHandler.java:186)
	at cc.unitmesh.devti.language.run.DevInsProcessHandler.detachProcessImpl(DevInsProcessHandler.kt:9)
	at com.intellij.execution.process.ProcessHandler.lambda$detachProcess$1(ProcessHandler.java:143)
	at com.intellij.execution.process.ProcessHandler$TasksRunner.execute(ProcessHandler.java:325)
	at com.intellij.execution.process.ProcessHandler.detachProcess(ProcessHandler.java:140)
	at cc.unitmesh.devti.language.run.DevInsRunConfigurationProfileState$agentRun$1$1.invokeSuspend(DevInsRunConfigurationProfileState.kt:152)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by: java.lang.RuntimeException: Cannot invoke (class=, method=runFinish, topic=DevInsRunListener)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:677)
	at com.intellij.util.messages.impl.MessageBusImplKt.deliverMessage(MessageBusImpl.kt:423)
	at com.intellij.util.messages.impl.MessageBusImplKt.pumpWaiting(MessageBusImpl.kt:402)
	at com.intellij.util.messages.impl.MessageBusImplKt.access$pumpWaiting(MessageBusImpl.kt:1)
	at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:461)
	at jdk.proxy32/jdk.proxy32.$Proxy343.runFinish(Unknown Source)
	at cc.unitmesh.devti.language.run.DevInsRunConfigurationProfileState$execute$1.processTerminated(DevInsRunConfigurationProfileState.kt:57)
	at com.intellij.execution.process.ProcessHandler$2.processTerminated(ProcessHandler.java:262)

from auto-dev.

phodal avatar phodal commented on June 20, 2024

复现了,应该是 topic 没有 unsubscribe 导致的,只有多次执行 agent 才会出现。

from auto-dev.

ymli0215 avatar ymli0215 commented on June 20, 2024

對 我剛剛也測試到這段,我是加了一個是否已經subscribe的判斷
如果有subscribe就不做原有的動作

from auto-dev.

phodal avatar phodal commented on June 20, 2024

哦,那我就不改了,你直接来 PR ?

from auto-dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.