Repository navigation
feat: remote-tool confirmation card in the chat; confirmer on interactive turns (#4291, 3/3) - #4321
Merged
Merged
Conversation
…onfirmer, frontend card (local, not pushed) Remaining: rebase onto the fixed #4320 head and then origin/main; run quality:fix, shape/types/node-types checks, test:changed; mutation batch; PR body. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…d cards, restart cancel, shared vectors) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ge subtypes Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mstomar125
force-pushed
the
issue-4291-confirm-card
branch
from
November 20, 2026 11:34
4ee2218 to
35dcc76
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3 of 3 of the remote-tool confirmation wiring (#4291; user ruling 2026-11-20: the confirmation is an in-chat card, answered in the same turn, default No). With this, a
tool-cli/tool-mcptool (and a non-GET or credentialedtool-resttool) is offered to the model on an INTERACTIVE turn, and each call asks the user on a card in the chat.Agent lane. This touches
packages/agent(Michael's lane), the daemon, core's schema and the desktop app. The user's sign-off for the #4291 remote-tool build stands in for Michael's.Docs first: the
node-types.mdsheet is docs PR https://github.com/NodeSpaceAI/nodespace-docs/pull/167.node-types:checkreads the docs commit, so that PR merges just beforebun run mergeof this one.node-types:checkpasses here against that branch.What it does
ai-chat-messagegains the part kindconfirmationand five optional fields:confirmation_idandconfirmation_digest(device-local, so another device never sees them),confirmation_status(pending|allowed|denied|expired|cancelled, closed enum),confirmation_arguments(the arguments JSON, whole),confirmation_credentials(references only). A behavior rule keeps the confirmation fields on a confirmation part of an assistant message. Shape record regenerated with a change-log entry (classrefuse: an older database is refused until reset), TypeScript regenerated.ChatCardUiwrites the card as a message at the end of the chat, so it sits after the user's message and before the reply the turn writes when it ends, and sets its status once when the question ends. The card is never part of the conversation the model sees (message_nodesleaves it out of the history and out of "whose turn is it", so a pending card cannot hide the user's message from recovery). A turn's unanswered questions are dropped, and their cards ended, however the turn ends (a guard, a dropped future included); a card left pending by a restart is cancelled during recovery.ConfirmationRequestnow also carries the credential references (credential_references:NAME from keychain:x,bearer from env:Y; references only, bounded).confirmer_for_turnreturns a confirmer only for a turn started by a message the user wrote. A turn recovered after a restart gets none, so a tool that needs confirmation is not offered there. (There is no scheduled/headless chat turn today; if one is added it must passinteractive = false.)RemoteToolConfirmationCard, rendered by the native chat viewer in place. It shows: the credentials on their own line from the separate field, always visible; the whole summary (destination) as plain text; the arguments cut to a preview with an expander that shows all of them and their real size in bytes; control, bidi, zero-width, line/paragraph-separator, tag and variation-selector characters shown as visible escapes in BOTH the summary and the arguments through one function (toDisplaySafe, with a shared test vector of one character per class). Two choices in NodeSpace's own words: "Don't allow" (focused when the card appears; Escape and Enter do it) and "Allow once"; allowing is never remembered. A pending card is a live region. It answers at most once.local_agent_answer_confirmation. Before the buttons are enabled the card recomputes the digest of what it SHOWS (length-prefixed SHA-256, same as the daemon, with shared vectors) and compares it with the daemon's, and checks that the credential line's references appear in the summary: a card whose text was changed after the daemon wrote it cannot be answered.Folded in from the #4320 review
spawned::record(pid, leads_own_group): a program started with its own group (process_group(0), or a PTY child) has its group recorded as its pid unconditionally, even if it is gone before the kernel can be read; a program sharing the daemon's group is recorded by pid only, never by group. A real-process test pins that the daemon's group is not recorded (an unrelated same-group process and the test process stay "not a tool"), which is the regression that would refuse the tray-spawned UI. Module docs and this body state the notes: thesetsid/setpgid-with-parent-exit limit (the fix is the macOS audit token + code-signature check, a follow-up); the card's id and digest are stored in the chat node, so any same-user tool can read them (nodespace get): the id is not a secret from tools and the peer gate is the only barrier; a UI started from the in-app PTY terminal or by an ACP agent descends from a recorded program and is refused (fail closed, acceptable).Review round 1 (fixes)
scripts/aichat.ts) starts a turn with the confirmer installed. The real gate is the human click through the app's Tauri command plus the peer gate on the answer RPC, not "who started the turn". A recovered turn is not interactive:TurnOrigin::{UserMessage, Recovered}, withis_interactivepinned by a test.confirmation_id/confirmation_digestto peers: no security impact (a peer's tables do not know those fields) but a peer shows a card it cannot answer.credential_referencesandenvironment_noteagree.is_unsafe_for_log; the card's content is exactly the summary and its digest recomputes. Both sides now also cover U+00AD, 034F, 115F/1160, 17B4/17B5, 2061-2064, 206A-206F, 3164, FFA0, FFF9-FFFC and 1D173-1D17A. The card's summary, preview, credentials and full arguments aredir="ltr"withunicode-bidi: isolate.confirmation_id) is cancelled in EVERY native chat, not only stuck ones; a peer's card (no id) is left alone. A status write retries 8 times with backoff.create_nodeandupdate_nodenow refuse any conversation record (a chat, a message, or a subtype of a message) so an injected agent cannot write one through its own tools; the daemon's own writer is unaffected. This does NOT make a forged card impossible: recorded tool processes can still write nodes through the CLI / gRPC socket (generic node create and update are not gated), and the card only checks thatconfirmationIdis PRESENT ({:else if !requestId}), not that this daemon issued it. A forged card with any made-up id, or a copy of a real one, renders "You allowed this call. Whether it ran is in the reply below." The forgery is COSMETIC: a forged pending card cannot be answered (the daemon refuses an unknown id), and nothing reads a card's status to grant any capability. The id-less branch ("A question recorded on another device.") protects against a PEER's card only once Sync declares these fields local-only (see the release order). Not done: the daemon exposing which ids it issued.nodespace-proto/nodespace-coreartifact from another worktree had broken the build):cargo test -p nodespace-daemon --lib -- chat_card only_a_turnpasses (12 tests, named in the run); the startup-cancel / peer-card-left-alone and recovered-origin mutants are killed by real failing assertions. A recovery INTEGRATION test (a recovered stuck turn gets no confirmer) is not added: the host reads the real keychain for its approval key, so a test cannot make a remote tool offerable; the call site mapsRecoveredto a non-interactive turn and the mapping is pinned byTurnOrigin::is_interactive.refuse_conversation_recordalso refuses a subtype ofai-chat-message(type_is_a); a case or whitespace variant of the type name is refused as unknown (tested). A subtype-creating test is not written (it needs a schema extending the message type).ChatCardUi::presentis documented as not cancel-safe between the write and remembering the id (the turn's end and the next start end such a card as cancelled); the card sits in arole="listitem".cargo test -p nodespace-agent --lib -- spawned::tests::real_processes the_credential_referenceslists and passes:a_program_sharing_the_daemons_group_does_not_make_that_group_a_tools,a_program_that_leads_its_group_is_recorded_even_if_it_is_gone_before_it_can_be_read,the_credential_references_of_a_binding_are_listed_without_values(plus the new ones above).SchemaMismatch's message, naming the missing fields).Verified
quality:fix,test:changed(types:check, shape:check, node-types:check against the docs branch, rust:test 232 s) pass.NOT verified live
The full path in the real app (Tauri UI -> gRPC -> daemon peer gate -> a model-driven tool call -> card -> answer) was not run: the run-app skill says a scratch launch still replaces the user's per-user launchd job and shares the webview storage, and a tool call needs a model (none loaded). To check by hand: launch with
HOMEandNODESPACE_HOMEboth set to one scratch directory, create atool-clinode (e.g.echo) in that scratch database, enable and approve it on this device, ask a question that makes the model call it, and confirm the card appears in the chat, "Don't allow" is focused, Allow runs it once, a second answer finds nothing, and the card shows the outcome; then check~/.nodespacegained nothing. The enable-and-approve command is a separate later PR, so approval is written with the existing device key for now.🤖 Generated with Claude Code