From 899ca015b109c8f053c02fb16d7b71efe87f4e0e Mon Sep 17 00:00:00 2001 From: logikonline Date: Sun, 25 Jan 2026 13:51:47 -0500 Subject: [PATCH] fix(poll): revert context inheritance to prevent deadlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v1.0.3 change that made poller contexts inherit from the parent context caused a deadlock where runners would start but never poll for tasks. Reverted to using context.Background() for pollingCtx and jobsCtx. Graceful shutdown still works via explicit Shutdown() call which cancels the polling context. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/app/cmd/daemon.go | 2 +- internal/app/poll/poller.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/app/cmd/daemon.go b/internal/app/cmd/daemon.go index 2578c44..0c31c42 100644 --- a/internal/app/cmd/daemon.go +++ b/internal/app/cmd/daemon.go @@ -218,7 +218,7 @@ func runDaemon(ctx context.Context, daemArgs *daemonArgs, configFile *string) fu } }() - poller := poll.New(ctx, cfg, cli, runner) + poller := poll.New(cfg, cli, runner) poller.SetBandwidthManager(bandwidthManager) if daemArgs.Once || reg.Ephemeral { diff --git a/internal/app/poll/poller.go b/internal/app/poll/poller.go index 2d9efaf..7a77b64 100644 --- a/internal/app/poll/poller.go +++ b/internal/app/poll/poller.go @@ -40,11 +40,11 @@ type Poller struct { done chan struct{} } -// New creates a new Poller instance with the given context for shutdown propagation. -func New(ctx context.Context, cfg *config.Config, client client.Client, runner *run.Runner) *Poller { - // Inherit from parent context so shutdown signals propagate properly - pollingCtx, shutdownPolling := context.WithCancel(ctx) - jobsCtx, shutdownJobs := context.WithCancel(ctx) +// New creates a new Poller instance. +func New(cfg *config.Config, client client.Client, runner *run.Runner) *Poller { + // Use independent contexts - shutdown is handled explicitly via Shutdown() + pollingCtx, shutdownPolling := context.WithCancel(context.Background()) + jobsCtx, shutdownJobs := context.WithCancel(context.Background()) done := make(chan struct{})