Repository navigation
aitools: look the auto-install gate up once per version, and not without agents - #7756
Conversation
…out agents A machine that cannot reach the compatibility manifest waited for the gate lookup after each of the first 10 commands of a CLI version, and a machine whose home directory keeps no state waited on every run. - A failed lookup is not repeated for the version. - A machine with no coding agent does not look the gate up. - The lookup is bounded by 1 s instead of 3 s. - Ctrl+C or SIGTERM during the lookup ends the lookup, not the command. Co-authored-by: Isaac <no-reply@databricks.com>
|
Commit: Regression test reportSelected 1 changed tests (limit=20, 0 not selected) 1 tests: regression=1 unreleased=0 coverage=0 failing=0
TestAccept/cmd/aitools/auto-install/skipped: branch ✅ | main (0f6d067) ❌ | latest (v1.26.0) ❌main (0f6d067): latest (v1.26.0): |
✅ Integration test reportCommit: 9a8c9d8
Top 3 slowest tests (at least 2 minutes):
|
simonfaltum
left a comment
There was a problem hiding this comment.
Approving with the expectation that the cancellation issue below is addressed before merging.
This review was generated with GitHub MCP.
| // Ctrl+C or a request to terminate ends the lookup instead of killing | ||
| // a command that succeeded. | ||
| gateCtx, stop := signal.NotifyContext(gateCtx, os.Interrupt, syscall.SIGTERM) | ||
| in.GateOn, err = gateOn(gateCtx, version) |
There was a problem hiding this comment.
With a stale cached manifest containing auto_install: true, Ctrl+C/SIGTERM cancels gateCtx, but clicompat.fetchManifest falls back to the stale cache and returns success. gateOn then returns (true, nil), so this proceeds to a prompt or installation using the uncanceled parent ctx after the user asked it to stop. Please check cancellation before stop()/cancel() and exit auto-install when interrupted, and add a regression test for the stale-cache case.
There was a problem hiding this comment.
Fixed in 9a8c9d8. The signal context is now separate from the timeout, and a lookup that answers after an interrupt is treated like a failed one: the run ends before any prompt or install, and the version gets no other lookup. TestAutoInstallStopsWhenTheGateLookupIsInterrupted covers the case where the lookup returns the gate on after the interrupt, and fails without the fix.
An interrupted lookup could still resolve the gate from a stale cached manifest and go on to prompt or install. Co-authored-by: Isaac <no-reply@databricks.com>
Changes
The auto-install hook resolves its remote gate with one compatibility manifest fetch after a command succeeded. This PR bounds what that fetch costs a machine that cannot reach the manifest:
Why
On a network that drops traffic to
raw.githubusercontent.com(no internet egress, a firewall, a proxy that never answers), each of the first 10 commands of a version waited 3 s after it had printed its output. A container or job whose home directory is not kept waited on every run, because the attempt count is never stored. A script wrapping a command intimeout 2failed with 124, and Ctrl+C during the wait turned a successful command into exit 130.Behavior change to review: with the gate on, a machine without a coding agent no longer reports
SKIPPED_NO_AGENTSand no longer settles the version, since it never learns the gate.No changelog fragment: the lookup has no user-facing entry of its own.
Tests
acceptance/cmd/aitools/auto-install/skippedupdated for the no-agents case.HTTPS_PROXYpointing at a listener that never answers, three consecutive commands in a fresh home:timeout 2 databricks ...SIGINT 0.5 s into the wait: the command exits 0 at once and the next command does not wait.
This pull request and its description were written by Isaac.