Repository navigation
fix(chat): relay remote crew approvals and approval mode to the peer - #16509
iamwhatever wants to merge 1 commit into
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check before merge: no live hub-to-peer run was done. Confirm the peer's real What this change shipsInventory (9 items) — 9 justifiedIntent: a user chatting on a connected crew can answer that crew's tool approvals and set its approval mode from this dashboard. FIX (#10618; it closes the "KNOWN GAP" the base
[FIRST-PRINCIPLES-REVIEWED] d93d857 Description read[DESCRIPTION-READ] e2aadbc24e09924772e70d5d15255d06e79d0eb200dfb194dc402ae9cee1ac01 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS After a remote YOLO the picker still shows the interactive floor while the peer auto-approves every session; the hub user can't see that YOLO is armed. Watch
[DESIGN-REVIEWED] d93d857 Description read[DESCRIPTION-READ] 3ba6ad4ae551fb62fcc1f7829ad1b5d4e75cec5a8097a38c4fe97563e83a057d That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
84cfbfa to
2709d6d
Compare
|
|
|
UX Review (Opus 5.5) — 🔴 BLOCKUX-level review of UX-Verdict: BLOCK cannot evaluate: missing screenshots of the approval card in a remote crew chat, and of the mode picker after Trust or YOLO is picked there. BlockersThe picker contradicts the user's choice. On a remote chat, picking Trust or YOLO forwards the mode to the peer, but this gateway saves no mode state. Evidence gaps
[UX-REVIEWED] d93d857 Description read[DESCRIPTION-READ] 4d0acce0b37f4470a3df0330ce286f0638cffee6903b166f97145030b4437c9f That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
2709d6d to
799788a
Compare
|
|
|
|
|
|
|
|
|
|
|
|
|
0e2fc09 to
cfe35b4
Compare
|
|
|
|
|
|
|
|
|
|
|
A remote-bound chat showed the peer's permission requests with no way to answer them, and approval-mode changes stayed on this gateway, so the peer waited until its approval or turn timeout. Each pending peer permission row now gets a local placeholder future so the card is projected and answerable. The decision is forwarded to the peer slot's approve route and the card is retired only after the peer accepts; the peer's own approval_resolved frame or the end of the relayed turn retires it otherwise. A slot-scoped mode change, yolo included, is applied on the peer first and only mirrored locally; this gateway's YOLO override is untouched. Resolvers that never reach the peer skip remote-bound slots. Fixes #10618 Co-authored-by: Ashvin Nihalani <ashvin.nihalani@gmail.com>
cfe35b4 to
d93d857
Compare
|
|
|
|
|
Closing this PR as superseded by the remote-crew sidebar RFC (#16489, The branch Three real bugs came up while driving this PR. Wave 3 should keep the same checks:
Thanks again, @ashvinnihalani. Your design and the bugs it surfaced feed straight into wave 3. |
Takes over #10638 by @ashvinnihalani, redone on current main. Thank you, Ashvin: the commit carries your
Co-authored-bytrailer.Problem / Motivation
Goal: A chat whose turns run on a connected crew lets the user answer that crew's tool approvals and change its approval mode, YOLO included.
In a chat made with "New chat on crew", the peer gateway runs the tools, but this gateway shows the chat. A peer permission request reached this side as a transcript row with no answerable card, so the peer waited until its approval or turn timeout. Picking Normal, Reads, Trust or YOLO changed only this gateway, so the peer kept asking (#10618).
Why it matters
Remote crew chats stall at every gated tool in an interactive mode, and the approval picker shows a mode the machine running the tools never got.
Not a goal
What changed (motivation → approach → change)
Symptom: no card, and the mode stays local. Cause: the card is projected from
slot._approval_futures, which a relayed turn never filled; the approve and mode routes acted only on local state.Approach: the peer stays the owner. This side forwards, and changes local state only after the peer accepts.
remote_relay._apply_rowgives each pending peerpermissionrow a placeholder future, so the existing card renders and is answerable.api_chat_slot_approveon a remote-bound slot forwards the action (and a trust pattern) to the peer slot's/approve. The peer validates trust grants against its own row and governsyoloby its own policy. A refusal returns 502 and keeps the card retryable.chat_utils._build_stream_chunk, relay mode only) sends a permission row's ownmidasrequest_mid; the mirrored row keeps it aspeer_request_mid. A peer row without it (an older peer) gets no card and stays a plain transcript line. Allow / Reject / Reject once are forwarded withorigin=nativeand thatrequest_mid, so the peer's own instance check refuses a stale decision for a request that reuses the id; locally only the clicked instance is settled.origin=native,request_mid;website/src/components/chat-input/approval.ts), so a stale card can never decide a later request reusing the id. The generic/api/approvals/{id}route never decides a remote card.approval_resolvedframe retires the card (peer timeout or peer-side click). When the peer's turn ends, any leftover is recorded as rejected; when the stream is cut or cancelled, the placeholder is only dropped, since the peer may still be waiting./api/chat/modeon a remote-bound slot,yoloincluded, is applied on the peer's slot and writes no mode state here. This gateway's process-wide YOLO override is never armed or ended for it.yoloarms the PEER's process-wide override, exactly as picking YOLO on the peer's own dashboard does: every session on that peer is auto-approved until it expires. Only this gateway's dashboard owner can send it, over the owner's own instance tunnel, and the peer'sapproval_modespolicy decides whether it may arm.ApprovalCoordinator.resolve, the all-sessions Trust / Reads grants and the trust sweep skip remote-bound slots, so nothing settles a card the peer still waits on.deny_non_owner_remote_operationand are pinned in the existing_PEER_SINKSguard.Versus #10638: its rollback-token protocol, two-gateway YOLO coupling and id-ambiguity changes are left out. All four GPT-lane blockers on #10638 sat in that mechanism. Here a refused peer call changes nothing on either side, so nothing needs rolling back.
Backwards compatibility
Compatible: local slots take exactly the old paths; only
executor == "remote"slots branch.Reader: src/kiro_crew/dashboard/interaction_coordinator.py:ApprovalCoordinator.resolve -- entry: chat (Slack card clicks via
state.resolve_approval) -- remote-bound slots are skipped; local slots unchanged;test_a_bare_id_resolver_cannot_settle_the_cardReader: src/kiro_crew/dashboard/chat_handlers.py:api_chat_mode -- entry: chat -- a remote-bound slot no longer arms this gateway's YOLO; the peer's is armed instead;
test_yolo_arms_the_peer_and_never_this_gatewayTests
New
test/test_remote_crew_approvals.py: card appears for a pending peer row and not for a resolved one; peerapproval_resolvedand turn end retire it; bare-id resolver cannot settle it; Allow / Reject once / Trust / YOLO / scoped-pattern decisions are forwarded and widen nothing locally; peer refusal keeps the card; half-bound slot gets 409 before the peer; Normal / Reads / Trust / YOLO modes forward to the peer; refusal changes nothing; all-sessions trust leaves the peer card pending; exact peer routes and bodies.test/test_remote_crew_execution.py:_PEER_SINKSnow includes the two new sinks.New cases also cover: a truncated turn records no rejection; a forwarded mode writes no local mode state; a request reusing the id mid-forward stays pending; a row without the peer instance is not forwarded; a row built by the real drain carries its mid through the real reader.
Local at
-n 2:test_remote_crew_approvals.py,test_remote_crew_execution.py,test_chat_slot_facade_contract.py,test_dashboard_approval.py,test_chat_mode_security.py,test_error_code_contract.py: 493 passed;ChatInput.approval.test.tsxremote-card case passes (3 pre-existing failures in that file reproduce on main locally).Manual verification
Not run over a live hub → peer tunnel. Both handlers and the relay boundary are driven directly in tests.
Screenshots / video
Why no screenshot: the only frontend change,
website/src/components/chat-input/approval.ts, changes which route a remote-bound chat's card click is sent to (slot route withorigin=nativeandrequest_mid); nothing it renders changes, and the card itself is the existing one projected from the slot.Related Issues
Fixes #10618. Supersedes #10638 (to be closed once this merges). #14279 (approval sound for an unanswerable relayed card) is not folded in: the card is now answerable, so the sound is correct.
Pattern harvest
Rule candidate: review-prompt
Pattern: a relayed control plane forwards to the execution owner first and mutates UI-owner state only after it accepts, so no rollback path is needed.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)