Pi's ensureProjectRegisteredFromPiDirectory passed the raw config.embedding block straight to registerProjectEmbedding. The OpenCode plugin resolves the same block through resolveEmbeddingRouting at the identical boundary (packages/plugin/src/plugin/embedding-bootstrap.ts:30-46); Pi did not, so:
provider:"synapse" with an unreachable daemon registered a Synapse identity backed by an empty connection file — a fallback vector labelled Synapse.
shadow_embedding was ignored entirely.
A fallback resolution was memoized for the process lifetime, so a recovered daemon was never picked up.
Change
Call the existing shared resolveEmbeddingRouting at the pre-registration boundary and register routing.primary / arm routing.shadow.
Log routing warnings (same text as the OpenCode path).
Only set the config memoization fingerprint when the resolved lane matches the configured provider, so fallback lanes re-resolve on the next call.
Untrusted-config path unchanged (returns before the resolver, parity with OpenCode).
Regression: registers the fallback identity when native discovery is unavailable fails pre-fix (registry.provider === "synapse" with an unreachable daemon) and passes post-fix. Note embedding.provider/subc/shadow_embedding are user-tier only (stripUnsafeProjectConfigFields), so the test arms the lane from the user config and pins XDG_CONFIG_HOME, not just HOME.
Verification
cd packages/pi-plugin && bun test src/embedding-bootstrap.test.ts → 2 pass / 0 fail post-fix; pre-fix the new test fails with Expected: not "synapse".
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Fixes Pi's embedding registration so it resolves the embedding config through resolveEmbeddingRouting before registering, matching how the OpenCode plugin handles the same boundary.
Bug Fixes
An unreachable Synapse daemon no longer registers a Synapse identity backed by an empty connection file; the resolved fallback lane is registered instead.
shadow_embedding is armed when present and retired (and disposed) when routing no longer resolves a shadow.
The config fingerprint is only memoized when the resolved lane matches the configured provider, so fallback lanes re-resolve on the next registration call.
The PR appears safe to merge, with no outstanding finding that meets the threshold for a new review comment.
Summary
Fixes Pi embedding bootstrap behavior by resolving configured embedding routes before registration.
Registers the resolved primary and optional shadow lanes.
Removes a shadow registration when routing no longer selects one.
Retries daemon discovery failures while memoizing configuration-only failures.
Adds regression coverage for fallback routing, shadow retirement, and warning behavior.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Load trusted Pi configuration] --> B[Resolve embedding routing]
B --> C[Register resolved primary lane]
C --> D{Shadow lane resolved?}
D -->|Yes| E[Register shadow lane]
D -->|No| F[Unregister prior shadow lane]
E --> G{Recoverable discovery failure?}
F --> G
G -->|Yes| H[Clear fingerprint so next call retries]
G -->|No| I[Memoize configuration fingerprint]