fix(codeagent-wrapper): add timeout for Windows process termination

- Add forceKillWaitTimeout (5s) to prevent cmd.Wait() blocking forever
- Enhance sendTermSignal with killProcessTree fallback using wmic
- Update omo README: remove sisyphus, fix model names, update config

Fixes #115

Generated with SWE-Agent.ai

Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
cexll
2026-01-14 10:43:25 +08:00
parent 4395c5785d
commit 8f05626075
3 changed files with 129 additions and 22 deletions

View File

@@ -17,6 +17,7 @@ import (
)
const postMessageTerminateDelay = 1 * time.Second
const forceKillWaitTimeout = 5 * time.Second
// commandRunner abstracts exec.Cmd for testability
type commandRunner interface {
@@ -1109,7 +1110,8 @@ func runCodexTaskWithContext(parentCtx context.Context, taskSpec TaskSpec, backe
waitLoop:
for {
select {
case waitErr = <-waitCh:
case err := <-waitCh:
waitErr = err
break waitLoop
case <-ctx.Done():
ctxCancelled = true
@@ -1120,8 +1122,17 @@ waitLoop:
terminated = true
}
}
waitErr = <-waitCh
break waitLoop
for {
select {
case err := <-waitCh:
waitErr = err
break waitLoop
case <-time.After(forceKillWaitTimeout):
if proc := cmd.Process(); proc != nil {
_ = proc.Kill()
}
}
}
case <-messageTimerCh:
forcedAfterComplete = true
messageTimerCh = nil
@@ -1135,8 +1146,17 @@ waitLoop:
// Close pipes to unblock stream readers, then wait for process exit.
closeWithReason(stdout, "terminate")
closeWithReason(stderr, "terminate")
waitErr = <-waitCh
break waitLoop
for {
select {
case err := <-waitCh:
waitErr = err
break waitLoop
case <-time.After(forceKillWaitTimeout):
if proc := cmd.Process(); proc != nil {
_ = proc.Kill()
}
}
}
case <-completeSeen:
completeSeenObserved = true
if messageTimer != nil {