Skip to content

Commit c654902

Browse files
zylaclaude
andcommitted
Log "skipped, inputs unchanged" for toplevel tasks with no changes
When a toplevel task detects no input changes (local cache hit), it previously exited silently. This adds an info log message so agents and users can distinguish a cache hit from an empty/broken run. The message only appears for toplevel tasks to avoid noise from subtasks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 531d2ec commit c654902

10 files changed

Lines changed: 43 additions & 0 deletions

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ stack test --test-arguments --accept
6363
- `# no toplevel` - don't wrap in taskrunner
6464
- `# s3` - enable S3 testing
6565
- `# github keys` - provide GitHub credentials
66+
- When testing toplevel vs subtask behavior, use real nesting (default toplevel wrapping + inner `taskrunner` calls) rather than manually setting internal env vars like `_taskrunner_build_id`
6667

6768
## Key Commands for Development
6869

src/App.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ main = do
186186

187187
m_hashToSave <- readIORef appState.hashToSaveRef
188188

189+
when (skipped && isNothing m_hashToSave && appState.isToplevel) do
190+
logInfo appState "skipped, inputs unchanged"
191+
189192
-- Only be chatty about exit status if we were chatty about starting the work, i.e. if it is cacheable.
190193
when (not skipped && isJust m_hashToSave) do
191194
if exitCode == ExitSuccess then

test/t/file-input-unchanged-force.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ should compute again:
77
[mytask] stdout | Expensive computation
88
[mytask] info | success
99
should not compute again:
10+
[mytask] info | skipped, inputs unchanged

test/t/file-input-unchanged.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
[mytask] info | Inputs changed, running task
33
[mytask] stdout | Expensive computation
44
[mytask] info | success
5+
[mytask] info | skipped, inputs unchanged

test/t/file-input-with-spaces-unchanged.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
[mytask] info | Inputs changed, running task
33
[mytask] stdout | Expensive computation
44
[mytask] info | success
5+
[mytask] info | skipped, inputs unchanged

test/t/raw-input-unchanged.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
[mytask] info | Inputs changed, running task
33
[mytask] stdout | Expensive computation, input is: lol
44
[mytask] info | success
5+
[mytask] info | skipped, inputs unchanged

test/t/subtask-skip-no-message.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- output:
2+
[mytask] info | Inputs changed, running task
3+
[mytask] stdout | Running task
4+
[mytask] info | success

test/t/subtask-skip-no-message.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
echo lol > input.txt
2+
git init -q
3+
git add input.txt
4+
5+
go() {
6+
taskrunner -n mytask bash -e -c '
7+
snapshot input.txt
8+
echo "Running task"
9+
'
10+
}
11+
12+
go
13+
go

test/t/toplevel-skip-message.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- output:
2+
[mytask] info | Inputs changed, running task
3+
[mytask] stdout | Running task
4+
[mytask] info | success
5+
[mytask] info | skipped, inputs unchanged

test/t/toplevel-skip-message.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# no toplevel
2+
echo lol > input.txt
3+
git init -q
4+
git add input.txt
5+
6+
go() {
7+
taskrunner -n mytask bash -e -c '
8+
snapshot input.txt
9+
echo "Running task"
10+
'
11+
}
12+
go
13+
go

0 commit comments

Comments
 (0)