Skip to content

feat(persona): a citizen can be assigned a model served by a PEER — the durable half - #3799

Merged
joelteply merged 1 commit into
canaryfrom
feat/persona-remote-lane
Sep 6, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/persona-remote-lane

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Card 1d2f65e7, lifting the one idea out of #2250 (449 commits behind, conflicting
across 15 files) rather than rebasing it, per M5's scoping.

Why

A node whose only local model is below the cognition floor cannot host a useful
citizen. Measured on IntelMac 2026-09-06: qwen2.5-coder-0.5b returns 39-42
character bare tool calls with an EMPTY intent field, guesses three different
tool-call syntaxes on three consecutive turns, and adopts a peer's name from one
roster line against a prompt that says "You are Paige" five times.

The cross-grid hop that would fix it was demonstrated the same night:

continuum ai/generate {aircPeer: <citizen on the M5>}
-> 409ms, and the error came from the REMOTE adapter, enumerating the M5's
   served models (Ornith-1.5-35B, qwen3.5-4b-code-forged). This host serves
   only qwen2.5-coder-0.5b, so the reply is provably remote.

persona/reassign-model could not express that: it fit-gates and force-serves on
THIS host, so there was no way to assign a citizen a model another node serves.

What

  • PersonaModelOverride gains remote_peer, plus new_remote() and
    is_remote(). A separate constructor rather than a fourth argument: local and
    remote assignments are fit-gated differently, so the two cases should not be
    reachable by passing None to one constructor.
  • persona/reassign-model gains a remote_peer param. When set, the local
    serving/pin fit-gate is SKIPPED — deliberately, and documented as such. The
    gate asks "can THIS host hold it"; for an off-box assignment the answer is
    expected to be no, so running it would refuse every remote assignment on
    exactly the nodes that need one. This is a scoped bypass of a gate that cannot
    answer the question, not a fallback: the local path keeps its gate unchanged.
  • A malformed peer id is refused BEFORE anything is persisted, so a record that
    could never resolve to a route never reaches disk.
  • The report carries remote_peer so a caller can distinguish the two cases
    without re-reading the override.

What this is NOT

The DURABLE half only. Materialising her adapter as an
AircRemoteInferenceAdapter pinned to the peer happens where the allocator reads
the override (persona/allocator.rs via commands/persona/allocate.rs) and is
slice 2. Until it lands the record persists and the allocator still resolves her
locally — inert rather than half-wired. The command's own detail string says so
to the operator; this is not left for someone to discover.

Tests, proven by mutation rather than by reading

7/7 green. Two new:

  • a_remote_assignment_skips_the_local_fit_gate_and_records_the_peer proves the
    skip BY CONSEQUENCE: the neighbouring missing_executor_fails_loud_and_persists_nothing
    shows a LOCAL reassign fails Internal without the executor because it must reach
    serving/pin; the same bare command with remote_peer set SUCCEEDS, which is
    only possible if the pin was never attempted.
  • a_malformed_remote_peer_is_refused_before_anything_is_persisted.

MUTATION: removing the fit-gate skip (forcing the local branch) failed BOTH new
tests while all three pre-existing tests still passed. The mutation also proved
the malformed-peer test load-bearing — forcing the local branch bypasses the uuid
validation entirely. The tests enforce the behaviour; they do not merely describe it.

cargo check --release clean; ts-rs bindings regenerated and committed.

Co-Authored-By: Claude Opus 5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…he durable half

Card 1d2f65e7, lifting the one idea out of #2250 (449 commits behind, conflicting
across 15 files) rather than rebasing it, per M5's scoping.

## Why

A node whose only local model is below the cognition floor cannot host a useful
citizen. Measured on IntelMac 2026-09-06: qwen2.5-coder-0.5b returns 39-42
character bare tool calls with an EMPTY intent field, guesses three different
tool-call syntaxes on three consecutive turns, and adopts a peer's name from one
roster line against a prompt that says "You are Paige" five times.

The cross-grid hop that would fix it was demonstrated the same night:

    continuum ai/generate {aircPeer: <citizen on the M5>}
    -> 409ms, and the error came from the REMOTE adapter, enumerating the M5's
       served models (Ornith-1.5-35B, qwen3.5-4b-code-forged). This host serves
       only qwen2.5-coder-0.5b, so the reply is provably remote.

`persona/reassign-model` could not express that: it fit-gates and force-serves on
THIS host, so there was no way to assign a citizen a model another node serves.

## What

- `PersonaModelOverride` gains `remote_peer`, plus `new_remote()` and
  `is_remote()`. A separate constructor rather than a fourth argument: local and
  remote assignments are fit-gated differently, so the two cases should not be
  reachable by passing `None` to one constructor.
- `persona/reassign-model` gains a `remote_peer` param. When set, the local
  `serving/pin` fit-gate is SKIPPED — deliberately, and documented as such. The
  gate asks "can THIS host hold it"; for an off-box assignment the answer is
  expected to be no, so running it would refuse every remote assignment on
  exactly the nodes that need one. This is a scoped bypass of a gate that cannot
  answer the question, not a fallback: the local path keeps its gate unchanged.
- A malformed peer id is refused BEFORE anything is persisted, so a record that
  could never resolve to a route never reaches disk.
- The report carries `remote_peer` so a caller can distinguish the two cases
  without re-reading the override.

## What this is NOT

The DURABLE half only. Materialising her adapter as an
`AircRemoteInferenceAdapter` pinned to the peer happens where the allocator reads
the override (`persona/allocator.rs` via `commands/persona/allocate.rs`) and is
slice 2. Until it lands the record persists and the allocator still resolves her
locally — inert rather than half-wired. The command's own `detail` string says so
to the operator; this is not left for someone to discover.

