TaskList tool returns rows in non-monotonic order (appears to sort by last-updated, not task ID)
Summary
Calling \TaskList\ after updating several tasks returns rows in an order that does not match their numeric IDs. In the observed case, IDs 6, 7, 8, 9, 10 all reached \completed\ status but \TaskList\ returned them in the order 6, 7, 10, 8, 9. The ordering appears to be a secondary sort on something like \updated_at\, not on task ID.
Models emit \TaskList\ output to users verbatim, so a non-monotonic order reads as a mistake the assistant made. In this session, the user asked "why did you number this sequence 1, 2, 5, 3?" before I realized the model was not choosing the order — the tool was.
Reproduction
- Create tasks 6, 7, 8, 9, 10 (in ID order) via \
TaskCreate\. - Mark them \
completed\in the following update sequence:
- Set #6 → in_progress → completed
- Set #7 → in_progress → completed
- Set #8 → in_progress → completed
- Set #9 → in_progress → completed
- Set #10 → in_progress → completed
- Call \
TaskList\. - Observe that the returned rows appear as 6, 7, 10, 8, 9, not 6, 7, 8, 9, 10.
Actual output (literal, from session on 2026-04-22)
\\\\
#6 [completed] Survey existing launchd jobs for pattern
#7 [completed] Pick schedule slot after vault sync
#10 [completed] Create gbrain-embed page in GBrain + update memory
#8 [completed] Write com.pai.gbrain-embed.plist
#9 [completed] Load, test-run, verify
\\
Expected
Either:
- Sort by numeric task ID ascending by default (most intuitive for small, human-authored lists), or
- Document the sort order explicitly so model/tool callers can re-sort before presenting to users.
Why it matters
Users interpret \TaskList\ output as the model's own ordering decision. Non-monotonic IDs read as sloppy. A stable, ID-ascending default would eliminate the confusion entirely; alternatively, an explicit \sort\ parameter (\id\ / \updated_at\ / \status\) documents intent.
Environment
- darwin 25.4.0, zsh
- Claude Code CLI
- Model: Opus 4.7 (1M context)
- Observed 2026-04-22
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