What is the value of TERM?

Consider the following config:

version: 2
jobs:
  build:
    steps:
    - run: set | grep TERM || true
    - run: sh -c set | grep TERM || true
    - run: bash -c set | grep TERM || true
    - run: bundle exec set | grep TERM || true
    - run: ruby -e 'pp ENV' | grep TERM || true
    - run: bundle exec ruby -e 'pp ENV' | grep TERM || true

The result:

#!/bin/bash -eo pipefail
set | grep TERM || true

BASH_EXECUTION_STRING='set | grep TERM || true'
TERM=dumb

CircleCI received exit code 0
#!/bin/bash -eo pipefail
sh -c set | grep TERM || true

CircleCI received exit code 0
#!/bin/bash -eo pipefail
bash -c set | grep TERM || true

TERM=dumb

CircleCI received exit code 0
#!/bin/bash -eo pipefail
bundle exec set | grep TERM || true

CircleCI received exit code 0
#!/bin/bash -eo pipefail
ruby -e 'pp ENV' | grep TERM || true

CircleCI received exit code 0
#!/bin/bash -eo pipefail
bundle exec ruby -e 'pp ENV' | grep TERM || true

CircleCI received exit code 0

Are they using some sort of heuristic? Are any specifics known? It took me a while to figure out that in spite of set and echo $TERM producing dumb, the other commands are run w/o TERM.