Skip to content

fleet(#1381): attach/detach upstream lifecycle + credential injection - #1387

Merged
jeonghun-jj-lee merged 2 commits into
feature/free-tier-fleetfrom
fleet/attach-lifecycle-1381
Sep 21, 2026
Merged

jeonghun-jj-lee merged 2 commits into
feature/free-tier-fleetfrom
fleet/attach-lifecycle-1381

Conversation

@jeonghun-jj-lee

Copy link
Copy Markdown
Contributor

Closes #1381 (sub-issue of #1376). Depends on #1384 (#1378).

What

Wires the attach action to actually spin up the SSH transport, register the upstream on FleetPlane, and inject credentials — making attach a live routing change, not just a pointer flip.

Changes

  1. AttachLifecycle class in attach_lifecycle.ts — coordinates SSH forward bring-up (via injectable TransportFactory), HubProxy creation with credential injection, FleetPlane attached slot management, and teardown.
  2. Route wiring — registerAttachmentRoutes invokes the lifecycle on POST /attach (after pointer write) and POST /detach (before pointer clear).
  3. createAmicodeService wires the lifecycle when fleet opts include transportFactory.

Testing

10 new tests in amicode_service_attach_lifecycle.test.ts at three levels: unit (AttachLifecycle class), route wiring, and integration. Full suite: 6 pre-existing failures, 0 regressions.

AC status

  • AC1: SSH forward spins up on attach
  • AC2: HubProxy registered on FleetPlane
  • AC3: Credential injected from UI client mint
  • AC4: Detach tears down forward, clears slot, resets SSE cursor
  • AC5: Re-attach tears down previous before starting new

@jeonghun-jj-lee jeonghun-jj-lee added area:provisioning afk Implementable without human interaction labels Sep 21, 2026
@jeonghun-jj-lee jeonghun-jj-lee self-assigned this Sep 21, 2026
@jeonghun-jj-lee jeonghun-jj-lee added area:provisioning afk Implementable without human interaction labels Sep 21, 2026
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 124c72cd-ff04-40ba-bbe2-fba4bb166ba2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jeonghun-jj-lee
jeonghun-jj-lee force-pushed the fleet/attach-lifecycle-1381 branch from a7cabe8 to 4adc678 Compare September 21, 2026 17:42
@jeonghun-jj-lee
jeonghun-jj-lee marked this pull request as ready for review September 21, 2026 17:52
- AttachLifecycle class coordinates SSH forward bring-up, HubProxy
  registration on FleetPlane.attached, credential injection, and
  teardown on detach/re-attach
- registerAttachmentRoutes wires the lifecycle into POST /attach and
  /detach so the pointer write drives the live transport layer
- AC1: attach calls the transport factory to spin up the SSH forward
- AC2: the returned HubProxy is registered on FleetPlane.attached
- AC3: credential injection reads from the attachment credential store
- AC4: detach stops the transport, clears the slot, resets the cursor
- AC5: re-attach tears down the previous forward before starting new
- 9 tests covering all 5 acceptance criteria + route-level wiring
…actory option

- Add transportFactory + attachRemotePort to the fleet options in
  createAmicodeService so the extension activation can inject the
  SSH transport bring-up
- Capture the FleetPlane object reference so the lifecycle can
  mutate its attached slot dynamically
- Create the AttachLifecycle for non-client fleet machines when
  a transport factory is provided
- Pass the lifecycle to registerAttachmentRoutes
- Integration test verifies the end-to-end wiring through
  createAmicodeService's HTTP routes
@jeonghun-jj-lee
jeonghun-jj-lee force-pushed the fleet/attach-lifecycle-1381 branch from b505831 to 06742f6 Compare September 21, 2026 17:54
@jeonghun-jj-lee
jeonghun-jj-lee merged commit f6ccf72 into feature/free-tier-fleet Sep 21, 2026
4 checks passed
jeonghun-jj-lee added a commit that referenced this pull request Sep 23, 2026
…#1387)

* fleet(#1381): attach lifecycle coordinator + route wiring

- AttachLifecycle class coordinates SSH forward bring-up, HubProxy
  registration on FleetPlane.attached, credential injection, and
  teardown on detach/re-attach
- registerAttachmentRoutes wires the lifecycle into POST /attach and
  /detach so the pointer write drives the live transport layer
- AC1: attach calls the transport factory to spin up the SSH forward
- AC2: the returned HubProxy is registered on FleetPlane.attached
- AC3: credential injection reads from the attachment credential store
- AC4: detach stops the transport, clears the slot, resets the cursor
- AC5: re-attach tears down the previous forward before starting new
- 9 tests covering all 5 acceptance criteria + route-level wiring

* fleet(#1381): wire lifecycle into createAmicodeService via transportFactory option

- Add transportFactory + attachRemotePort to the fleet options in
  createAmicodeService so the extension activation can inject the
  SSH transport bring-up
- Capture the FleetPlane object reference so the lifecycle can
  mutate its attached slot dynamically
- Create the AttachLifecycle for non-client fleet machines when
  a transport factory is provided
- Pass the lifecycle to registerAttachmentRoutes
- Integration test verifies the end-to-end wiring through
  createAmicodeService's HTTP routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

afk Implementable without human interaction area:provisioning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant