#3058·task

`run: once` does not work with multiple levels of hierarchy

Author: maxmzkrcensysCreated Sep 29, 2026Updated Sep 29, 2026
Labelsstate: needs triage

Description

Given a multiple levels of hierarchy of includes, run: once runs deduplicates if the hierarchy is only one level deep, but does not deduplicate when the hierarchy is multiple levels deep.

I would expect run: once to deduplicate no matter the number of levels of hierarchy

Instead I get

task: [c:a:tools:exe] echo "building tool"
task: [c:b:tools:exe] echo "building tool"
building tool
building tool

https://github.com/go-task/task/pull/1655 There is discussion about this problem here, or at least a similar problem. In this PR caching across runs is left as an open problem. However, the issue I'm reporting can be seen in a single run.

https://github.com/go-task/task/pull/1655 does fix a very similar issue, however, this bug is produced when including any additional levels of hierarchy

Version

3.53.1

Operating system

Ubuntu 24.04

Experiments Enabled

No response

Example Taskfile

yaml
# tools/taskfile.yml
version: "3"

tasks:
  exe:
    run: once
    cmds:
      - echo "building tool"

# lib/a/taskfile.yml
version: "3"

includes:
  tools:
    taskfile: ../../tools
    dir: ../../tools

tasks:
  lib:
    deps:
      - tools:exe

# lib/b/taskfile.yml
version: "3"

includes:
  tools:
    taskfile: ../../tools
    dir: ../../tools

tasks:
  lib:
    deps:
      - tools:exe

# lib/c/taskfile.yml
version: "3"

includes:
  a:
    taskfile: ../a
    dir: ../a
  b:
    taskfile: ../b
    dir: ../b

tasks:
  lib:
    deps:
      - a:lib
      - b:lib

# taskfile.yml
version: "3"

includes:
  c:
    taskfile: ./lib/c
    dir: ./lib/c

tasks:
  all:
    deps:
      - c:lib