fix(binarymgr): bound registry lookups and stamp failed update checks

What does this MR do and why?

When gitlab.com is unreachable, glab orbit hangs for about 3 to 7 minutes before it starts the managed binary. This caps package-registry lookups at 15 seconds and records failed update checks, so the timeout is paid once a day instead of on every run. The same applies to glab duo cli, which shares the managed-binary layer.

How to set up and validate locally

  1. Block outbound TCP to gitlab.com (drop, not reject).
  2. Run glab orbit with a fresh GLAB_CONFIG_DIR and --yes.
  3. It should fail after about 15 s, not about 194 s.
Agent context
  • Registry metadata lookups (CheckForUpdate and fetchPackageAsset) get a 15 s context deadline. The binary download itself is unbounded.
  • CheckForUpdate returns NewCheckTime on a failed lookup, and performUpdateCheck saves it before returning the error.
  • Run stamps last_update_check after a fresh download, so the follow-up update check is skipped.
  • Measured on a blackholed network: fresh install 194 s to 17 s, stale update check 406 s to 37 s (two invocations).
  • Registry listing requests 100 packages per page, so the shared 15 s budget covers fewer round trips. A deadline error reads "package registry did not respond within 15s".
  • Tests: runner tests for the stamp on a failed check and after a fresh download, and manager tests for the deadline on both lookups, the error text and the page size. go test ./internal/binarymgr/... ./internal/commands/orbit/... and golangci-lint pass.
  • Not done: moving the update check off the exec path.
Edited by Dmitry Gruzd

Merge request reports

Loading
Loading