# US-022 — X-Meshnet-Start-Layer: overlapping shard execution protocol

Status: done
Priority: High
Stage: Implemented

## Context

Two nodes may register overlapping shard ranges (node A: 0–15, node B: 12–23) to increase
redundancy or to enable partial-model nodes to form a complete route. Without coordination,
node B would re-run layers 12–15 on top of activations that already include them, producing
wrong output.

The `X-Meshnet-Start-Layer` header tells each downstream node which model layer the incoming
activation tensor represents, so the node skips layers it has already been told to skip.

## Decision

Option A: tracker injects `start_layer` into `X-Meshnet-Route` hops at proxy time. The head
node passes it per-hop as `X-Meshnet-Start-Layer`. No peer-to-peer negotiation needed.

## Acceptance criteria

- [ ] Tracker `_handle_proxy_chat` builds route hops with `start_layer` = `covered_up_to + 1`
- [ ] `_handle_binary_forward` reads `X-Meshnet-Start-Layer` and passes it to `backend.forward_bytes`
- [ ] `_get_remaining_route` parses `start_layer` from injected header and from `/v1/route` slow-path
- [ ] `TorchModelShard.forward_bytes` accepts optional `start_layer` and skips layers below it
- [ ] Test: overlapping two-node route produces correct output without double-computing layers
- [ ] `python -m pytest` passes
