Skip to content

fix(inference): remote persona calls do not hold local lane admission - #5281

Merged
joelteply merged 1 commit into
canaryfrom
6780e79b/admission-locality
Oct 22, 2026
Merged

joelteply merged 1 commit into
canaryfrom
6780e79b/admission-locality

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Remote persona generations currently acquire this node's shared lane and prefill permits before calling the remote adapter. A remote timeout can therefore monopolize idle local capacity for 600 seconds.

This change resolves PlacementSwitch to one concrete adapter for each call and uses that same handle for admission and dispatch. The adapter declares admission ownership; the HTTP implementation uses the existing shared serving endpoint identity, excluding dedicated lanes. Remote and independent adapters own their capacity. Shared-local priority, hold, prefill and cancellation semantics remain in one extracted admission module. No provider-name routing, timeout change, extra scheduler, or service restart.

Regression coverage added for remote bypass of busy local resources, local reacquisition and cancellation while waiting for prefill; placement change after target selection; and endpoint-based HTTP admission despite historical is_local metadata. Existing test primitives are reused. These tests await hosted CI: locally only rustfmt parsing and git diff --check passed. No compile was run beside serving.

Scope: the inherited preassembly model/window observation across a PlacementSwitch change is not repaired here. The request's admission and dispatch are now pinned together. Live 15-minute lane/act acceptance remains owed after reviewed deployment; no throughput or coding claim yet.

Card: 6780e79b-fd92-4fe5-b7db-48e18f994ae6. Independent review requested from Codex root and Cormac. 457 added / 224 removed lines including extraction, tests and contract documentation.

@joelteply

Copy link
Copy Markdown
Contributor Author

PASS #5281 at 4833654, Cormac, 2026-10-22, source read, not built. Conditional on hosted CI at this head.

Claim verified: a call served by a remote or independent target holds no local lane or prefill slot, and a call to the shared local engine is gated exactly as before. How (diff vs canary):

  • One snapshot drives both admission and dispatch. request.rs binds adapter = binding.adapter.generation_target() (falling back to the binding's own Arc) and uses that same adapter for admit_generation(.., adapter.generation_admission(), ..) and for both generate_stream_checked calls. A PlacementSwitch rebinding mid-call can't split them; the change applies on the next call.
  • Ownership is endpoint identity, not is_local or provider name. The default is GenerationAdmissionOwner::Adapter. Only OpenAICompatibleAdapter returns SharedLocal, and only when !dedicated_lane && targets_serving_endpoint(current_serving().base_url) (the same normalized base-URL compare on_serving_lane already used). I checked every other adapter: Anthropic and AircRemote are remote capacity; LlamaCppAdapter is its own in-process llama.cpp context, which never used the shared lanes, so charging it for them was the same mistake as the remote case; NoSeat and Heuristic are test or no-op. None reaches the shared llama-server.
  • Adapter-owned calls take nothing local. admit_target returns AdapterOwned without polling the local future, so acquire_serving_lane, acquire_prefill_slot and the measured-hold defer never run. That's right for the defer too: a local measurement hold shouldn't stall work served elsewhere. note_directed() stays in request.rs ahead of admission, so remote directed acts still count as directed; only note_directed_lane_wait_ms (local-only) moved.
  • SharedLocal is the extracted existing gate block, with priority, RAII release and cancellation unchanged, plus the new busy/cancel, switch-transition and endpoint tests.

Live acceptance I'll run on IntelMac after deploy, from the retained evidence (~/.continuum/evidence/6780e79b-lane-hold-2026-10-22.jsonl): a remote_lane.model_overridden act is followed by NO admission.lane.granted for that persona; a local resident entering the gate with lanes_available >= 1 and queue_ahead 0 is granted within seconds; and no persona.act.lane_starved while /slots shows idle slots.

@joelteply
joelteply marked this pull request as ready for review October 22, 2026 18:33
@joelteply
joelteply merged commit ce64c00 into canary Oct 22, 2026
12 of 15 checks passed
@joelteply
joelteply deleted the 6780e79b/admission-locality branch October 22, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant