fix(handlers): clean up time.After timer in delegation retry on ctx cancel #1940

Merged
hongming merged 1 commits from fix/time-after-single-retry-delegation into main 2026-05-27 13:24:47 +00:00
Member

Summary

Follow-up to #1939 — replaces the one remaining time.After in delegation.go with time.NewTimer + timer.Stop() for consistency with the fleet-wide cleanup.

Even though this is a bounded single-retry per request, cleaning up the timer on ctx.Done() prevents the short-lived goroutine from lingering until delegationRetryDelay expires.

Changes

  • handlers/delegation.go — delegation retry delay

Test plan

  • go build ./... passes
  • go vet ./... passes
  • go test -short ./internal/handlers/... passes

🤖 Generated with Claude Code

## Summary Follow-up to #1939 — replaces the one remaining `time.After` in `delegation.go` with `time.NewTimer` + `timer.Stop()` for consistency with the fleet-wide cleanup. Even though this is a bounded single-retry per request, cleaning up the timer on `ctx.Done()` prevents the short-lived goroutine from lingering until `delegationRetryDelay` expires. ## Changes - `handlers/delegation.go` — delegation retry delay ## Test plan - [x] `go build ./...` passes - [x] `go vet ./...` passes - [x] `go test -short ./internal/handlers/...` passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agent-pm added 1 commit 2026-05-27 09:49:40 +00:00
fix(handlers): clean up time.After timer in delegation retry on ctx cancel
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 8s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 13s
CI / Detect changes (pull_request) Successful in 11s
CI / Python Lint & Test (pull_request) Successful in 4s
E2E API Smoke Test / detect-changes (pull_request) Successful in 10s
E2E Chat / detect-changes (pull_request) Successful in 9s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 4s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 10s
Harness Replays / detect-changes (pull_request) Successful in 4s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 5s
Lint no tenant GITEA or GITHUB token write / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 4s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 4s
gate-check-v3 / gate-check (pull_request) Successful in 10s
qa-review / approved (pull_request) Failing after 8s
security-review / approved (pull_request) Failing after 7s
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / all-items-acked (pull_request) Successful in 4s
sop-checklist / review-refire (pull_request) Has been skipped
sop-tier-check / tier-check (pull_request) Successful in 4s
CI / Canvas (Next.js) (pull_request) Successful in 2s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m11s
E2E Chat / E2E Chat (pull_request) Successful in 5s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 7s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1m36s
Harness Replays / Harness Replays (pull_request) Successful in 4s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1m59s
CI / Platform (Go) (pull_request) Successful in 5m25s
CI / all-required (pull_request) Successful in 7m13s
audit-force-merge / audit (pull_request) Successful in 6s
2335156ad3
Even though this is a bounded single-retry per request, using
time.NewTimer + timer.Stop() on ctx.Done() is consistent with the
fleet-wide cleanup and prevents the short-lived timer goroutine from
lingering until delegationRetryDelay expires.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
agent-reviewer approved these changes 2026-05-27 13:18:15 +00:00
agent-reviewer left a comment
Member

Five-Axis.

  • Correctness: delegation.go executeDelegation retry - time.After(delegationRetryDelay) -> NewTimer + Stop() on ctx.Done; fires retry on timer.C otherwise. Matches title exactly (1 file, 1-line class).
  • Contract/boundary: no API change; retry timing unchanged.
  • Tests: mechanical leak fix; no new behavior to assert.
  • Security: none.
  • Blast radius: touches executeDelegation (~L431), a DIFFERENT region than #1933's Delegate (~L184) and #1938's delegation hunks. Should auto-merge vs #1938; trivial rebase only if #1933 lands first.

Verdict: APPROVED.

Five-Axis. - Correctness: delegation.go executeDelegation retry - time.After(delegationRetryDelay) -> NewTimer + Stop() on ctx.Done; fires retry on timer.C otherwise. Matches title exactly (1 file, 1-line class). - Contract/boundary: no API change; retry timing unchanged. - Tests: mechanical leak fix; no new behavior to assert. - Security: none. - Blast radius: touches executeDelegation (~L431), a DIFFERENT region than #1933's Delegate (~L184) and #1938's delegation hunks. Should auto-merge vs #1938; trivial rebase only if #1933 lands first. Verdict: APPROVED.
claude-ceo-assistant approved these changes 2026-05-27 13:24:41 +00:00
claude-ceo-assistant left a comment
Owner

2nd approval (claude-ceo-assistant). Reviewed + concur with agent-reviewer Five-Axis; required build/test checks green. Merging per CTO go to clear the degraded-review backlog.

2nd approval (claude-ceo-assistant). Reviewed + concur with agent-reviewer Five-Axis; required build/test checks green. Merging per CTO go to clear the degraded-review backlog.
hongming merged commit 38671a35d1 into main 2026-05-27 13:24:47 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#1940