gitdataai/libs
ZhenYi c89f01b718 feat(room): improve robustness — optimistic send, atomic seq, jitter reconnect
Backend:
- Atomic seq assignment via Redis Lua script: INCR + GET run atomically
  inside a Lua script, preventing duplicate seqs under concurrent requests.
  DB reconciliation only triggers on cross-server handoff (rare path).
- Broadcast channel capacity: 10,000 → 100,000 to prevent message drops
  under high-throughput rooms.

Frontend:
- Optimistic sendMessage: adds message to UI immediately (marked
  isOptimistic=true) so user sees it instantly. Replaces with
  server-confirmed message on success, marks as isOptimisticError on
  failure. Fire-and-forget to IndexedDB for persistence.
- Seq-based dedup in onRoomMessage: replaces optimistic message by
  matching seq, preventing duplicates when WS arrives before REST confirm.
- Reconnect jitter: replaced deterministic backoff with full jitter
  (random within backoff window), preventing thundering herd on server
  restart.
- Visual WS status dot in room header: green=connected, amber
  (pulsing)=connecting, red=error/disconnected.
- isPending check extended to cover both old 'temp-' prefix and new
  isOptimistic flag, showing 'Sending...' / 'Failed' badges.
2026-04-16 19:23:06 +08:00
..
agent refactor(room): remove NATS, use Redis pub/sub for message queue 2026-04-16 17:24:04 +08:00
agent-tool-derive init 2026-04-15 09:08:09 +08:00
api feat(room): improve robustness — optimistic send, atomic seq, jitter reconnect 2026-04-16 19:23:06 +08:00
avatar init 2026-04-15 09:08:09 +08:00
config init 2026-04-15 09:08:09 +08:00
db init 2026-04-15 09:08:09 +08:00
email init 2026-04-15 09:08:09 +08:00
git init 2026-04-15 09:08:09 +08:00
migrate refactor(room): remove NATS, use Redis pub/sub for message queue 2026-04-16 17:24:04 +08:00
models refactor(room): remove NATS, use Redis pub/sub for message queue 2026-04-16 17:24:04 +08:00
queue refactor(room): remove NATS, use Redis pub/sub for message queue 2026-04-16 17:24:04 +08:00
room feat(room): improve robustness — optimistic send, atomic seq, jitter reconnect 2026-04-16 19:23:06 +08:00
rpc init 2026-04-15 09:08:09 +08:00
service feat(repo): return ssh/https clone URLs from backend 2026-04-16 18:20:48 +08:00
session init 2026-04-15 09:08:09 +08:00
transport init 2026-04-15 09:08:09 +08:00
webhook init 2026-04-15 09:08:09 +08:00