Repository navigation
Conversation
## Changes
When auto-install catches a signal, the CLI now records its state and then ends by that signal. Before, it swallowed the signal and exited 0.
```diff
autoInstall (after a command succeeded)
gate lookup catches SIGINT, SIGTERM, +SIGHUP
record the version as a failed lookup
+ raise(sig)
ask "Install Databricks AI tools ...? [Y/n]" catches SIGINT
settle the version as unanswered
+ raise(sig)
```
- `cmd/aitools/autoinstall_run.go`: `notifyInterrupt` now takes the signals to catch, and its stop function returns the signal it caught, or nil. The gate lookup and the install question both use it. After the state is saved, they call `raise(sig)`. A signal that arrives right after an answer, or after an interrupted lookup still answered from a cached manifest, also counts as a stop. The gate lookup now catches SIGHUP as well.
- `libs/process`: new `Raise(sig)`. On Unix it sends `sig` to the current process and waits up to a second for it to take effect. It returns only if the signal does not end the process, for example SIGHUP under `nohup`. On other platforms it does nothing. `BackgroundInGroup` now uses `Raise`, and it also forwards SIGHUP, so closing the terminal stops a coding agent's CLI while it installs its plugin.
- Changelog fragment under `.nextchanges/cli/`.
## Why
A shell stops a script, a loop or an `&&` list only when the command ends by the signal. A command that catches Ctrl-C and exits 0 lets the script carry on. Auto-install runs after a command has already succeeded. So Ctrl-C at the install question, or while the gate is being looked up, let the rest of the script run, even though Ctrl-C at any other point in the command would have stopped it. The CLI still saves the answer, or the failed lookup, before it ends, so the next command neither asks again nor repeats the lookup.
## Tests
- `TestAutoInstallEndsByTheSignal` (Unix): runs the hook in a helper process and signals it at the question (SIGINT) and during the gate lookup (SIGINT, SIGTERM, SIGHUP). It checks that the helper ends by that exact signal and that the state on disk is already recorded.
- `TestAutoInstallStopsWhenTheGateLookupIsInterrupted`: checks which signals are caught and that `raise` runs only after the version is recorded.
- `TestNotifyInterruptWithoutASignal`: stopping with no signal returns nil.
- `TestRaiseEndsTheProcessBySignal` and `TestRaiseReturnsWhenTheSignalIsIgnored` in `libs/process`.
- `TestBackgroundInGroupForwardsInterrupt` now covers SIGHUP as well as SIGINT.
Co-authored-by: Isaac <no-reply@databricks.com>
anton-107
requested review from
louis-johnston-db,
maksim-zuev-db and
simonfaltum
and removed request for
maksim-zuev-db
November 21, 2026 11:50
Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Automated review at 724c961. Each finding was verified against the code.
No blocking issues found.
The PR makes auto-install end by the caught signal (via Raise) instead of exiting 0, so that Unix shells stop the enclosing script. It also adds SIGHUP handling to BackgroundInGroup. The implementation is correct: notifyInterrupt synchronizes properly through the done channel, Raise produces a true signal death that shells distinguish from a normal exit, and the non-Unix no-op is documented and matches the unchanged base behavior on those platforms. Tests cover the key scenarios. No defects found.
Collaborator
✅ Integration test reportCommit: c5e1c6c
Top 4 slowest tests (at least 2 minutes):
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
When auto-install catches a signal, the CLI now records its state and then ends by that signal. Before, it swallowed the signal and exited 0.
autoInstall (after a command succeeded) gate lookup catches SIGINT, SIGTERM, +SIGHUP record the version as a failed lookup + raise(sig) ask "Install Databricks AI tools ...? [Y/n]" catches SIGINT settle the version as unanswered + raise(sig)cmd/aitools/autoinstall_run.go:notifyInterruptnow takes the signals to catch, and its stop function returns the signal it caught, or nil. The gate lookup and the install question both use it. After the state is saved, they callraise(sig). A signal that arrives right after an answer, or after an interrupted lookup still answered from a cached manifest, also counts as a stop. The gate lookup now catches SIGHUP as well.libs/process: newRaise(sig). On Unix it sendssigto the current process and waits up to a second for it to take effect. It returns only if the signal does not end the process, for example SIGHUP undernohup. On other platforms it does nothing.BackgroundInGroupnow usesRaise, and it also forwards SIGHUP, so closing the terminal stops a coding agent's CLI while it installs its plugin..nextchanges/cli/.Why
A shell stops a script, a loop or an
&&list only when the command ends by the signal. A command that catches Ctrl-C and exits 0 lets the script carry on. Auto-install runs after a command has already succeeded. So Ctrl-C at the install question, or while the gate is being looked up, let the rest of the script run, even though Ctrl-C at any other point in the command would have stopped it. The CLI still saves the answer, or the failed lookup, before it ends, so the next command neither asks again nor repeats the lookup.Tests
TestAutoInstallEndsByTheSignal(Unix): runs the hook in a helper process and signals it at the question (SIGINT) and during the gate lookup (SIGINT, SIGTERM, SIGHUP). It checks that the helper ends by that exact signal and that the state on disk is already recorded.TestAutoInstallStopsWhenTheGateLookupIsInterrupted: checks which signals are caught and thatraiseruns only after the version is recorded.TestNotifyInterruptWithoutASignal: stopping with no signal returns nil.TestRaiseEndsTheProcessBySignalandTestRaiseReturnsWhenTheSignalIsIgnoredinlibs/process.TestBackgroundInGroupForwardsInterruptnow covers SIGHUP as well as SIGINT.