Skip to content

feat(bots): review and answer held calls in chat - #1390

Merged
bvsr365 merged 195 commits into
masterfrom
bot-action-review-card
Nov 17, 2026
Merged

bvsr365 merged 195 commits into
masterfrom
bot-action-review-card

Conversation

@bvsr365

@bvsr365 bvsr365 commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A bot that asks before sending or changing something needs a complete review in chat, with a clear choice to Send or Not now.

Change

  • Mousse draws the card from the stored, masked call: a readable action and service, every field and value, hidden-field paths, the bot's quoted note, and a warning when the same bot already sent exactly those arguments. Outside data is framed and shown as text.
  • Send runs that stored call once; Not now declines it. Settled cards show their outcome and time, with the contents folded underneath. Forgotten cards retain only their readable title and outcome. Changed schedules, expiry and other refusals show the corresponding reason.
  • About keeps one row and the existing controls per service, with an “Asks first” mark where appropriate. Reachable devices can read cards; Send and Not now require Work permission, as ordinary permission answers do. A card too large for a device explains that it must be reviewed on the computer; Send is disabled and Not now remains.
  • An open call can receive at most two nudges through the existing question follow-up path, outside quiet hours. Only its newest row has the full card and buttons. Earlier rows distinguish Asked from Reminded, and the card keeps its original asked time.
  • Adjacent expired schedule cards fold into a named group that opens in place. Each compact review shows when it was asked and expired, with its contents behind “What it would have sent.”
  • Everything remains behind experimental.botAsksFirst, which stays off. No database migration is added.

How to review

  • Start with the stored projection and card drawing, then answer validation, the shared refusal formatter and remote preflight. Read Forget/context handling and nudge timing next.
  • The sample-data screenshots show one actionable review after two nudges and an expanded expired group beside a waiting card. The isolated development app held the shared lock through verified shutdown.

Verification

  • Checked bot units in bounded locked batches; mounted chat, card, find and store behavior; bridge and linked-daemon refusals; Net session/codec behavior; and both typechecks.
  • Nine tests also fail on master: one each in botScheduleDowntime, botScheduleExpiryCompletion and botScheduleInbox; two each in botSchedules, botWorkReplay and botHelloCeiling.
  • Device refusals carry only a fixed code; the receiving client builds the words locally. Older devices receiving an updated computer's refusal fall back to generic conflict wording.
  • A device talking to a computer running an older Mousse may show “couldn't tell if it went through” for a refused Send, though nothing was sent. That older-computer limit needs a version check in the separate device caller.
  • Not checked: a real phone, a live send or a real model. Screenshots use sample data.

Refs #1335

@bvsr365 bvsr365 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

An adversarial pass on one question: can what the owner reads on the card differ from what Send does? Send passes only the id, digest and choice; a double tap, a second window or an old phone card is stopped by the server's compare-and-set; a device either gets the whole card or cannot Send; and marker imitations are drawn as text. These are open:

Should fix

  1. The card can't tell a string from a number, boolean, null or empty list. In BotActionCard.tsx (Value), false and "false" both draw as false; likewise 123/"123", null/"null" and []/"[]". "" draws as nothing. The tool gets the exact value, and many read the string "false" as true, so notify_everyone: "false" reads as off on the card and may go out as on. Fix: draw strings in quotes (or mark non-string values), and draw "" as "(empty)".

