Skip to content

Fix plan delegate harness cleanup#4537

Merged
asim merged 1 commit into
masterfrom
codex/increment-4536
Jul 10, 2026
Merged

Fix plan delegate harness cleanup#4537
asim merged 1 commit into
masterfrom
codex/increment-4536

Conversation

@asim

@asim asim commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary:

  • Let agent Stop unblock Run so plan/delegate test agents terminate cleanly.
  • Start plan/delegate harness services non-blockingly and stop them explicitly after each run.

Testing:

  • go build ./...
  • go test ./... (fails here because the environment routes loopback gRPC through an envoy that forbids loopback targets, and atlascloud stream credentials return 400)
  • golangci-lint run ./...
  • go test -v -race -cover ./internal/harness/plan-delegate -count=1 -timeout=60s

Closes #4527
Closes #4536

@asim asim added the codex label Jul 10, 2026
Copilot AI review requested due to automatic review settings July 10, 2026 04:00
@asim asim added the codex label Jul 10, 2026
@asim
asim merged commit 4faafdf into master Jul 10, 2026
10 checks passed
@asim
asim deleted the codex/increment-4536 branch July 10, 2026 04:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets the internal/harness/plan-delegate test/harness hangs by tightening lifecycle management: services are started non-blockingly and explicitly stopped, and agents are updated so Stop() can unblock a goroutine running Run().

Changes:

  • Replace go svc.Run() with svc.Start() + explicit defer svc.Stop() for plan/delegate harness services to avoid leaving service goroutines running between tests/runs.
  • Add an agentImpl.stopCh so Stop() can signal Run() to return instead of parking forever.
  • Apply the same service lifecycle changes to plan/delegate end-to-end tests to reduce cross-test leakage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
internal/harness/plan-delegate/main.go Start task/notify services non-blockingly and ensure they are stopped after each harness run.
internal/harness/plan-delegate/main_test.go Mirror the harness lifecycle changes in tests to prevent leaked service goroutines.
agent/agent.go Add a stop signal channel so Stop() can unblock Run() for cleaner harness/test shutdown.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agent/agent.go
Comment on lines +548 to +552
stopCh := make(chan struct{})
a.mu.Lock()
a.stopCh = stopCh
a.mu.Unlock()

Comment thread agent/agent.go
Comment on lines +574 to 576
<-stopCh
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loop: build increment #171 Fix plan-delegate duplicate-delegate replay test hang

3 participants