Bring a large pot of salted water to a boil. Add green beans and cook until tender, about 3 minutes. Remove from boiling water with a slotted spoon and run under cold water to stop the cooking; set aside.
Add pasta to the same boiling water and cook until al dente. Drain and rinse under cold water.
In a large bowl, whisk together vinegar, garlic, 1/2 teaspoon salt, and sugar, if using. Whisk in the oil in a steady stream, and season with 1/4 teaspoon black pepper.
Add celery, peas or beans, and green beans to the vinaigrette, then add pasta and toss well to combine. Let pasta salad marinate for at least 1 hour.
Just before serving, stir in shredded basil. Season to taste with salt and pepper.