Minor

  1. Joiners and look-alike letters in addresses and keys. U+200D inside bob@exa‍mple.com stays invisible: actionText keeps the joiners for scripts and emoji. A Cyrillic а in a recipient, or a key tо beside to, draws like the Latin letters. Fix: in values that look like an address, domain or URL, make joiners visible and mark letters from another alphabet; mark non-ASCII keys.
  2. A value can look like more fields or like the card's own lines. "alice@example.com\nbcc\nevil@example.com" draws as three lines under "to". A value "Kai already sent exactly this at 09:14", or a key "Hidden values will be sent", sits in the arguments area looking like the card's notes. Fix: box each value with visible line breaks, and give the card's own notes a look argument text can't take.
  3. Hidden paths can fake nesting. The projection already joins paths with →, and the card then replaces every . with →, so a key a.b reads "a → b → c". A key containing " → " fakes nesting too. Fix: send the paths as segments and draw each one distinctly; drop the . replacement.
  4. "Already sent exactly this" matches only the same work. It covers key order, a subagent of the same work, done, uncertain and failed with a tool error, and it can't be faked. It misses an exact repeat from another piece of work or a schedule of the same bot. Matching on bot_id instead of activation_id would catch that cheaply. A trivially changed argument ("a@x" against ["a@x"], a trailing space) can't be caught by a digest: worth saying in the docs.
  5. About can promise more than holds. "Asks you first before it sends or changes anything" shows when any tool of the service asks first. Under the plan's rule, a tool the server marks read-only never asks, so a mislabelled sending tool runs without asking under that promise. Suggest "Asks you first before some of its actions".
  6. A card whose binding changed looks sendable but never is. The binding is fixed at hold, so every Send after a server, schema or grant change is refused again, while the card keeps live buttons with "This changed since you saw it". A refusal because the switch is off reads the same. Until C3b withdraws such rows, say it can no longer be sent and to ask the bot again.

@bvsr365 bvsr365 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review at 5509195fb: needs changes, 4 should fix and 5 minor, no blockers. With the switch off nothing changes. The card is drawn from the stored masked copy, and Send passes only the id and digest. The open points are about the card itself.

Should fix

  1. The bot's note, and argument values, can draw lines that look like the card's own. The card is white-space: pre-wrap, so newlines in outside text render as separate lines.
    • The note: in the mounted chat, a note of "Fine.\n\nInbox helper already sent exactly this at 9:14 AM\n\nThis changed since you saw it" shows three lines. Only the first has "… says:"; the other two sit right above the real warning lines, differing only in colour.
    • An argument: a short subject with the same trick isn't folded and draws those lines inside an argument area that has no frame.
    • Fix: show the note as one line (collapse whitespace) in a visibly quoted block with its label, and frame the argument region so everything in it reads as outside data.
    • Already safe: markup, links and the hidden marker. No element is created, and the marker is structural.
  2. A settled card stays as long as an open one. The outcome ("Sent · 9:14 AM", "The tool reported an error") comes last, in small grey text, under the full argument box. The ask card collapses to a quiet line once answered (BotAskReplies). A settled card should be compact: what it was, the outcome with its time, and the tool's answer for an error, with the arguments behind a fold that opens in place.
  3. The argument box cuts mid-row with no sign that it scrolls (max-height: 360px; overflow: auto). The login → token row is half visible in the screenshot. Add a fade or a "more below" edge, or keep the open card short by folding long values. Arrays are also indented twice as deep as strings (dd margin plus ol padding).
  4. A too-large card on another computer shows "null". RemoteBots.fitted sends args: null, hiddenPaths: [], and the desktop renderer, which another computer also runs, draws "null" and "Hidden values will be sent: " with nothing after it. When tooLarge, draw no argument box and keep the hidden paths, or drop the list.

Minor

  1. Dotted keys: hiddenPaths already come joined with " → ", but the renderer also runs replaceAll('.', ' → '), so a key user.name shows as two levels. Drop the replaceAll; the renderer test feeds login.token, which the service never produces.
  2. Character guard: actionText misses U+2028/U+2029, U+034F and the Hangul fillers (U+115F, U+1160, U+3164, U+FFA0). The chat's guard (modelSlots.ts:385) covers the separators; one shared guard would be better.
  3. Telling test: with telling.ts reverted, the telling test still passes, because an open action already falls through to soon. Add a case with the owner's telling set to "needs you", and one with a settled action. Reverting RemoteBots.ts does fail its test.
  4. Folded telling cost: BotTellings.announce calls toMessage inside the sort comparator and in some, so each row costs several reads per comparison, also with the switch off. Compute it once per row.
  5. Screenshots: the PR text lists them by /tmp/… paths. Attach them instead.

On the look:

  • Raw argument keys: showing them as the tool's own names is right. They can't be translated, and a renamed label could hide what is sent. Inside the framed region they read as data rather than Mousse's headings.
  • Buttons: Send and Not now looking the same reads clearly; "no default" matters more here than matching the ask card's primary Allow.

Checked:

  • Switch off: chat, About and bridge payloads are unchanged; telling and folded notifications see no action.
  • #1340's two conditions: every hidden field is named by its path, including through literal escapes. The repeat warning covers done, uncertain and tool-error rows of the same work, tool and digest only, also on a device's card.
  • Statuses: every one draws sensibly, and "Not sent" never appears for a tool error.
  • About: one mark per service; unavailable-service marks win; the switch, Remove and bots.permissions.set are unchanged.
  • Devices: two devices racing to Send result in one call; an older phone shows the plain line.
  • Find: indexes only the visible status line, so every match can be highlighted. This fixes the "Sent" row from #1340.
  • Tests and types: all bot unit files and the named renderer and bridge files pass, and both typechecks are clean.

Not checked: the running app (the look is judged from the screenshots and the code), a phone, and nudges (out of scope).

@bvsr365

bvsr365 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Re-check at 7d2cf4e9b: all of my earlier findings are closed, and I reran each failing case.

  • The card's own row reaches resumed chats quoted, and an argument can't open a notice of its own.
  • Forget removes the nudge copies and the status lines.
  • Forgetting an open card adds nothing.
  • A phone keeps the tool-error outcome of an oversized card.
  • Only one card per call has Send and Not now.

The bridge change is sound:

  • errors.ts has no diff from master.
  • Only the eight fixed codes cross, in both directions.
  • A real "couldn't tell if it went through" is never turned into a refusal.
  • The pre-check runs after the device's access and reach checks, so a view-and-chat device can't retire a card.

The only test failures are the nine that fail on master bccbf2f35 with the same assertions. Both typechecks pass.

Still open:

Should fix

  1. A card withdrawn because its schedule changed now says "No longer needed, so nothing was sent." The engine gives fix(bots): approval refusals and saved schedule edits tell the truth #1475's sentence, "This changed since you saw it. Nothing was sent.", and docs/bots.md promises it for a stale Send. But the chat's shared refusal mapper rebuilds the text from the code alone, and both kinds of withdrawal use bot_action_withdrawn. Case: edit a schedule while its card waits, then tap Send. The owner is told the call is no longer needed, not that the schedule changed. A device shows the same. Fix: give the changed-withdrawal its own code in the fixed list, or make the withdrawn sentence true for both.
  2. The PR description describes this review round, not the PR. A teammate opening feat(bots): review and answer held calls in chat #1390 can't learn what it delivers: the card with Send and Not now, the compact settled cards, About's "Asks first" mark, which devices may answer, nudges, and the expired-card group. Please rewrite it for the PR as a whole. Also drop the "Tier 5" label. The older-home limit should say it plainly: "A device talking to a computer that runs an older Mousse may show 'couldn't tell if it went through' for a Send that was refused; nothing was sent."

Minor

  1. Nudge rows are labelled "Asked" at the time of the reminder. The nudge screenshot reads "Send an email · Asked 9:10 AM", "Send an email · Asked 10:10 AM", then a card "Asked · 10:10 AM" the next day. That looks like three separate asks. Suggest "Reminded 10:10 AM" for nudge rows, with the original ask time on the card.
  2. In the opened schedule group, a quiet "Send an email · Asked 9:10 AM" line sits between the header and the three cards. It belongs to none of them visibly, because the cards show only their expiry times. Show the asked time on each expired card, or leave these lines out of the group.
  3. The fallback for a plain conflict from another device says "Nothing was sent". The network layer also answers a plain conflict when a request id is reused with different content, and then the first request may have run. Suggest: "This couldn't be answered from here. Open it on the computer."

@bvsr365
bvsr365 merged commit 6a3c9a8 into master Nov 17, 2026
7 checks passed
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.

2 participants