fix(service): a Start answers the last transaction it committed in
Follow-up to #4431, which entered the merge queue before this fix to Devin's review comment (thread) could be pushed.
A Start inserts the agent, then moves its task into progress (beginTaskWork) and assigns it (assignUnassignedTask), each in its own transaction. A task started with an agent also commits the task before the agent. Before this fix, the answer carried the first txid, so a client waiting on it could confirm before the agent and the task's new standing reached the followed list.
Now:
beginTaskWorkCommittedandassignUnassignedTaskCommittedreturn their txid in their ownRETURNING, and none where nothing moved. The boolean functions stay as they were.startCodingAgentanswers the last txid it committed.- A task's start with an agent answers the agent Start's txid, which is later than the task insert's.
Realtime delivers transactions in commit order, so waiting on the last one covers every earlier one.
Tests: task-list-live.test.ts checks that both writes return their own, increasing txid and that asking again returns none. coding-agents-app.test.ts checks that a task's start with an agent answers the task row's xmin, which is its last write.
Made with Luke