Skip to content

feat(service,features): an inbox mark, answer, or close answers the transaction it committed in - #4437

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

luke-agent[bot] merged 1 commit into
mainfrom
luke/inbox-write-txid

Conversation

@charleslpan

@charleslpan charleslpan commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

The service half of the inbox's txid wait: each member write on the inbox returns the txid of the transaction that changed its row, as Neon's mutations guide describes. The host PR that waits on it with confirmWrite (#4423) follows.

What changes

  • inbox-store.ts: pg_current_xact_id()::text is read in the RETURNING of the write that changes the row. No extra transaction or statement is added.
    • upsertRead, upsertUnread, and upsertAllRead (mark read, mark unread, mark all read).
    • answerItem (answer by revision, and answer to an ask by its message).
    • memberCloseItem (a member's close).
  • No-op writes carry no txid:
    • A mark already standing.
    • Mark all read with nothing unread.
    • An answer or close sent again under the same key.
  • Wire (inbox-wire.ts): inboxAnsweredSchema, inboxMessagedSchema (an answer by reply), inboxReadStateSchema, and inboxReadAllSchema each get an optional txid. A desktop that doesn't know the field drops it.
  • Out of scope: a plain thread message carries no txid here. It isn't one of the inbox area's writes (mark, answer, close).

Old work

#3264 merged without a txid half. Its head (refs/pull/3264/head) has no txid hunks, and no *inbox*txid* branch exists, so this is new code. It follows the chat txid PR (#4251) as its pattern.

Tests

  • inbox-store.test.ts:
    • mark read and mark unread return a txid the first time and none when repeated
    • mark all read returns one txid, and { marked: 0 } with no txid when nothing was unread
    • an answer and a close each return their own txid
  • inbox-threads.test.ts: an answer to an ask is taken with a txid, and the same answer sent again (REPEATED) has none.
  • coding-agents-app.test.ts: the PUT and DELETE read routes and mark all read carry a txid on the wire.

Made with Luke

View guided diff Turn on auto-fix


Devin Review

…ransaction it committed in

Marking an item read or unread, marking every item read, answering an
item or its open ask, and a member's close each return
pg_current_xact_id() in the RETURNING of the write that changes the row,
and the wire answer carries it as an optional txid. A write that changed
nothing (a mark already standing, an answer or close sent again) carries
none, so a window following the inbox has nothing to wait for.

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:53pm UTC

Request Review

@luke-agent
luke-agent Bot added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit 662dc29 Oct 21, 2026
11 of 12 checks passed
@luke-agent
luke-agent Bot deleted the luke/inbox-write-txid branch October 21, 2026 21:04

@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: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

This branch was successfully deployed

1 active deployment
Preview — faa3a446 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