## Tests, proven by mutation rather than by reading

7/7 green. Two new:

- `a_remote_assignment_skips_the_local_fit_gate_and_records_the_peer` proves the
  skip BY CONSEQUENCE: the neighbouring `missing_executor_fails_loud_and_persists_nothing`
  shows a LOCAL reassign fails Internal without the executor because it must reach
  `serving/pin`; the same bare command with `remote_peer` set SUCCEEDS, which is
  only possible if the pin was never attempted.
- `a_malformed_remote_peer_is_refused_before_anything_is_persisted`.

MUTATION: removing the fit-gate skip (forcing the local branch) failed BOTH new
tests while all three pre-existing tests still passed. The mutation also proved
the malformed-peer test load-bearing — forcing the local branch bypasses the uuid
validation entirely. The tests enforce the behaviour; they do not merely describe it.

`cargo check --release` clean; ts-rs bindings regenerated and committed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

No objection (M5, non-author) — merging. Read the diff: the remote case skips the local fit-gate on purpose and says so; the record is persisted and honestly labelled not-yet-load-bearing. Two notes for slice 2 (the load-bearing half, still card 1d2f65e7): (1) parse remote_peer as a PeerId at the boundary rather than a bare uuid string so the allocator never re-parses; (2) the allocator binds AircRemoteInferenceAdapter when override.is_remote() and the receipt is her generation appearing in the REMOTE node's delib.generate.cache rows tagged with her id. The M5's 27B lane is up as your smoke target (1.5–3.8 t/s per slot — slow, but it answers).

@joelteply
joelteply merged commit 62df71f into canary Sep 6, 2026
5 checks passed
@joelteply
joelteply deleted the feat/persona-remote-lane branch September 6, 2026 16:01
joelteply added a commit that referenced this pull request Sep 6, 2026
…override load-bearing (#3800)

Card 1d2f65e7, slice 2. Slice 1 (#3799, merged 62df71f) made
`persona/reassign-model --remote-peer` write a durable `PersonaModelOverride`
carrying `remote_peer`, and said plainly in its own report string that the record
was inert. This is the half that acts on it.

## What

`persona::remote_lane_factory::RemoteLaneAdapterFactory` — a decorator over
`PersonaAdapterFactory`. Per profile it resolves the persona's home, reads her
override, and:

- no override, or a LOCAL one -> delegates to the inner factory, unchanged;
- `is_remote()` -> builds an `AircRemoteInferenceAdapter` over `AircLiveTransport`
  pinned to that peer, so her inference crosses the grid and she never knows.

Wired at `ipc/mod.rs`, wrapping `ServedModelPersonaAdapterFactory`. Composing as a
decorator keeps `materialize_adapters` unaware of overrides, airc and peers — it
still just calls `build_adapter`.

It takes the SAME `Arc<OnceCell<Arc<Airc>>>` the AircInterceptor gets, and reads it
at build time. Deliberately not an `Option<Arc<Airc>>`: airc attaches
asynchronously, typically after the supervisor is constructed, so a snapshot taken
there would record "airc absent" for the process lifetime and refuse every remote
persona forever. Same shape `airc_interceptor` and `routing::airc_transport` use.

## An unhonourable remote assignment REFUSES rather than running her locally

The one place this deliberately differs from the #2250 overflow effector it
descends from. That effector returned None (-> local adapter) on any uncertainty
and was right to: overflow placement is OPPORTUNISTIC, so "stayed home" is a
correct non-event.

An override is not opportunistic. An operator ran `--remote-peer`; the durable
record says her brain runs on peer X. Silently running her on this host's model is
the downgrade [[no-fallbacks-ever]] forbids — and on the node this exists for the
local model is BELOW THE COGNITION FLOOR (IntelMac 2026-09-06: 39-42 char bare tool
calls, empty `intent`, bidirectional identity bleed, cards b1846b3c / bb387821). A
silent fallback there does not degrade her gracefully; it produces a citizen who
cannot hold her own name.

So airc-absent, an unparseable peer, or an unreadable override each return Err,
surfacing as `SupervisorError::AdapterFactory { slot, role, message }` — loud,
per-slot, naming the peer and why.

## Tests, proven by mutation

4/4 green:
- `a_persona_with_no_override_is_delegated_untouched`
- `a_local_override_is_delegated_untouched`
  (both matter because this decorator is now in the production path for EVERY
  persona on every node — a regression breaks local hosting fleet-wide)
- `an_unhonourable_remote_assignment_refuses_instead_of_running_her_locally`
  asserts the call errors AND that the inner factory was never reached. Only the
  call-count separates "refused" from "fell back and the fallback failed".
- `a_malformed_peer_in_the_override_refuses_by_name`

MUTATION: making airc-absent fall back to the inner factory failed EXACTLY the
refusal test and left the other three passing — the mutation touches only that
branch, and only its guard fired.

## What is still not proven

That her generation lands on the remote node. The unit path proves which adapter is
built and that an unhonourable assignment refuses; it cannot prove the hop. The
receipt is the smoke M5 specified: her generation in the REMOTE node's
`delib.generate.cache` rows tagged with her id. The hop itself was measured on
IntelMac 2026-09-06 — `ai/generate` to a citizen on the M5 returned that node's
adapter in 409 ms, the reply enumerating the REMOTE host's served models — so this
builds on a demonstrated round trip.


Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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