Skip to content

feat(database,service,features): a task's and an agent's write answers the transaction it committed in - #4431

Merged
luke-agent[bot] merged 1 commit into
mainfrom
luke/task-writes-txid
Oct 21, 2026
Merged

luke-agent[bot] merged 1 commit into
mainfrom
luke/task-writes-txid

Conversation

@charleslpan

@charleslpan charleslpan commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

The service half of the txid rollout for tasks and agents, ported from #4259 (closed when Realtime was switched off) onto today's main; the branch didn't rebase cleanly, so this is a fresh PR.

Per Neon's mutations guide, each write reads pg_current_xact_id()::text in its own RETURNING, with no extra transaction:

  • Task: start (createTaskCommitted), change/pin/archive/move (updateTaskCommitted, from the row update or the reader's pin), delete (deleteTaskCommitted).
  • Agent: start (the insertAgent row), rename, archive, pin (*Committed variants in coding-agent-store.ts).
  • A write that changes no row (a pin asked again, a change naming only an unchanged pin) answers no txid.
  • Stop and send-message answer none: their visible effect comes later from eve in another transaction.

The wire answers (taskAnswerSchema, taskStartAnswerSchema, taskDeleteAnswerSchema, codingAgentAnswerSchema, codingAgentAgentAnswerSchema) carry an optional decimal txid, and HostedTaskClient hands it beside the task (TaskWritten). The existing store functions keep their old answers, each mapped from its committed write.

The host wait (onTxWait + confirmWrite) follows in a second PR, after #4423.

Tests: task-list-live.test.ts checks that a task change, a pin, an agent rename and pin, and a delete each return a txid, and that a repeated pin and a delete of a missing task return none.

Made with Luke

View guided diff Turn on auto-fix


Devin Review

…s the transaction it committed in

Starting, changing, pinning, archiving, moving, and deleting a task, and an
agent's start, rename, archive, and pin, each return the id of the
transaction they committed in, read in the RETURNING of the write that
changed a row (the row itself or the reader's pin), as Neon's mutations
guide says, and none where nothing changed, such as a pin asked again. The
answers carry it as an optional txid, and the task client hands it beside
the task, so the desktop following the task list can wait for it to arrive
before it confirms the write. A Stop and a message change what the list
shows only once eve moves the agent, in another transaction, so they answer
none. Ported from #4259 onto today's main.

Co-authored-by: luke-agent[bot] <339870089+luke-agent[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
luke-web Ready Ready Preview Oct 21, 2026 8:48pm UTC

Request Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Merged via the queue into main with commit 7ce08c0 Oct 21, 2026
12 checks passed
@luke-agent
luke-agent Bot deleted the luke/task-writes-txid branch October 21, 2026 21:00

This branch was successfully deployed

1 active deployment
Preview — a2c8a68a Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant