Tag coefficient not applied when multiple tags exist on a task
Given the following configuration:
data.location=.
hooks.location=./hooks
urgency.uda.tags.foo.coefficient=10
urgency.uda.tags.bar.coefficient=5
We can show that the tag coefficient is not applied when more than one tag exists on a task.
To see the problem in action create a taskrc file with the above config in an empty directory and run the following commands:
# Create task with one tag and now additional urgency
$ task rc:taskrc add Test +baz
TASKRC override: taskrc
Created task 1.
# Show list of tasks where urgency is as expected
$ task rc:taskrc
TASKRC override: taskrc
ID Age Tag Description Urg
1 14s baz Test 0.8
1 task
# Add tag bar, expecting the urgency to go up
$ task rc:taskrc 1 modify +bar
Modifying task 1 'Test'.
Modified 1 task.
TASKRC override: taskrc
$ task rc:taskrc
TASKRC override: taskrc
ID Age Tag Description Urg
1 2min bar baz Test 0.9
1 task
# Show task 1 (With non-important part stripped out) - urgency did not go up
$ task rc:taskrc 1
TASKRC override: taskrc
Name Value
ID 1
Urgency 0.9
[tag_bar x]
[tag_baz x]
tags 0.9 * 1 = 0.9
------
0.9
# Remove tag baz, so only one tag with a coefficient is present
$ task rc:taskrc 1 modify -baz
Modifying task 1 'Test'.
Modified 1 task.
TASKRC override: taskrc
# Show task 1 (With non-important part stripped out) - urgency is as expected
$ task rc:taskrc 1
TASKRC override: taskrc
Name Value
ID 1
Urgency 5.8
[tag_bar x]
tags 0.8 * 1 = 0.8
UDA tags.bar 1 * 5 = 5
------
5.8
# Add second tag with coefficient - expecting urgency to be 15+
$ task rc:taskrc 1 modify +foo
Modifying task 1 'Test'.
Modified 1 task.
TASKRC override: taskrc
# Show task 1 (With non-important part stripped out) - urgency is incorrect
$ task rc:taskrc 1
TASKRC override: taskrc
Name Value
ID 1
Description Test
Status Pending
Entered 2024-12-17 13:54:58 (7min)
Last modified 2024-12-17 14:01:53 (21s)
Tags bar foo
Virtual tags LATEST PENDING READY TAGGED UNBLOCKED
UUID 6cac55d8-89da-440d-b8e7-1aa676963fe5
Urgency 0.9
[tag_bar x]
[tag_foo x]
tags 0.9 * 1 = 0.9
------
0.9
Output of task diag
$ task rc:taskrc diag
TASKRC override: taskrc
task 3.1.0
Platform: Darwin
Compiler
Version: Apple LLVM 16.0.0 (clang-1600.0.26.3)
Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
Compliance: C++17
Build Features
CMake: 3.30.3
libuuid: libuuid + uuid_unparse_lower
Build type: Release
Configuration
File: taskrc (found), 149 bytes, mode 100644
Data: . (found), dir, mode 40755
GC: Enabled
$EDITOR: hx
Hooks
System: Enabled
Location: ./hooks
(-none-)
Tests
Terminal: 252x75
Broken ref: Scanned 2 tasks for broken references:
No broken references found
As a sidenote: My terminal is 170x61 and not 252x75 as seen in the diag output.
Hi there,
Could you test by changing UDA to USER in .taskrc? It seems to work that way for me, I don't know if it fits in your specific case.
From:
urgency.uda.tags.foo.coefficient=10
urgency.uda.tags.bar.coefficient=5
To:
urgency.user.tags.foo.coefficient=10
urgency.user.tags.bar.coefficient=5
From https://taskwarrior.org/docs/urgency/ it looks like it should just be urgency.tag.foo and urgency.tag.bar.
(I'm going to close this old issue, but hopefully the above comments are helpful!)
(I'm going to close this old issue, but hopefully the above comments are helpful!)
I tried both approaches and none of them worked.
When changing to .user or removing it it resulted in none of the coefficients were applied.
Ok, so I played around with it some more, and found the solution:
urgency.user.tag.foo.coefficient=10
urgency.user.tag.bar.coefficient=5
Note no s in tag =)
Thanks! I edited my comment from a week ago to avoid confusion.
What really got me was that the coefficient was picked up when defining just one tag with urgency.uda.tags.foo.coefficient as the key.
I can confirm that is the case:
[[email protected] ~]$ task config urgency.uda.tags.foo.coefficient 10
Are you sure you want to add 'urgency.uda.tags.foo.coefficient' with a value of '10'? (yes/no) yes
Config file /home/warrior/.taskrc modified.
[[email protected] ~]$ task add test +foo
Created task 1.
[[email protected] ~]$ task _get 1.urgency
10.8
[[email protected] ~]$ task 1 info
Name Value
ID 1
Description test
Status Pending
Entered 2025-05-15 01:52:12 (13s)
Last modified 2025-05-15 01:52:12 (13s)
Tags foo
Virtual tags LATEST PENDING READY TAGGED UNBLOCKED
UUID 6057d8c5-db8c-4555-b047-fd9d40a2c72f
Urgency 10.8
[tag_foo x]
tags 0.8 * 1 = 0.8
UDA tags.foo 1 * 10 = 10
------
10.8
This looks to be the case because of two things:
tags.foois incorrectly allowed to be recognized as an UDA due to the settingurgency.uda.tags.foo.coefficient- it however only works if matched with a single value, once the tags field contains multiple tags (value is
foo,bar) it no longer matchesfooorbar, hence no "UDA" tag coefficient gets applied
I think the solution here would be to throw a warning when UDA urgency coefficients are attempted to be used with built-in attributes, instead of trying to process them.
Definitely had an 'aha' moment in this thread. I thought that the default tags was additive (ie +tag1 and +tag2 = 0.8 * 2, and assumed I had broken something.
Through this post (and revisiting the urgency doc), I realize that using 1+ tag(s) give a score of 0.8 unless they have an explicit coefficient. I have since updated coefficients of tags I've created via my taskrc.
Re-opening to solve:
I think the solution here would be to throw a warning when UDA urgency coefficients are attempted to be used with built-in attributes, instead of trying to process them.