Repository navigation
feat(instances): send a folder's sessions to a crew and recreate the folder there - #19859
koenvincent wants to merge 2 commits into
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the folder name is an opt-in field the receiver can ignore, and the client loop reuses the existing Notes
[DESIGN-REVIEWED] f134d64 Description read[DESCRIPTION-READ] 8350c4c9a801431a62254a40294325a4e8957567e2ff270ed7a3878c1a507488 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 |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item answers the stated harm: you can't send a whole folder, and its grouping is lost when it arrives. The single-session default and its byte-identical bundle are unchanged, so this is a new capability beside the old one, not a product-shape change. What this change shipsInventory (9 items) — 8 justifiedIntent: let a person hand a whole folder of sessions to a connected crew and find them grouped under that folder there. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] f134d64 Description read[DESCRIPTION-READ] 582d67f79b97c37aff3f8d6a5c7656ce78d7578683f5392553760c1cb39afef1 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS The eight committed screenshots cover every state of the new submenu: sending, partial, done, transcript-only, disconnected, nothing to send, skipped sessions, and a failed list load. Nobody has done a first-time blind read, because this lane reviews forks without one. Notes
[UX-REVIEWED] f134d64 Description read[DESCRIPTION-READ] 78b6955dc812446c1cd41b72f1afa559282d534f9816744f485a2e1555e99090 That sha256 names everything this verdict read: the PR description, plus the 11 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 (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. None of the five candidates holds up when checked against the code. Two are documented or intended behaviour, one is already caught by the snapshot's re-check, one is an advisory docstring point, and one needs an unlikely sequence of user actions and does little harm. [OPUS-REVIEWED] a46502a |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
aa930b0 to
7011954
Compare
|
Addressed at 7011954 (2 commits: the feature, then the screenshots):
I kept the "transcript only" wording, because the session submenu already uses it for the same outcome. The two-gateway check is still open, as the description says. |
7011954 to
f5fd8e8
Compare
|
CI follow-up at f5fd8e8 (still 2 commits):
|
f5fd8e8 to
7469168
Compare
|
HOLD at The code reads sound. The sender redacts and clips the folder name and only adds it when This still needs a human, for two reasons:
What would clear it: post the two-gateway run, add one sentence to KiroCrew/src/kiro_crew/dashboard/session_transfer.py Lines 633 to 647 in 93d77b8 — crew-pr-reviewer (r115) |
|
|
|
|
|
|
|
|
|
HOLD at 1ed2cae. This still needs a maintainer. The PR changes what the session-transfer bundle carries to a peer and how that field is redacted (
The r115 items have replies. All 88 checks pass with 12 skipped. Open on this head:
What would clear this: a maintainer reviews the transfer change and the two-gateway run is done, and items 2 and 3 have dispositions on this head. Reviewed head: 1ed2cae — crew-pr-reviewer (r117) |
|
@iamwhatever replies to the r117 items on 2. First Principles item 6 (two state channels): fixed by dropping the mutation. The send state has to outlive the menu closing, so the module-level store ( 3. UX notes:
Tests: the submenu suite pins the counted hint for 1 and 2 copies and the folder line (shown, and hidden with nothing to send). Putting back the singular key, or removing the line, each turns a test red. The 38 translation suites (906 tests), the typecheck, eslint, the plural codemod check and the line-cap, comment-history and feature-map gates pass. The capture script re-took all 8 frames on this head and checks both new texts; the description links them. Item 1 (maintainer review of the transfer change and the two-gateway run) stays open; I can't run two gateways from here. |
|
Re-pushed as |
|
New head |
|
|
HOLD at 75e840e. This needs a maintainer. The PR changes what the session-transfer bundle carries to a peer and how that field is redacted (session_transfer.py#L631-L647), and the receiver files a name from an untrusted bundle. Policy reserves that for a human. I found no defect: the name is redacted and clipped on both sides, Open on this head:
What would clear this: a maintainer reviews the transfer change and the two-gateway run, and item 1 has dispositions. — crew-pr-reviewer (r127) |
|
Item 1 of the r127 HOLD is addressed on
Both strings are updated in Item 2, the two-gateway run, is still open. |
|
On item 2 of the HOLD, the two-gateway run: I tried it today on an isolated Linux host with this branch at The checks I would run are written down: three sessions with one incognito, arrival under |
|
Opened #30231 for the two-gateway run and linked it in the description, so a maintainer can defer it there. The rest of this PR waits only on human review. |
Problem / Motivation
Goal: Let a person send a whole folder of sessions to a connected crew, and find them on the crew under
Imported›from <this instance>›<folder>."Send a copy to ▸
<instance>" exists on every session menu, but not on a folder. Moving a project's worth of sessions to a crew means opening each session's menu in turn, and every copy then lands flat inImported/from <sender>beside every other session that machine ever sent, so the grouping the person had is lost on arrival.Why it matters
A folder is how people group a project's sessions, and handing a project to a crew is exactly when that grouping matters most. Today the copy works but the structure does not survive it, so the receiving sidebar has to be re-sorted by hand after every hand-off.
Not a goal
send-sessioncall.What changed (motivation → approach → change)
Sender.
POST /api/instances/{id}/send-sessionaccepts an optionalwith_folder: true(strictly the boolean).build_transfer_bundle_async(..., with_folder=True)then adds the session's folder name to the bundle as an optionalfolderfield, read on the loop with the rest of the snapshot and egress-redacted like the title (credentials, exfiltration URLs, local paths). Off by default, likewith_source, so existing callers emit exactly today's bundle.Receiver. The importer reads
folderas a filing hint and passes it toarrival_folder_id, which adds a third level:Imported/from <sender>/<folder>. It follows every rule of rfc-arrival-provenance-filing.md, amended in §4: a label from an untrusted bundle that names a row and confers nothing, redacted on both sides, clipped the way the store writes a name, never filed for an app-scoped arrival, and resolved in the same singlemutate_folderstransaction. It is optional in the ceiling, so a store with room for the provenance pair but not a third row files intofrom <sender>, and a folder-carrying arrival never lands less filed than one without. A non-stringfolderis dropped, not refused. The rollback already walks created rows in reverse, so a failed import unwinds all three.Dashboard. The folder menu (⋯ and right-click, one renderer) gains "Send a copy to ▸
<instance>" (SendFolderToInstanceSubmenu). It reads the folder's membership rather than its filtered render, sends each LOCAL persistent session in turn withwith_folder: true(sequential, so twenty sessions are not twenty simultaneous bundle builds against the peer's slot cap), and reports progress and the outcome on the row:1 of 3,Sent: 3, or the transcript-only count. A partial send shows2 of 3 sentand the first error through the sharedErrorNotice(under the crew name), with its agent hand-off as a siblingErrorNoticeMenuItem; clicking the row again resends only the sessions that failed, so the copies that landed are not duplicated. A click callsstartFolderSenddirectly, and the send's state lives in a module-level store outside the menu (useSyncExternalStore), keyed by folder and crew: closing the menu mid-send loses nothing, a reopened menu shows the running send (its row refuses a second, overlapping one) or its result. That store is per tab and in memory, so another tab, or this one after a reload, can start an overlapping set of copies; each copy is independent and the finished row warns that a click sends duplicates. Incognito and temporary sessions are left out and counted in a visible row, the same refusalsend-sessiongives them. It hides itself without configured instances and lists a disconnected crew disabled, like the session entry.Strings. Eight new keys under
components.sendFolderToInstanceSubmenuinen, the 11 translated locales and the regenerateden-XA; the plural base is registered inpluralKeys.json.Backwards compatibility
folderkey and files the copy infrom <sender>as today.send-sessionor the file export.Tests
test/test_arrival_folders.py: 8 new cases (three-level create in one transaction, adopt, two senders with one folder name stay two rows, no sender, full store files one level up, clip, app arrival still unfiled, rollback unwinds all three).test/test_session_transfer.py(sending side) andtest/test_session_transfer_landing.py(arrival), the files test: split test_session_transfer.py and test_crew_log_emit.py by topic #22132 split the old suite into: 8 new cases (import files into the named folder, malformed hint dropped, byte-identical bundle without the field, egress redaction of the name, name read by id, andsend-sessioncarries the folder only forwith_folder: true, not when absent or"yes").website/src/test/SendFolderToInstanceSubmenu.test.tsx: 8 cases (self-hiding, connected vs disconnected rows, nothing to send, visible skipped row, progress/full/partial outcome with theErrorNoticeand its hand-off wired byaria-describedby, the send loop's order, flag and continue-on-error, retry of only the failed keys, and state that is recorded with no component mounted). Mutation check: retrying every key instead of the failed ones turns the retry test red.main453cc4b:test_session_transfer.py,test_session_transfer_landing.pyandtest_arrival_folders.py(153) pass, as doSendFolderToInstanceSubmenu.test.tsx(10),tsc, mypy, flake8, the i18n gate and docs lint. Earlier, onmain3f30a58:test_session_transfer.py,test_session_export.pyandtest_arrival_folders.py(376) passed; the two submenu files and 9 folder-menu sidebar files pass (108); black, isort, flake8, mypy, ESLint, the i18n key gate and the feature-map gate are clean. Mutation checks: disabling the folder level turns the three-level test red, and ignoringwith_folderin the handler turns the handler test red.b169b99725, rebased ontomain6fd7c1f): the sending-side folder tests moved totest/test_session_transfer_folder.py, sotest_session_transfer.pyis back to 1,549 lines (Opus,keep-modules-small).SendFolderToInstanceSubmenu.test.tsx(11) adds: a finished row shows the "send all again" line on screen, a transcript-only row shows what that means on screen, a sending row is not disabled (full contrast) and ignores a press. Reverting each of those four changes turns its test red. 153 backend tests in the transfer and arrival-folder files, mypy,tsc, ESLint, the i18n gate, the line cap, docs lint and the comment-history and feature-map gates pass.Manual verification
Not yet run end to end between two live gateways: it needs a build carrying this change on both the sending and the receiving instance. Planned before merge: send a folder of three sessions (one incognito) to a crew and confirm
Imported/from <sender>/<folder>with two sessions on the crew andSent: 2with the skipped hint on the sender.Screenshots / video
Taken by the committed
website/scripts/capture-19859-send-folder.mjs, which checks each frame's claims in the page and fails otherwise. Opened from a folder row's ⋯ button in a real browser: the REALSendFolderToInstanceSubmenu, Radix menu primitives, stylesheet and theme tokens, with only the two API calls stubbed (the send outcomes come from the real send loop). Committed intemp-screenshots/19859-send-folder/.Outcomes, one crew per state: partly sent (
4 of 5 sent, the error below it throughErrorNotice, the visible "Click to resend the 1 that failed" cue and the "Ask the agent" item), sent with a transcript-only fallback (Sent: 5 (2 transcript only)), all sent (Sent: 5), each finished row with its visible "Clicking again sends all 5 again (duplicates)" line and the transcript-only row with what that means, a disconnected crew, and the visible count of skipped incognito/temporary sessions.Sending: a send in flight on
crew-docs(spinner,1 of 3at full contrast; a press while it runs is ignored), beside an idle connected crew that is ready to send.Nothing to send: every session in the folder is incognito or temporary, so each crew row is disabled and
No sessions to sendsays why.Crew list unreadable: a failed
/api/instancesread shows its error throughErrorNoticewith the "Ask the agent" item, instead of the action disappearing. Only the gateway's owninstances_disabled403 stays silent.Follow-up on
1ed2caee59(r117)useMutationwhose state nothing read. A click callsstartFolderSenddirectly, and the module store (useSyncExternalStore) stays the only channel, because the send must outlive the menu closing.pluralKeys.json.Related Issues
Extends the session transfer of
docs/system-specs/modules/instances.md§14 and the arrival filing of rfc-arrival-provenance-filing.md.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.
Live run: the two-gateway run is tracked in #30231, so it can be deferred without holding this PR.