Skip to content

refactor(remote): stop relay-slot births and delete remote_adopt - #17642

Merged
iamwhatever merged 1 commit into
mainfrom
feat/wave4-b-stop-relay-births
Oct 7, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/wave4-b-stop-relay-births

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: No new chat slot on this machine is born bound to a remote crew; a session on a crew is created on that crew and opened here through its window.

The accepted RFC rfc-remote-crew-sidebar (proposed in #16489, accepted in #16699) makes the peer own its session. The hub only opens a window onto it (#16757, sidebar groups in #16756). Wave 4 retires the hub-side relay path.

Today POST /api/chat/slots still accepts instance_id and adopt_remote_slot. That is the only place a new slot gets executor = "remote". No UI reaches adopt since #16757, and the one UI path left (the memory-mode recreate in ChatPage.tsx) re-minted a relay slot by carrying the old slot's instanceId.

Why it matters

While the create path can still mint relay slots, the relay code cannot be removed (wave 4 PR C), and a stale client can keep producing sessions the new design does not support.

Not a goal

  • Deleting the relay turn path, remote_mirror, the read_peer_slots dedupe, hub_key or resolved_row_identity's remote branch (PR C).
  • Moving redact_peer_text (PR C).
  • Any read-only archive UI for old relay slots: chat on crew never shipped, so feat(chat): make a chat that ran on a crew a read-only archive #17419 was closed as not needed.
  • Migrating old executor: "remote" slots.

What changed (motivation → approach → change)

The RFC decision is on main and accepted. The smallest step that meets the wave 4 exit "no new slot with executor="remote"" is to refuse the two create fields up front and delete what only they reached.

  • chat_handlers.api_chat_slot_create refuses a body with instance_id or adopt_remote_slot with 400 remote_create_retired, before anything is read or written. The mint/adopt branch, its three binding gates, the peer-mode/agent/workspace/title inheritance and the backfill are deleted.
  • remote_adopt.py is deleted. remote_relay.create_peer_slot is deleted; the rest of remote_relay.py stays for PR C.
  • handlers_instances.read_peer_slots loses its adopt-only uncapped flag; the cap now always applies.
  • security_posture.py drops the "Adopted peer transcript" boundary row.
  • Web client: createChatSlot (website/src/api/client/chat.ts) and the createSlot thunk (website/src/store/chat/lifecycle.ts) drop instance_id / adopt_remote_slot (agent_kind moves up one argument). ChatPage.tsx's memory-mode recreate no longer carries instanceId — this is the one hunk of feat(chat): make a chat that ran on a crew a read-only archive #17419 this wave needed, folded in here.
  • docs/system-specs/modules/session.md describes the refusal in place of the mint/adopt contract; docs/system-specs/modules/crew-mode.md stops citing the deleted adopt test; a comment in session_transfer.py stops naming remote_adopt.

Backwards compatibility

Breaking: POST /api/chat/slots with a non-empty instance_id or adopt_remote_slot now answers 400 remote_create_retired. Writer sweep on origin/main @ the PR base: the only writers were api.createChatSlot (parameters removed here), its one caller passing them, ChatPage.tsx's memory-mode recreate (removed here), and remote_relay.create_peer_slot (deleted here; it never sent either field to the peer). No app, cron or MCP tool sends them.

Reader: src/kiro_crew/dashboard/slot_persistence/metadata_codec.py:_read_executor -- chat -- still restores executor/instance_id/remote_slot from disk, so an old slot loads; test_no_source_module_stamps_a_remote_executor_except_the_disk_reader
Reader: src/kiro_crew/dashboard/remote_relay.py:remote_bound_refusal -- chat -- still refuses continue/regenerate/rewind/todo on an old remote slot; test_remote_crew_execution.py::TestBoundSlotRefusesTurnRestartingActions
Reader: src/kiro_crew/dashboard/handlers_instances.py:api_instances_chat_slots -- crew page -- the only remaining read_peer_slots caller, which never passed uncapped; test_remote_crew_peer_slots.py
Reader: website/src/pages/chat-sidebar/create.ts:New chat on crew -- chat -- creates on the peer through the proxy, never through the local create route; ChatSidebar.createMenu.test.tsx

Tests

  • New test/test_chat_slot_create_remote_retired.py: every crew-bound body is refused 400 remote_create_retired for dashboard and app callers with no slot created and no instances-manager access; an existing slot named with a crew is left untouched; empty binding fields stay an ordinary local create; only the disk reader in dashboard/ assigns executor = "remote". Red-before on origin/main: 10 failed, 2 passed (the two plain-create controls).
  • ChatPageMoreCoverage.test.tsx: the memory-mode recreate test now asserts the recreated slot names no crew (red on main).
  • ApiClient.coverage.test.tsx: the adopt wire-format case becomes a check that agent_kind rides beside an agent and no crew binding is sent.
  • Deleted test/test_remote_crew_adopt.py and the create-path classes in test/test_remote_crew_execution.py (TestBindingAuthorization, TestBoundCreateDefaults, TestCreatePeerSlot); test_chat_handlers_composition_contract.py drops the deleted names.
  • Local: pytest -n 2 on 11 touched/covering files 914 passed; isort, flake8, mypy on touched modules clean; tsc 0; vitest on 9 covering files 1127 passed; eslint 0 on touched files.

Manual verification

N/A — unit coverage sufficient: the change is a request refusal plus deletion, and the only UI change drops one field from a create call, covered by ChatPageMoreCoverage.test.tsx.

Screenshots / video

Why no screenshot: the frontend diff only removes a create parameter and one recreate field, so nothing renders differently.

Related Issues

Part of #6180

Replaces the one needed hunk of #17419 (closed). Supersedes #10635, #10854 and #10856, which change the deleted adopt path; their author was notified on each.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested a review from a team as a code owner October 7, 2026 08:06
@iamwhatever
iamwhatever requested a review from bolichen97 October 7, 2026 08:06
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture.py

  • @bolichen97: missing the ## Sensitive change review heading

A human reviewer with write access must approve the CURRENT head and
paste this template into the approval, every field filled
(N/A needs a reason):

## Sensitive change review
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of f8c0e59d96f38357b9fe43bb6e9a3289bc3da138 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Nothing to check.

[UX-REVIEWED] f8c0e59

Description read

[DESCRIPTION-READ] 0020b76db945240e306185a3093ed552ce47f73c7781f0d039ad7d9e5db12539

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of f8c0e59d96f38357b9fe43bb6e9a3289bc3da138 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] f8c0e59

