Conduit API ( cursor wrapping around


I was making a series of API calls to get all Maniphest tasks via I was expecting to loop until the ‘after’ token was ‘null’. The bug is that the ‘after’ token never became ‘null’. It wrapped around, and started from the beginning of the tasks again, causing an infinite loop of API calls.

Reproduction Instructions

I was able to recreate this through the /conduit/method/ page, under the Call Method UI. I simply found my 2nd oldest task (based on the decrementing id field), and passed this as the ‘after’ parameter. Instead of the cursor returning ‘null’ for the after token, with a single task returned, I got the oldest task, and the 99 newest tasks. All other parameters were unset (i.e. default)

Phabricator/Arcanist Version

phabricator: 26f9ba4684a8d3a41f3a88d25a88e3f276e776e5 (Sun, Aug 11) (branched from 0a3c26998fc985a0cc660fe6a8e92184c6b08f69 on phacility)
arcanist: feb5f4d42c4fe0001e76428e80d5e88262308802 (Jun 22 2019) (branched from d92fa96366c0ed50e4257508148aa75192d4fb1f on phacility)
phutil: 8df85007f38ecd06867582fa0539429a3ae83a37 (Jul 31 2019) (branched from b416093386a225b1d9a2de906899b94cbf4babcb on phacility)
tmphabricator: 53a967a318bdf3c7abc7dcebc25111707848ea70 (Jul 4 2019)
php: 7.2.19-0ubuntu0.18.10.1
diff: 3.6 at /usr/bin/diff
git: 2.19.1 at /usr/bin/git
hg: Not Available
pygmentize: 2.3.1 at /usr/local/bin/pygmentize
svn: Not Available

I can’t reproduce this. I used the Conduit API console to call “” with order “newest” and after “2” (this is the second-oldest task, locally). I got a result page with one result (the task with ID “1”) and a null “after” cursor:

Note that the default order in Maniphest is <priority, id>, not <id>, so if you do not specify “newest” as an explicit order, the result with ID 2 (or the second-lowest-ID, more generally) is probably not the second-to-last result.

Locally, if I leave the order as the default and make several calls, I get these "after" keys:


I have 662 tasks, so this (seven pages of results at 100 results per page) is expected.

Thanks for the rapid response. Confirm that setting order “newest” solves my issue. Feel free to close this (or I can retract the report, as you prefer).