Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

- **Fixed** After Ctrl+C, a task exiting with a non-zero code (like 130) no longer makes `vp run` kill the other tasks while they're still shutting down ([#1024](https://github.com/voidzero-dev/vite-task/pull/1024)).
- **Fixed** Remote cache operations now cap concurrent uploads to 4 per endpoint, use pooled HTTP/1.1 connections instead of multiplexing all reads and uploads over one HTTP/2 connection, retry transient `5xx`/`429`/`408` and network failures with jittered backoff, and back off briefly during sustained endpoint outages, preventing `503` upload bursts and Windows connection-reset drops ([#1016](https://github.com/voidzero-dev/vite-task/pull/1016)).
- **Fixed** Tasks that list `node_modules`, the workspace root, or `node_modules/.vite` no longer miss the cache when pnpm's `node_modules/.pnpm-workspace-state-*.json`, Vite's `node_modules/.vite-temp`, the workspace root's `.git`, or the task cache directory appear or disappear. Direct accesses to `node_modules/.vite-temp` and `.DS_Store` are now skipped as well, so they are neither tracked as inputs nor archived as outputs ([#1014](https://github.com/voidzero-dev/vite-task/pull/1014)).
- **Fixed** When a command handler sets a working directory for a command it generates, `vp run` now runs that command in the selected directory and includes the directory in its cache fingerprint ([#1005](https://github.com/voidzero-dev/vite-task/pull/1005)).
Expand Down
2 changes: 1 addition & 1 deletion crates/vt/src/session/execute/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl ExecutionContext<'_> {
}
};
tracing::debug!(failed, elapsed = ?start.elapsed(), "finished the task item");
if failed {
if failed && !self.cancel_token.is_cancelled() {
self.fast_fail_token.cancel();
}
}
Expand Down
11 changes: 9 additions & 2 deletions crates/vt_bin/src/vtt/exit_on_ctrlc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use std::sync::Arc;
///
/// Sets up a Ctrl+C handler, emits a "ready" milestone, then waits.
/// When Ctrl+C is received, prints "ctrl-c received" and exits.
pub fn run() -> Result<(), Box<dyn std::error::Error>> {
pub fn run(args: &[String]) -> Result<(), Box<dyn std::error::Error>> {
let cleanup_ms: u64 = args.first().map(|s| s.parse()).transpose()?.unwrap_or(0);
let exit_code: i32 = args.get(1).map(|s| s.parse()).transpose()?.unwrap_or(0);

// On Windows, an ancestor process (e.g. cargo, the test harness) may have
// been created with CREATE_NEW_PROCESS_GROUP, which implicitly calls
// SetConsoleCtrlHandler(NULL, TRUE) and sets CONSOLE_IGNORE_CTRL_C in the
Expand Down Expand Up @@ -40,5 +43,9 @@ pub fn run() -> Result<(), Box<dyn std::error::Error>> {

ctrlc_once_lock.wait();
println!("ctrl-c received");
Ok(())
if cleanup_ms > 0 {
std::thread::sleep(std::time::Duration::from_millis(cleanup_ms));
println!("cleanup done");
}
std::process::exit(exit_code);
}
2 changes: 1 addition & 1 deletion crates/vt_bin/src/vtt/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn main() {
}
"cp" => cp::run(&args[2..]),
"exit" => exit::run(&args[2..]),
"exit-on-ctrlc" => exit_on_ctrlc::run(),
"exit-on-ctrlc" => exit_on_ctrlc::run(&args[2..]),
"fs" => fs::run(&args[2..]),
"grep-file" => {
grep_file::run(&args[2..]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "ctrl-c-parallel-cleanup-test",
"private": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@ctrl-c-parallel-cleanup/a",
"scripts": {
"dev": "vtt exit-on-ctrlc 0 130"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@ctrl-c-parallel-cleanup/b",
"scripts": {
"dev": "vtt exit-on-ctrlc 1000"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- packages/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[[e2e]]
name = "ctrl_c_lets_parallel_tasks_finish_cleanup"
comment = """
Ctrl+C with two parallel tasks: a exits 130 immediately, b takes a second to clean up. b shouldn't get killed when a exits.
"""
steps = [
{ argv = [
"vt",
"run",
"-r",
"--parallel",
"--no-cache",
"dev",
], interactions = [
{ "expect-milestone" = "ready" },
{ "expect-milestone" = "ready" },
{ "write-key" = "ctrl-c" },
] },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ctrl_c_lets_parallel_tasks_finish_cleanup

Ctrl+C with two parallel tasks: a exits 130 immediately, b takes a second to clean up. b shouldn't get killed when a exits.

## `vt run -r --parallel --no-cache dev`

**Exit code:** 130

**→ expect-milestone:** `ready`

```
~/packages/a$ vtt exit-on-ctrlc 0 130 ⊘ cache disabled
~/packages/b$ vtt exit-on-ctrlc 1000 ⊘ cache disabled
```

**→ expect-milestone:** `ready`

```
~/packages/a$ vtt exit-on-ctrlc 0 130 ⊘ cache disabled
~/packages/b$ vtt exit-on-ctrlc 1000 ⊘ cache disabled
```

**← write-key:** `ctrl-c`

```
~/packages/a$ vtt exit-on-ctrlc 0 130 ⊘ cache disabled
~/packages/b$ vtt exit-on-ctrlc 1000 ⊘ cache disabled
ctrl-c received
ctrl-c received

cleanup done

---
vt run: 1/2 successful. (Run `vt run --last-details` for full details)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "cache": true }
1 change: 1 addition & 0 deletions docs/cancellation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ When the user presses Ctrl-C:
1. The OS delivers SIGINT (Unix) or CTRL_C_EVENT (Windows) directly to all processes in the terminal's foreground process group — both the runner and child tasks. This is standard OS behavior, not something `vp run` implements.
2. No new tasks are scheduled after the signal.
3. Results of in-flight tasks are **not cached**, even if a task handles the signal gracefully and exits 0. The output may be incomplete, so caching it would risk false cache hits on subsequent runs.
4. Tasks that exit non zero after Ctrl+C don't trigger [fast-fail](#fast-fail), so other tasks can finish shutting down.

## Fast-fail

Expand Down