Description read

[DESCRIPTION-READ] 9e5e66c32d41ab91b64850af31e4a878c75651dbe5775a2c06827304665cf7aa

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of f8c0e59d96f38357b9fe43bb6e9a3289bc3da138 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Confirm that no shipped build ever created a relay slot. That claim is the only reason RFC wave 4's read-only archive and migration step can be dropped.

What this change ships

Inventory (8 items) — 8 justified

Intent: stop this hub from creating chat sessions bound to a remote crew, so the relay path can be retired as the accepted RFC's wave 4 requires. FIX.

  1. Creating a chat slot that names a crew (instance_id / adopt_remote_slot) is now refused with 400 remote_create_retired — justified
  2. Opening a peer's session here by copying it into a local slot (adopt, remote_adopt.py) is gone — justified
  3. Hub-side "new chat on crew" relay creation (create_peer_slot) is deleted — justified
  4. The memory-mode recreate in ChatPage no longer carries over the old slot's crew binding — justified
  5. The web client's create-slot call no longer sends crew-binding fields, and agent_kind moves up one argument — justified
  6. Peer slot lists are always capped, because the adopt-only uncapped read is removed — justified
  7. The security posture list drops its "Adopted peer transcript" boundary row — justified
  8. The session and crew-mode specs now describe the refusal instead of mint/adopt — justified

[FIRST-PRINCIPLES-REVIEWED] f8c0e59

Description read

[DESCRIPTION-READ] c011f505eec227f27c2785d23cd639d63c80785eda1331e21776d5e9c71dcbe6

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed f8c0e59d96f38357b9fe43bb6e9a3289bc3da138 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] f8c0e59

Verdict parsed from the review's SHA-scoped output markers for commit f8c0e59d96f38357b9fe43bb6e9a3289bc3da138.

False positive or not applicable? A repository writer can comment:
/ai-review override fable f8c0e59d96f38357b9fe43bb6e9a3289bc3da138: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of f8c0e59d96f38357b9fe43bb6e9a3289bc3da138 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f8c0e59

False positive or not applicable? A repository writer can comment:
/ai-review override gpt f8c0e59d96f38357b9fe43bb6e9a3289bc3da138: <one-sentence reason>

POST /api/chat/slots now refuses a body carrying instance_id or
adopt_remote_slot with 400 remote_create_retired, before anything is read
or written. A session on a connected crew is created on that crew and
opened here through its window, so the hub no longer mints or adopts a
relay binding.

Removed: remote_adopt.py, the create handler's mint/adopt branch,
remote_relay.create_peer_slot, the adopt-only `uncapped` flag on
read_peer_slots, the adopt security-posture row, and the instanceId /
adoptRemoteSlot create parameters in the web client. Old slots with
executor "remote" still load from disk.

Part of #6180
@iamwhatever
iamwhatever force-pushed the feat/wave4-b-stop-relay-births branch from f19ccd6 to f8c0e59 Compare October 7, 2026 08:17
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 7, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving head f8c0e59.

  • Read the diff and its call paths (dashboard chat slot create; remote crew relay/adopt removal; security_posture redaction sinks; web createChatSlot signature).
  • PR Readiness is success from github-actions[bot] on f8c0e59.
  • Read review threads and AI-review comments on this head: no open BLOCK, no unanswered CONCERNS, no CHANGES_REQUESTED in force.
  • Compat/UX check: compat risk low, UX risk low; merge-tree is clean against main 6765454 with no semantic overlap.

Reviewed by Kiro (agent) on behalf of bolichen97 as part of a repo-wide PR sweep.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Self-review (crew-pr-reviewer, read-only): RECOMMEND APPROVE

Reviewed head f8c0e59. This removes code rather than adding a path. POST /api/chat/slots with instance_id or adopt_remote_slot now returns 400 remote_create_retired, and remote_adopt.py is deleted. Its entry in security_posture.py goes with it, because the "adopted peer transcript" boundary no longer exists. Removing that path is what this PR is for, so nothing that used to be scrubbed can now go unscrubbed. @bolichen97 approved this head. The red Sensitive Change Review is the human-approval gate for security_posture.py. It clears when an approval on this head includes the filled-in template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants