Skip to content

Stop a solve when its context ends - #96

Merged
jonyoder merged 1 commit into
mainfrom
solve-interrupt
Nov 14, 2026
Merged

jonyoder merged 1 commit into
mainfrom
solve-interrupt

Conversation

@jonyoder

Copy link
Copy Markdown
Collaborator

Bumps go-pubgrub to v0.6.0 and sets Solver.Interrupt = ctx.Err where resolveOnce builds each solver, so a solve stops when its context is cancelled or times out (rstudio/package-manager#22613). The error comes back unwrapped by explain, so errors.Is(err, context.DeadlineExceeded), context.Canceled and solver.ErrInterrupted all match from resolver.Resolve.


Where the solver is built

resolver.resolveOnce is the only solver.New call outside tests. It covers the first solve, every YankExemptTransitivePins re-solve in its loop, and every UpgradeRoots re-solve (upgradeRoots calls resolveOnce). A cancel during the UpgradeRoots pass still returns the first answer with no error, as before; the re-solve now stops right away.

Tests

New resolver/interrupt_test.go, with an index that ignores the context so only the solver's check can see a cancel:

  • expired deadline: Resolve returns at once, errors.Is matches DeadlineExceeded and ErrInterrupted, not a ResolutionError
  • cancel mid-solve: errors.Is(err, context.Canceled)
  • cancel as an UpgradeRoots re-solve starts: that re-solve makes no decision past the root; base answer returned

All three fail with the Interrupt line removed. go test ./... passes; vet and gofmt clean.

Independence audit

PASS: no retrieval of a known reference implementation in 222 session(s). (after agentsview sync, --paths on this worktree and this session's scratchpad). It also lists the same 2 cross-repo risk entries as go-pubgrub#26 (agent-a63f03d8042244b81, downloading a uv release binary on a dogfood host); not from this work.

Clean-room: written from go-pyresolver and go-pubgrub code only; no uv or pubgrub-rs source read.

RoboRev job 5245 on 3435110: no findings.

🤖 Generated with Claude Code

Adopt go-pubgrub v0.6.0 and set Solver.Interrupt to ctx.Err.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonyoder
jonyoder merged commit 484ca12 into main Nov 14, 2026
2 checks passed
@jonyoder
jonyoder deleted the solve-interrupt branch November 14, 2026 01:17
This was referenced Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant