Agent Executor (AX) is Google's open agentic orchestration runtime
Go
Remove redundant attached field and use cmd nil-check
JBD20760f4e3df6
diff --git a/internal/pythonsidecar/sidecar.go b/internal/pythonsidecar/sidecar.goindex 504302b..5264e54 100644--- a/internal/pythonsidecar/sidecar.go+++ b/internal/pythonsidecar/sidecar.go@@ -60,7 +60,6 @@ type Sidecar struct {mu sync.Mutexcmd *exec.Cmdpid int- attached boolstopping boolexitErr errordoneChan chan struct{}@@ -158,8 +157,8 @@ func (s *Sidecar) Start(ctx context.Context, pythonPath string) error {if readyErr == nil {// Existing process is alive and working!s.mu.Lock()+ s.cmd = nils.pid = existingPID- s.attached = trues.stopping = falses.exitErr = nils.doneChan = make(chan struct{})@@ -222,7 +221,6 @@ func (s *Sidecar) Start(ctx context.Context, pythonPath string) error {s.cmd = cmds.pid = cmd.Process.Pid- s.attached = falses.stopping = falses.exitErr = nils.doneChan = make(chan struct{})@@ -252,11 +250,10 @@ func (s *Sidecar) monitor() {s.mu.Lock()cmd := s.cmdpid := s.pid- attached := s.attacheds.mu.Unlock()var exitErr error- if attached {+ if cmd == nil {ticker := time.NewTicker(500 * time.Millisecond)defer ticker.Stop()@@ -274,7 +271,7 @@ func (s *Sidecar) monitor() {break}}- } else if cmd != nil {+ } else {err := cmd.Wait()s.mu.Lock()stopping := s.stopping@@ -372,12 +369,11 @@ func (s *Sidecar) Stop() error {done := s.doneChancmd := s.cmdpid := s.pid- attached := s.attacheds.mu.Unlock()defer cleanPID(pid)- if attached {+ if cmd == nil {if proc, err := os.FindProcess(pid); err == nil {_ = proc.Signal(syscall.SIGTERM)}