Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
02ad54e
test(bots): expose held calls surviving work end and expiry
bvsr365 Nov 16, 2026
aacb963
fix(bots): withdraw and expire held calls with their work
bvsr365 Nov 16, 2026
5f096ac
fix(bots): owner answers reset waits and repeat cards need new input
bvsr365 Nov 16, 2026
61ec56e
docs(bots): explain held call withdrawal expiry and repeat refusal
bvsr365 Nov 16, 2026
a91acfb
test(bots): cover every withdrawal rollback and durable repeat refusals
bvsr365 Nov 16, 2026
4cfb611
test(bots): wait for the resumed dispatch before checking refusal del…
bvsr365 Nov 16, 2026
61a9a31
test(bots): include repeat refusals in the continuation matrix
bvsr365 Nov 16, 2026
11aa0f8
fix(bots): preserve repeat refusals in ordered unread updates
bvsr365 Nov 16, 2026
0f23b30
test(bots): build refusal matrix events for work without waits
bvsr365 Nov 16, 2026
9563447
fix(bots): bind the refusal message id as a database string
bvsr365 Nov 16, 2026
5d38191
test(bots): keep held cards across temporary MCP listing gaps
bvsr365 Nov 16, 2026
0b86f58
fix(bots): withdraw held calls only on positive MCP evidence
bvsr365 Nov 16, 2026
61b5e6d
test(bots): Forget erases pending and settled action content
bvsr365 Nov 16, 2026
5caf8ce
test(bots): keep refusal counters when history is forgotten
bvsr365 Nov 16, 2026
ffe45cb
fix(bots): tombstone forgotten calls and retain refusal counters
bvsr365 Nov 16, 2026
3eb4b33
test(bots): forgetting a call removes its argument fingerprint
bvsr365 Nov 16, 2026
1b04357
fix(bots): erase forgotten argument digests
bvsr365 Nov 16, 2026
20724aa
test(bots): three declined calls stop trivial argument loops
bvsr365 Nov 16, 2026
144c5d0
fix(bots): stop a tool after three declined cards until owner input
bvsr365 Nov 16, 2026
1dc107f
test(bots): only changes to the held MCP pair invalidate its card
bvsr365 Nov 16, 2026
16b20f0
fix(bots): bind held approval to its MCP pair and permission level
bvsr365 Nov 16, 2026
d058d30
test(bots): restart cannot send an approved call while paused
bvsr365 Nov 16, 2026
a3b42db
fix(bots): settle approved calls without sending on a paused restart
bvsr365 Nov 16, 2026
f580d26
test(bots): distinguish cold approved calls from changed server confi…
bvsr365 Nov 16, 2026
5cf8e22
fix(bots): recover approved calls when MCP listings return
bvsr365 Nov 16, 2026
679252e
test(bots): late tool results cannot restore a forgotten call
bvsr365 Nov 16, 2026
76e3155
fix(bots): keep late results from restoring forgotten call content
bvsr365 Nov 16, 2026
6ab4cca
fix(bots): defer only unavailable approved calls with intact arguments
bvsr365 Nov 16, 2026
3d37d86
docs(bots): explain refusal loops forgotten content and pair-bound ap…
bvsr365 Nov 16, 2026
0e2baa0
test(bots): expiry and forgetting cannot reset declined-card loops
bvsr365 Nov 16, 2026
3e097d0
test(bots): refusal updates never impersonate owner notes or start re…
bvsr365 Nov 16, 2026
a7bb9f8
fix(bots): carry refusals as confirmed Mousse updates instead of owne…
bvsr365 Nov 16, 2026
5f0d4b8
test(bots): Forget continues a card and fully releases a forgotten re…
bvsr365 Nov 16, 2026
e5e4964
test(bots): chat approvals preserve cards and every grant removal wit…
bvsr365 Nov 16, 2026
33ae3a7
fix(bots): continue forgotten cards and end forgotten requests throug…
bvsr365 Nov 16, 2026
c1141d4
test(bots): expiry cannot overtake a timely accepted Send
bvsr365 Nov 16, 2026
295ffcb
test(bots): expired cards count toward the three unsent-card rule
bvsr365 Nov 16, 2026
4bffd93
test(bots): answer the chat permission after its message finishes
bvsr365 Nov 16, 2026
a9a3aa4
fix(bots): check held pairs inside every grant approval
bvsr365 Nov 16, 2026
67901a0
test(bots): existing held rows settle after asks-first is disabled
bvsr365 Nov 16, 2026
3c9b6cd
fix(bots): expire only unaccepted calls and honor timely Send
bvsr365 Nov 16, 2026
1fefc4b
test(bots): work cursor state is private and removed at work end
bvsr365 Nov 16, 2026
e0f7518
fix(bots): count expired cards toward the unsent-card loop rule
bvsr365 Nov 16, 2026
22ccba4
fix(bots): settle existing held calls independently of the new-hold s…
bvsr365 Nov 16, 2026
e0a8e6c
fix(bots): remove action cursors and Mousse updates when work ends
bvsr365 Nov 16, 2026
37101b4
test(bots): publish the chat permission card before allowing it
bvsr365 Nov 16, 2026
c860ef4
test(bots): Send distinguishes pause expiry withdrawal and binding ch…
bvsr365 Nov 16, 2026
8b7f81e
fix(bots): report distinct owner-facing Send refusal reasons
bvsr365 Nov 16, 2026
d2c201c
test(bots): accept timely Send before an asynchronous tool refresh
bvsr365 Nov 16, 2026
a24b444
docs(bots): describe Mousse refusal updates and existing-row cleanup
bvsr365 Nov 16, 2026
4168699
fix(bots): accept timely Send before refreshing its execution binding
bvsr365 Nov 16, 2026
263488b
test(bots): preserve specific refusal codes through the chat service
bvsr365 Nov 16, 2026
e4c8da6
fix(bots): retain untold Mousse updates until output confirmation
bvsr365 Nov 16, 2026
8c0ae18
fix(bots): preserve Send refusal reasons at the chat service boundary
bvsr365 Nov 16, 2026
79c8473
test(bots): accepted approvals never expire during a cold restart
bvsr365 Nov 16, 2026
4f78494
fix(bots): preserve accepted approvals until recovery or withdrawal
bvsr365 Nov 16, 2026
b6c266a
docs(bots): explain private action cursors and their cleanup
bvsr365 Nov 16, 2026
29904f9
test(bots): grant revocation and held-call withdrawal roll back together
bvsr365 Nov 16, 2026
5fa31e4
fix(bots): withdraw held calls transactionally when their grant is re…
bvsr365 Nov 16, 2026
2959ab3
test(bots): accepted Send has a ten-minute window from the tap
bvsr365 Nov 16, 2026
e7cb705
test(bots): forgotten cards block the tool until owner input
bvsr365 Nov 16, 2026
fe9fef9
fix(bots): time out accepted Send ten minutes after the owner tap
bvsr365 Nov 16, 2026
7a577b4
fix(bots): remember forgotten-card refusal by tool without its content
bvsr365 Nov 16, 2026
6eb593a
test(bots): owner refusal sentences use the card voice
bvsr365 Nov 16, 2026
c3a0f94
test(bots): grant changes cannot inspect another bot failing card
bvsr365 Nov 16, 2026
5477330
test(bots): refusal records end when work cannot be continued
bvsr365 Nov 16, 2026
5344d4c
test(bots): owner pause ends accepted waiting calls before their dead…
bvsr365 Nov 16, 2026
54a06a6
fix(bots): use owner-facing sentences for Send refusals
bvsr365 Nov 16, 2026
c180270
fix(bots): scope grant checks to the bot whose permissions changed
bvsr365 Nov 16, 2026
156d10b
fix(bots): owner pause withdraws accepted calls still waiting for ser…
bvsr365 Nov 16, 2026
f173699
test(bots): startup drops refusal records for work that cannot be told
bvsr365 Nov 16, 2026
6aabf09
test(bots): legacy whole-grant approvals withdraw on upgrade
bvsr365 Nov 16, 2026
1d2fbef
fix(bots): remove refusal records when their work can no longer be told
bvsr365 Nov 16, 2026
d172354
fix(bots): withdraw legacy bindings before recovering accepted calls
bvsr365 Nov 16, 2026
8b291d2
test(bots): cover timeout and owner-removal continuations without for…
bvsr365 Nov 16, 2026
db18a31
docs(bots): describe Send windows owner removal and final refusal sen…
bvsr365 Nov 16, 2026
0a9c352
docs(bots): keep service placeholders literal in the Send contract
bvsr365 Nov 16, 2026
36ebe0a
test(bots): forgetting settled cards preserves outcome and tool access
bvsr365 Nov 16, 2026
9c719ec
fix(bots): forgetting settled cards preserves their outcome and tool …
bvsr365 Nov 16, 2026
a410bfd
fix(bots): keep message settlement independent of continuation metadata
bvsr365 Nov 16, 2026
11c97bd
docs(bots): distinguish removing a pending request from forgetting a …
bvsr365 Nov 16, 2026
192394d
merge: keep current bot permissions and subagent tools with held-call…
bvsr365 Nov 16, 2026
0166c4e
test(bots): preserve master subagent rights and gate new tools after …
bvsr365 Nov 16, 2026
e425841
test(bots): seed held owner-tool grants for the dispatch gate cases
bvsr365 Nov 16, 2026
2339cdf
test(bots): forgetting an expired card keeps the existing unsent-card…
bvsr365 Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions docs/bots.md
Original file line number Diff line number Diff line change
Expand Up @@ -807,18 +807,42 @@ NULL `owner_set` means set before v10 (or by an older writer) and preserves toda

