Watch hijacking dependency process

Description

Given the following tasks:

  provision:
    desc: "Bring up some dependencies and write the result to .env file"
  ...

  build:
    desc: "Build the service binaries"
    sources:
      - '**/*.go'
      - 'go.mod'
      - 'go.sum'
    generates:
      - './out/bin/server'
      - './out/bin/client'
    cmds:
      - task: provision
      - go build -o ./out/bin/ ./cmd/...
    method: timestamp

  run:
    desc: "Run the services"
    dotenv: ['.env']
    deps: [run:server, run:client]
    watch: true
    sources:
      # do not include .env as it is auto-generated by the provision task
      - exclude: '.env'
      - '*.sql'
    method: none

  run:server:
    deps: [build]
    cmd: ./out/bin/server

  run:client:
    deps: [build]
    cmd: ./out/bin/client

Running task run -v seems to yield a deadlock of some kind, where we have:

task: "provision" finished
task: [build] go build -o ./out/bin/ ./cmd/...
task: received watch event: WRITE         "/Users/myself/Projects/myproject/.env"
task: [run:server] ./out/bin/server
task: skipped for file not in sources: .env

However, running task run:server works just fine.

It seems that, for some reason, having watch turned on makes the run:server step not wait for the build step any longer, so the build doesn't even get to finish, but it tries to run the binary which has not yet been created.

Haven't been able to figure out why this behavior happens though.

Version

3.45.4

Operating system

MacOS 15.7.1

Experiments Enabled

No response

Example Taskfile