Skip to content

fleet(#1378): FleetPlane generalization + resolver wiring in dispatch() and handleUpgrade() - #1384

Merged
jeonghun-jj-lee merged 3 commits into
feature/free-tier-fleetfrom
fleet/resolver-wiring-1376
Sep 21, 2026
Merged

jeonghun-jj-lee merged 3 commits into
feature/free-tier-fleetfrom
fleet/resolver-wiring-1376

Conversation

@jeonghun-jj-lee

Copy link
Copy Markdown
Contributor

Closes #1378 (sub-issue of #1376).

What

Wires the D3 three-way resolver (resolveAmicodeTarget) into live dispatch() and handleUpgrade() — the peer-branch routing that makes attach actually route traffic.

Changes

  1. FleetPlane interface gains optional attached?: HubProxy and keeper?: HubProxy slots alongside existing hub/client/writes.
  2. dispatch() calls the resolver for engine-armed machines in fleet mode: routes "local" → local engine, "keeper" → keeper upstream, "attached" → attached upstream. Client→hub branch is byte-unchanged.
  3. handleUpgrade() applies the same resolver decision for SSE/WebSocket.
  4. Empty/corrupt pointer defaults to local engine (the resolver's existing fail-safe).
  5. createAmicodeService gains fleet.attached and fleet.keeper options.

Testing

6 new tests in fleet_client_relay.test.ts (peer-branch dispatch + handleUpgrade). All 27 attachment-pointer tests and 16 existing client-relay tests pass unchanged. Full suite: 4100 passed, 6 pre-existing failures (skills lint, runner, CLI gate, projection — same as base).

AC status

  • AC1: FleetPlane interface carries attached/keeper
  • AC2: dispatch() calls resolver for peer branch
  • AC3: Client→hub branch byte-unchanged
  • AC4: handleUpgrade() wired
  • AC5: Empty pointer → local fail-safe
  • AC6: Existing test suites pass

@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
@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: be186194-6e6f-4022-a393-d25a55ffe08c

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.

…ispatch()

AC1: FleetPlane interface carries optional attached?: HubProxy and
     keeper?: HubProxy alongside existing hub/client/writes.

AC2: dispatch() calls resolveAmicodeTarget for engine-armed (!client)
     machines in fleet mode: local → route table/engine, keeper → keeper
     upstream, attached → attached upstream. The resolver decision is
     computed early so non-local targets bypass the /amicode/* route
     table (registered routes no longer shadow the upstream).

AC5: Empty/corrupt attachment pointer defaults to local engine — the
     resolver's fail-safe (target=local, peerTarget stays undefined,
     route table serves normally).

AC3: The client→hub branch (incl. #1261 hub-down 503) is byte-unchanged
     inside an else wrapper — the peer branch is strictly additive.
…WebSocket

AC4: handleUpgrade() applies the same D3 resolver decision as dispatch()
     for engine-armed (!client) fleet machines. The client→hub upgrade
     path is byte-unchanged (first check); the new peer branch routes
     'attached' → fleetPlane.attached.handleUpgrade, 'keeper' →
     fleetPlane.keeper.handleUpgrade, 'local' → socket.destroy (the
     engine handles its own upgrades on its native port).
@jeonghun-jj-lee
jeonghun-jj-lee force-pushed the fleet/resolver-wiring-1376 branch from 9a5b222 to 565cbc9 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
@jeonghun-jj-lee
jeonghun-jj-lee merged commit 15e348b into feature/free-tier-fleet Sep 21, 2026
5 checks passed
jeonghun-jj-lee added a commit that referenced this pull request Sep 23, 2026
…() and handleUpgrade() (#1384)

* fleet(#1378): FleetPlane attached/keeper slots + resolver wiring in dispatch()

AC1: FleetPlane interface carries optional attached?: HubProxy and
     keeper?: HubProxy alongside existing hub/client/writes.

AC2: dispatch() calls resolveAmicodeTarget for engine-armed (!client)
     machines in fleet mode: local → route table/engine, keeper → keeper
     upstream, attached → attached upstream. The resolver decision is
     computed early so non-local targets bypass the /amicode/* route
     table (registered routes no longer shadow the upstream).

AC5: Empty/corrupt attachment pointer defaults to local engine — the
     resolver's fail-safe (target=local, peerTarget stays undefined,
     route table serves normally).

AC3: The client→hub branch (incl. #1261 hub-down 503) is byte-unchanged
     inside an else wrapper — the peer branch is strictly additive.

* fleet(#1378): wire resolver into handleUpgrade() for peer-branch SSE/WebSocket

AC4: handleUpgrade() applies the same D3 resolver decision as dispatch()
     for engine-armed (!client) fleet machines. The client→hub upgrade
     path is byte-unchanged (first check); the new peer branch routes
     'attached' → fleetPlane.attached.handleUpgrade, 'keeper' →
     fleetPlane.keeper.handleUpgrade, 'local' → socket.destroy (the
     engine handles its own upgrades on its native port).

* fix: narrow globalThis timer types for strict TS compat in fleet_heartbeat
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