### Asks first

The engine for holding an MCP call until Send is built behind `experimental.botAsksFirst`, which defaults to off and has no settings control. With it off, granted tools run as before. Tool selection, the approval card, scheduled runs that wait, withdrawal and timed expiry are separate work before this can be switched on.
The engine for holding an MCP call until Send is built behind `experimental.botAsksFirst`, which defaults to off and has no settings control. With it off, new granted-tool calls run as before. Existing held rows still withdraw, expire, settle and clear their arguments. Send still works on a card left from when the switch was on; the switch gates only new holds. Tool selection, the approval card and scheduled runs that wait are separate work before this can be switched on.

A held call belongs to one piece of work and one runtime call in its dispatch. Mousse keeps its exact arguments in the action row until it settles; the chat, journal and export get a masked copy. Only unmistakable credential shapes are refused before a card is written: provider-prefixed keys, PEM private-key blocks, a password in a URL's userinfo, or a secret-named URL query value. Document IDs, base64 attachments, JWT-shaped page tokens and prose mentioning passwords remain reviewable. Values are not decoded or normalized to find more possible secrets: split or hex keys, upper-case `SK-` and a zero-width character inside `sk-` remain visible for the owner to judge.

A value is hidden by its key name only where the installed input schema declares that property, following `properties`, array `items`, local `$ref`, every `allOf`, `anyOf` and `oneOf` branch, `if`/`then`/`else`, `dependentSchemas` and indexed `prefixItems`. `$dynamicRef` is treated as unresolved. References have a cycle guard and a 32-step expansion limit. Under a broken, remote or depth-limited schema part, secret-named keys are hidden conservatively throughout that subtree; free-form keys elsewhere remain visible. Invented names in free-form objects stay visible, at every depth. The masked copy represents a hidden value as `{ "$mousse": "hidden", "text": "hidden · will be sent" }`; the exact value is sent unchanged on Send. Literal argument objects with a `$mousse` key are escaped as `{ "$mousse": "literal", "value": <the literal object with its children reviewed> }`, recursively. Text saying "hidden · will be sent" is ordinary argument text. `card_json.hasHiddenValues` records whether a hidden value actually exists, for the card to say so beside its buttons.

Argument text is never cut from the review: at most 256,000 characters of serialized argument JSON are accepted in total, and larger calls are refused with a request to send less. Send names the action and the argument digest shown with it. It is bound to the installed server's configuration, the server id and tool name, the tool's schema, the grant revision and the starting device's permission limit. A changed or expired binding needs a fresh review. Until the bridge carries whole large cards, a device's Send is refused when the complete message and its reply envelope exceed its 56 KiB limit: "Open it on the computer to send." Not now still works.
Argument text is never cut from the review: at most 256,000 characters of serialized argument JSON are accepted in total, and larger calls are refused with a request to send less. Send names the action and the argument digest shown with it. It is bound to the installed server's configuration, the server id and tool name, the tool's schema, the held server/tool pair and its permission level, and the starting device's permission limit. Unrelated permissions and a grant revision bump leave that binding intact; removing or changing the pair withdraws its card, and granting it again does not revive the old card. A changed or expired binding needs a fresh review. Cards held by the #1340 build use the older whole-grant binding and are withdrawn on upgrade. These are development profiles only; the upgrade fails safe. Until the bridge carries whole large cards, a device's Send is refused when the complete message and its reply envelope exceed its 56 KiB limit: "Open it on the computer to send." Not now still works.

Mousse makes the stored call once, without asking the model to recreate it. It commits approval and then the start of execution separately. After a restart, an approved call is checked again before running; a call whose execution had started becomes uncertain and is never repeated. A call that never left Mousse, or Not now, reads "Not sent". When the server answered with an error the row is `failed` but reads "The tool reported an error": the work gets its framed error and is told that the tool may have done part of it, so it must check before trying again. A request sent without an answer becomes `uncertain`, "Couldn't tell if it went through".

Settled actions join the same ordered, timed updates as waits, notes and answers. An action that caused the resume leads with its outcome. Its id is kept on the dispatch. Work's stored updates (waits, action outcomes, notes and answers, including work without wait history) count as told only when a dispatch carrying them produces model output or completes. Nonempty model text or thinking, or a model tool-call start, confirms delivery; merely preparing or starting a request does not. A failed, interrupted or replaced dispatch without that evidence leaves its updates pending, including after a time-limit card. A repeated update is acceptable; losing one is not. Carried/read (`read_at` and `applied_at`, plus the dispatch's `workDelivery`) keeps its existing meaning for late taps, Forget and compaction. Confirmation is a separate fact used only to decide what the next prompt carries: `unreadWorkAnswers`, `unreadWorkQuestion` and `unreadWorkNotes` include carried-but-unconfirmed updates without clearing those read markers. New carrying dispatches start with `prompt.workTold = pending`; `BotStore.confirmWorkDelivery` changes only that marker to `output` or `completed`. Reads happen before any confirmation write transaction, so a dispatch with no updates never opens one. A failed confirmation is caught and logged once per dispatch; it never fails the runtime's turn, and the next continuation can carry the update again. Completion of a new dispatch is confirmed explicitly; older rows with no marker also accept a completed stored outcome. Startup recovers a completion written before settlement. A usage retry carries the previous prompt's update ids, so it confirms only what that prompt contained. A database written by master as of #1339 has `workDelivery` for work that waited but no confirmation marker. If its carrying dispatch ended at a wall, a deadline or a turn cap, its notes and answers can be told once more after upgrading (twice is acceptable; losing them is not). Their carried/read behavior is preserved. Earlier databases with no such delivery ids gain no retrospective replay. Approval parks before a time or event wait and has no idle or week exemption.

A held call is withdrawn, with executable arguments cleared in the same transaction, when its work ends (Stop, failure or a limit included), its card or the owner's request is forgotten, or its grant changes. Removing its tool or MCP server withdraws it on positive configuration evidence or when a successful listing no longer contains that tool. Starting, failing and not-yet-listed servers leave cards intact; Send still checks the binding. An accepted call waits for its service for at most ten minutes after the tap. The row reads "Not sent". A tool or permission withdrawal lets the work carry on with the outcome through the same unread updates; forgetting only its card withdraws and forgets the call, then continues the work told: "Your owner removed this request. Do not ask for it again unless they write." No tombstone text is read back to the work. Forgetting its request ends the work through the normal engine ending, with its journal entry and release of scratch, browser, progress and live status. A work row stranded on a settled call without its continuation marker ends too. Forget of a card or its request also tombstones the content of every matching action, including settled calls, in both its record and export. A running call is never withdrawn: it settles, or becomes uncertain after a restart. Deleting the bot keeps withdrawn and settled rows until the 30-day purge.

`/clear` ends work waiting on its cards and removes the cards with the chat; running and settled action records stay, preserving the protection against running a call twice. `/reset` ends all work first and keeps those records too. `/forget history` also replaces every action's display arguments, argument digest, card metadata, bot note and stored result with fixed forgotten markers. The owner-message and work-note counters in its card metadata stay, as do its call key, target, status and timestamps. A forgotten row no longer matches an argument digest; the call key still prevents a second execution. A late result cannot restore forgotten content. Exact arguments of an already running call stay until it settles; the work's runtime transcript and the provider's own session are not rewritten.

An owner pause keeps a held card: a pause is not a refusal. Send says `Resume <bot> to send this.` while paused. Pausing also withdraws an approved call still waiting for its service; recovery while owner-paused settles it as not sent, and its outcome joins unread updates for Resume. An open card expires 48 hours after its row was written, including time while Mousse was closed or the computer slept. The engine's due timer reads `expires_at` directly, keeping the original deadline across restarts without another timer marker. Expiry clears executable arguments and reads "Expired · not sent"; the work carries on, told not to try the same call again without a new reason. Send checks that deadline before accepting the approval. An accepted Send must reach the service within ten minutes of the owner's tap (`APPROVED_SEND_WINDOW_MS`, from `answered_at`), independent of the card's original deadline. The due timer includes that deadline, so restart, sleep or a missing listing cannot leave it waiting indefinitely. Before dispatch the row stays `approved`, with message text `Waiting for <service>…`; execution changes it to `running`, "Sending…". Past the ten minutes it settles `failed`, clears executable arguments, and says `<Service> couldn't be reached, so nothing was sent.` The work gets that outcome once through the ordered update list and may decide to ask again. This timeout is neither a declined nor an expired card: it does not count toward the three-card rule or the identical-call refusal. Once dispatched, a running call settles normally or becomes uncertain after restart.

Forgetting a still-open or accepted waiting card blocks further calls of that tool in that piece of work until the owner writes or notes the work, including calls with changed arguments. Another tool is unaffected. Forgetting an already settled card only removes its content: it keeps its sent, not-sent, tool-error or uncertain outcome and does not block later calls. This uses a content-free owner-removal marker and owner-input numbers in the tombstoned card metadata; no digest or call content is kept for it.

After Not now or expiry, the same work cannot post another card for the same tool and argument digest until its owner writes to the chat or adds a note to the work. That refusal writes neither a card nor an action row; a Mousse update in the same ordered list preserves it for the next continuation. It is not an owner note: it neither steers the work as owner words nor starts another turn or report. Its delivery is confirmed on model output or completion, as for settled calls. Changed arguments may get a new review, but after three declined or expired cards for the same tool in the same work since its owner last wrote, further calls are refused until the owner writes or notes the work; the work is told to say what it needs in its report and wait. This uses the wake loop rule’s count and owner-input fact; the sentence says three cards were not sent, without treating expiry as an owner refusal. Any owner row, including a tapped answer to a question, lifts these refusals, as it does for wake loops. Only one call can wait at a time, and all later app tools are refused until it is answered. Send and Not now reset the work's wait chain and its repeated-wait history, as the owner's question answer does; an expiry does not.

The engine keeps its action-note and action-owner counters in `bot_memory_state` under `cursor:action-note:<work>` and `cursor:action-owner:<work>`. These survive restarts without a database-version change and are deleted in the transaction that ends the work. Pending Mousse refusal updates use `cursor:action-refusal:<work>:…`; their ids travel in `workRefusalIds` and they are removed when output or completion confirms delivery. Unconfirmed updates survive an interrupted continuation while work remains resumable (for example running, waiting or paused). They are deleted in the same transaction that makes the work terminal (`done`, `failed` or `cancelled`); startup also removes entries for already ended or missing work. All of this state stays out of the memory export and is removed by the bot's purge. The numeric owner/message facts in a tombstoned card remain for refusal decisions.

Send refusals use these owner-facing sentences, preserved by the chat service:

| Code | Sentence |
| --- | --- |
| `bot_action_expired` | This expired, so nothing was sent. |
| `bot_action_withdrawn` | No longer needed, so nothing was sent. |
| `bot_action_changed` | This changed since you saw it. Check it again before sending. |
| `bot_action_settled` | This was already answered. |
| `bot_action_gone` | This can't be sent any more. |
| `bot_action_paused` | `Resume <bot> to send this.` |
| `bot_action_unreachable` | `<Service> couldn't be reached, so nothing was sent.` |

Hidden argument values of four to eight characters require an adjacent character outside `[A-Za-z0-9_]` only at an edge whose own character is an ASCII letter, digit or underscore. Other edges require no boundary; longer values are replaced wherever they occur. Values shorter than four characters are left alone. Replacement runs in the server's own text before Mousse frames it, including JSON-escaped string echoes and numeric echoes. Credential masking still applies to the result. Transformed echoes (for example encoded, upper-case or truncated values) are not caught by this exact-value replacement. The stored result is capped at 64 KiB in total; images are omitted with a note, never cut into invalid data. Journal key-name masking applies only to work with a held action; other work keeps master's tool input capture.

Send is honoured from any device that may reach the bot, whatever that device's own permission limit, as an Allow of a permission is today (subject to the complete-card size check above). Executable arguments are cleared from the action row with every settled state. The model's own tool call, including its exact arguments, remains in the work's runtime transcript and the provider's session file. Mousse does not rewrite those transcripts; clearing the stored action arguments does not remove those copies. This covers Mousse's MCP calls, not commands, browser actions or actions on the owner's threads.
Loading
Loading