feat(host): a chat write is confirmed once its transaction reaches the followed chat

Draft
CH
8d ago
+98-6

Part of making workspace chat live over Neon Realtime. Stacked on #3923. One change: the host waits for a chat write's txid before it answers, as Neon's mutations guide does.

What changes

  • Wait before answering. When the service answers a write's txid (#4251) and the window follows that workspace's chat over Realtime, codingAgents.chatPost waits up to 10 s before answering. It waits on the TxWait that P5's liveRows hands out through onTxWait.
  • The chat pushed already holds the write. By the time the window hears the answer, the chat pushed to it includes the write. That's what lets #3928 drop the window's overlay of channels written while a read was out.
  • No wait when there's nothing to wait for:
    • a write that changed nothing (no txid)
    • a chat no window follows
    • a chat that's being polled
  • On timeout the write is answered anyway, since it committed.

Tests

  • New compose-coding-agents.test.ts case:
    • a read-to answering a txid waits until that transaction arrives on the followed read
    • a no-op write answers at once
    • a write to a workspace that isn't followed answers at once
  • Checks were run one at a time on the stack's top: tsc for each touched package, biome, oxlint, knip, discarded-effect, the repository checks, and the affected vitest suites.

Made with Luke