Repository navigation
fix(bots): a bot's Chat can tell the DM a background job came from, until anyone else writes - #50146
brennanb2025 wants to merge 3 commits into
Conversation
…ntil anyone else writes A turn that starts on its own (a background job finished) stays in Orca. For a job started from a Slack DM, worker-start now saves that DM and names it, and bot reply --to posts there. The saved DM is void once anything from another conversation reaches the Chat, whichever turn it lands in, and on a watch gap, sign-out, account switch or restart. A save needs the turn's opener to be the last thing any other conversation sent before it.
|
Perf scan: PASS (head c73ab73) No findings: no P0/P1. Nothing new runs on a timer, poll, subscription or IPC at idle; there are no SQLite or filesystem writes; nothing new runs in the renderer; and no per-item subprocesses are added. Work by trigger (main process; the new state lives only in memory)
Regression classes touched
Six questions
Coverage: a static trace at this head of the CLI and main files in the diff, plus their callers ( |
…and can't come back From the audit: each save now has its own --to, so a voided note never works again after a later save. Any message the Chat admits carrying someone else's words (an event run sent straight to the Chat, a returned card sent again) voids saved DMs and joins the arrival log. --to checks again after its async read and before each cloud retry. A bot's new Chat drops what its old one kept.
|
Perf scan, head 0f7e36a: pass, 0 findings Scope:
Retained memory: at most one log entry per bot (32 arrivals plus 64 DMs saved for Regression classes touched:
Six questions:
Runtime timing wasn't measured. The costs above are counted from the source at the reference fleet (100+ agents, chat messages arriving several times a second) and stay constant at 10× that. |
|
Closing this. Slack DMs now each get a chat of their own, the same as a thread does, so a bot's background answer to a DM no longer shares a chat with anyone else's DM. The saved-DM mechanism here was built for that shared chat and isn't needed anymore. A smaller change will let the existing worker-start note name a DM's own chat, so a bot that wakes on its own there is told it can post with its reply command. |
ELI5
All of a bot's Slack DMs share one Orca chat. When a job started from a DM finishes in the background, the bot wakes on its own, and that turn's answer stays in Orca. Now the bot is told which DM started the job and can post there itself. Orca lets it post only into the DM that started that job, and only until anyone else's words reach the chat; after that the answer stays in Orca. It can miss a post, but it can't send to a DM that didn't start the job. Orca still posts nothing on its own; the bot decides what to say.
What Changed
worker-startprinted no note, andbot replywas always refused there. A DM asker never heard about a job that finished later.worker-startwas opened by a Slack DM, Orca saves that DM and the note names it:bot reply --to <that DM, with a token for this start> --text "...". Each start gets its own token, so a note that was voided never works again.--to.--tochecks again just before posting and before each retry.ChatDeliveries(the existing per-chat delivery record) now keeps a short arrival log for each bot's Chat (only those, so thread chats add nothing) and the saved DMs. It clears both whenever it clears its own state.--touses its own RPC (connector.replySavedDm), so an older host refuses it instead of posting in the chat's current DM.--on <server>doesn't change it. How a remote worker reports back is handled separately.What this stops working for
bot reply.bot replywithout--tois still refused; its message now points to--to.--tois refused with "update Orca"; nothing posts.Known limits
Tests
connector-wake-reply.test.tsdrives the realChatDeliveriesdelivery path and the realconnector.wakeReplyPlaceandconnector.replySavedDmhandlers. I removed each rule in turn and confirmed a test fails without it:Screenshots: the note and replies as they appear in the bot's chat (light and dark)
Worker start from a DM:
A later turn posts with
--to:After another DM reached the chat:
Plain
bot replyin the Chat: