Repository navigation
feat(dashboard): open an existing peer session locally - #10288
Conversation
|
Intent: Make a remote crew's session row in the Sessions list open that session locally — bind a fresh local slot to the peer session that already exists and backfill its transcript — instead of switching the app to that crew's dashboard pane. |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Real gap, sound shape: server-authored row identity, peer-owned metadata with refuse-over-guess on The one accepted gap — peer-side turns after adoption never arrive, disclosed only by a birth-time notice — is explicitly stated, tested, deferred with a named mitigation (bounded re-read before the first local turn), and gated behind the preview flag whose purpose is exactly this feedback; it is a conscious decision, not an oversight, so it does not rise to a blocking or watch-level finding. [DESIGN-REVIEWED] 0de826a |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of All evidence is in. Reconciling: the blind reader understood the primary interaction (peer row → click opens the chat; shot-03's "Opening this session here…" spinner read correctly), but the screenshots show a superseded build — the chip reads bare "chick"/"astro" where HEAD renders "On chick", and the transcript notice the reader quoted ("The conversation continues there, and the crew still answers with it") no longer exists at HEAD; UX-Verdict: CONCERNS The shipped copy postdates the screenshots: every string the blind read choked on was rewritten, and the rewritten surface has never been shown or cold-read. Watch
Evidence gaps
Suggestions
[UX-REVIEWED] 0de826a |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS Two new inline bounded-read loops re-implement an existing helper, and two pre-existing crew chips get relabelled with no named person who was misreading them. Not justified as shipped
What this change shipsInventory (10 items) — 9 justifiedIntent: let a multi-machine user see and open sessions living on a connected peer crew from this machine's Sessions list — an ADDITION.
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] 0de826a |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsNo findings. The sole candidate reads the PR's intended fix as a regression. The new [OPUS-REVIEWED] 534b58e Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
ebbd257 to
f09fd4f
Compare
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
f09fd4f to
50ec517
Compare
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: no
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
Clicking a remote crew's session row in the Sessions list now opens that session HERE — in the local pane, with its transcript — instead of handing the whole app over to that crew's dashboard pane. Two halves, both in this commit: 1. DISCOVERY (carried forward from the closed #7444). The merged Sessions list reads each connected crew's slots and interleaves peer-owned rows with local ones by recency, keeping the two key spaces distinct so a colliding key cannot leak local pin/folder/unread/running state onto a peer row. 2. ADOPT (new). Clicking such a row binds a FRESH local slot to the peer session that already exists, and backfills its transcript. WHY THIS SHAPE instance_id + remote_slot forwards its turns to a slot on the peer. Its only create path mints a NEW peer session ("New chat on crew"), so there was no way to reach a session the peer's own user had already started — which is exactly the set this list shows. #7444 shipped those rows with a pane switch as the click, and the review objected: the row should open where it is listed. That objection was right, and this commit retracts the claim in #7444 that adopting an existing session was structurally impossible. It is not. The bind is a POST-CREATE STAMP in api_chat_slot_create, and the 409 remote_already_bound guard only fires when a create resolves to an EXISTING LOCAL slot. Adopt makes a fresh local slot, so the guard is not in the way: adopt simply feeds a caller-supplied peer key where create_peer_slot's minted one went. Everything downstream is unchanged. WIRE POST /api/chat/slots gains one optional field, adopt_remote_slot — the peer session's own key, as listed by GET /api/instances/{id}/chat-slots. No second endpoint: the local slot is created the same way either way and only what it binds to changes. Requires instance_id (the owning crew). 400 adopt_needs_instance adopt without a crew 404 adopt_target_unknown not a currently-listed peer session, or a hub-driven execution slot (not adoptable) 502 remote_bind_failed peer unreachable during validate/backfill VALIDATION AND OWNERSHIP The supplied key is validated against the peer's LIVE listing, through the same read the listing route uses (extracted here as read_peer_slots rather than duplicated). That rejects forged keys and excludes hub-driven slots for free. agent, title and memory_mode are inherited from the validated peer row, not from the request: memory_mode is the privacy boundary and the session it belongs to already chose it, so an adopt resolves NO local default — sending this machine's default risked turning an incognito peer session into a persistent local transcript. The peer wins on agent and title too, ahead of anything the caller sends rather than as a fallback: the adopt path offers no picker for either, so a caller-supplied value could only disagree with the session being adopted — opening the peer's conversation under a different agent than the one answering in it, or renaming the row the user just clicked. Adopt is idempotent, and that holds for concurrent requests as well as sequential ones. A repeat (instance_id, adopt_remote_slot) returns the same local slot instead of creating a second, and reads neither the list nor the transcript again. Two requests arriving together are decided by a recheck placed immediately before slot creation, after every await on the path: nothing between it and get_or_create_slot suspends, so on asyncio's single thread check-and-create is atomic without a lock. Two local slots bound to one peer session would not merely duplicate a row -- each accumulates its own turns, so the transcripts diverge and read_peer_slots filters the peer's row on whichever binding it happens to see. BACKFILL The peer's full history is read from its own slot path and appended before the first frame, redacted through the existing peer-text sink, capped by rows and reply bytes with a bounded-tail fallback and a visible notice when truncated. A failed or malformed read is a notice, not a 500 — the session still opens. The backfill is placed after the app-ownership and member-assignment checks so a create that is about to be refused never copies a transcript. An adopted session stops appearing as a peer row, so the list does not show it twice. TESTS 38 new backend tests cover bind-not-mint, the untripped guard, forged and hub-driven keys, unreachable/refusing/version-skewed peers, authorization (app tokens and non-owner identities refused), idempotency including a half-written binding, inherited metadata and redaction, backfill caps and failure modes, and row mapping. Frontend: the peer-row click is asserted to adopt (instance_id + adopt_remote_slot) and NOT to reach the pane switch, and to switch to the new LOCAL key the response names rather than the peer's key. The pane-switch assertions in the base spec are inverted accordingly; the federated Older-Sessions row keeps its selectInstance, which is a different row class and unchanged here. KNOWN GAPS - Relayed-turn pending approval is a pre-existing relay_remote_turn gap, not introduced here. - The visible session-peer-destination marker is removed: it existed to warn that the click did something the row did not promise, and adopt removes that surprise. Where the turns run is now carried in the row's title/aria hint. Worth a UX opinion in review. - UX screenshots are not captured in this commit.
|
|
|
|
|
|
|
self-added: yes
|
|
self-added: yes
|
|
self-added: yes
|
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsFINDING -- src/kiro_crew/dashboard/chat_handlers.py:2905 -- An untitled peer makes False positive or not applicable? A repository writer can comment: |
Problem / Motivation
You cannot see or open a session that lives on another crew. Your Sessions list shows only what this machine owns, so a conversation running elsewhere is reachable only by switching the whole app to that crew's dashboard pane.
This PR builds both halves of that: the Sessions list learns to show a connected crew's sessions, and clicking one opens it here.
Why it matters
The Sessions list promises one thing: these are your conversations, click one to open it. For a multi-machine user it silently omits most of them, and the only way in navigates away from everything else.
What changed (motivation → approach → change)
Two things ship together, because neither is useful alone. A connected crew's live sessions now merge into this machine's Sessions list, ordered with local rows by recency and badged with the owning crew (
useInstanceSessions.ts,GET /api/instances/{id}/chat-slots). And clicking one opens that session here: the hub binds a fresh local slot to the peer session, copies the peer's transcript into it, and you land in a real local conversation whose turns keep running on the crew that owns it. The whole surface is behind Settings → Developer → Feature Previews → Remote instance sessions, default off.The row you clicked becomes that session. It does not get replaced by a new row beside it. That is the whole reason
row_identityexists on the wire: the server is its only author./api/instances/{id}/chat-slotsstamps<instance_id>:<peer_key>on every peer row it shapes, and the projection resolves the same string for a remote-bound slot — minted on a crew throughcreate_peer_slot, or opened from a peer row — so the identity the peer row carried survives the binding. The browser reads that value and never composes the format itself, because two spellings of one contract is how the equality that makes this work goes unchecked. The sidebar keys rows on it, so one element re-renders where a fresh key would mount a second one.identityis deliberately not the local slot key and never becomes it; readkeyfor the local slot, because splitting the identity yields the peer's key, which is routable only back through that instance. The list drops a peer row whose identity a local slot already claims, because the client's cached peer listing can be older than the binding.The Older Sessions pane keys its own rows by owning crew for the same reason, against a different field: a federated search row names the peer that answered in
instance_id, and two crews can return the same deterministic key, so without that the pair would reconcile as one React child and a row would vanish from the drawer.flowchart LR subgraph Before A1[click peer row]:::ctx --> B1[switch to crew's pane]:::removed end subgraph After A2[click peer row]:::ctx --> B2[bind local slot<br/>+ backfill transcript]:::added --> C2[same row, now local]:::changed end classDef added fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:2px classDef changed fill:#FEF3C7,stroke:#D97706,color:#78350F,stroke-width:2px classDef removed fill:#FEE2E2,stroke:#DC2626,color:#7F1D1D,stroke-dasharray:4 3 classDef ctx fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E linkStyle 0 stroke:#DC2626,stroke-dasharray:4 3 linkStyle 1,2 stroke:#16A34A,stroke-width:2px🟩 added · 🟨 changed · 🟥 removed · 🟦 unchanged
Clicking a crew's session opens it on this machine, in the row you clicked, instead of navigating away.
The peer decides what the adopted session is, not the request. The peer's
agent,titleandmemory_modeare authoritative, and a peer row that reports nomemory_modeis refused withadopt_peer_mode_unknownrather than resolved to this machine's default.memory_modeis the user's privacy boundary: guessing it would turn anincognitosession on the crew into apersistentone here, writing memory the user never agreed to. A crew whose rows predate the field reaches that case on version skew alone, so the refusal is the only answer that cannot leak. Beforeagentortitleis persisted, hidden Unicode is stripped and credential redaction runs, matching the peer-list sink so a zero-width character cannot split a secret around the redactor.An adopted session assumes exclusive hub-side driving from the bind onward. The backfill is a one-time copy: turns started here are mirrored per-turn and opt-in (
remote_mirror.py,?relay=1), so a reply that finishes on the crew after the copy, and anything a peer-side user sends later, is not pulled in. Every adopted transcript therefore starts with the boundary in plain words: new turns started on the named machine after opening this chat do not appear here; continue the session here. That makes an absent peer-side turn visible rather than letting a stale local transcript claim to be complete. A bounded re-read before the first local turn remains a possible mitigation; merging independently appended transcripts after local turns begin is a separate design problem.Two adopts racing for the same peer session resolve to one slot: the create path re-checks for an existing binding immediately before
get_or_create_slot, with nothing awaited in between, so on asyncio the check and the create are atomic. The loser of that race gets the winner's slot, not a 404 — already-linked and forged-key are different answers. A peer slot that closes after the list check but before its transcript read is different again: a transcript 404/410 aborts before a local binding exists. The peer-side sibling guard requires every?relay=1send to target an existing slot, so a still-later close fails withslot_not_foundrather than recreating an empty peer session under the vanished key. A transcript that is still streaming on the peer is dropped rather than persisted as a finished reply, with a notice in its place, because a half-written turn copied as complete would read as the model's final word. The full-history read retries with a bounded 500-row tail only when its reply crosses the byte ceiling. HTTP, transport, parse, and shape failures use the visible copy-failed notice instead, because they do not prove any older message was dropped.Two smaller surfaces come with the listing. The board view shows no peer rows at all — it says how many were left out instead, because a board column is a drag target and a row that lives on another machine cannot be dragged into a local folder. And while the crews are being read the list says checking remote instances, with one banner for the whole read when it fails rather than an error per crew, so a hub with several unreachable crews shows one line instead of a stack of them.
A crew's own name marks the rows that belong to it, and the row says what clicking will do. Every shared crew chip reads On , not a bare name, so a running row still says where it lives when the more useful live state occupies the one status line. One pill marks every session whose turns run on another machine, because a session opened here and a session not opened here yet are the same kind of thing — the same
executor/instance_id/remote_slottriple, the same relayed turns, the same actions that have to happen on the crew. What differs is a lifecycle stage: an unopened peer row's status reads On — click to open here, and the line goes away the moment the row becomes local. Any live state the crew reported — a turn running, an approval owed — outranks that line. Each pill's tooltip names its own outcome, which differs by row: a live peer row opens the session here, a search result switches to the crew that owns it.Change accounting
docs/feature-map/README.mdsrc/kiro_crew/dashboardsrc/kiro_crew/docssrc/kiro_crew/instancessrc/kiro_crew/security_posture.pywebsite/src/apiwebsite/src/componentswebsite/src/i18nwebsite/src/pageswebsite/src/storewebsite/src/typesrow_identity.website/src/utilsTests
test/test_remote_crew_adopt.pycovers the link handler: peer-ownedagent/title/memory_mode, hidden-Unicode credential splitting in inherited metadata, an empty peer title staying pinned, refusal when the peer reports no valid mode, concurrent links resolving to one slot, a transcript 404/410 aborting without a local binding, other copy failures remaining visible and non-fatal, in-flight and truncated history notices, the always-present exclusive-driving boundary, and persistence of copied rows.test/test_remote_crew_execution.pyrequires a relayed send to target an existing peer slot, returningslot_not_foundwithout invoking slot creation when that target vanished. Both vanished-slot tests are mutation-checked.Two tests pin the equivalence the sidebar's shared marker depends on: a session opened from a peer row carries the same
executor/instance_id/remote_slottriple a minted one does, and it is refused the same crew-only actions with the sameremote_action_unsupported409. Opening a session from a peer row respects the switched-away guard: switch to another session while the peer call is open and the view stays where you put it. A failed transcript copy has to name which chat is the session, not only where the turns run.test/test_remote_crew_peer_slots.pycovers the listing route, including that a peer reply this hub cannot parse answers 502 — a dict instead of a list, and a deeply nested document whose parse exhausts the interpreter stack — rather than surfacing as a 500 from the gateway.website/src/test/ChatSidebar.instanceSessionsMerge.test.tsxcovers the row: a peer row links instead of switching panes, switches to the returned local slot, respects a user switching away during the link, keeps one row when a local slot and stale peer row share an identity, and renders one status line while linking. It pins both visible states: an idle peer row says On — click to open here, while a running row keeps its live state and the chip itself still says On .website/src/test/useInstanceSessions.test.tsxcovers the listing hook.test/test_chat_slot_facade_contract.pypinsrow_identity's projected position, andtest/test_remote_crew_peer_slots.pypins the listing identity byte-equal to the bound-slot projection.Manual verification
The feature is behind Settings → Developer → Feature Previews → Remote instance sessions (default off). With it on and a crew connected, a peer session's row is clickable, opens locally with its history, and stays a single row across the bind.
Screenshots / video
Related Issues
no linked issue: reported in conversation as a UX complaint about the Sessions list, not filed as a tracked issue.
Pattern harvest
The reusable idea is that row identity is a server concern when two channels feed one list. Local slots arrive on the authoritative push and peer rows on a per-crew poll, so only the server sees both sides of a binding at once. Resolving identity there — and keeping the pre-binding identity across the bind — is what lets the client render a transition instead of a replacement, without the client having to reconcile two freshness domains.
Checklist
tsc -b, flake8, mypy, isort, black and the comment-history gate run locally