Fixes codemode route resolution so calls no longer fail when a head has routes in multiple checkouts.
Prefers head routes matching the run's root, falling back to comparing all candidates when none match.
Refusals now name the conflicting access fields and channel numbers without exposing their values.
Adds INFO logging for route ambiguity and regression tests for OpenCode and Pi harnesses.
Confidence Score: 5/5
The PR appears safe to merge.
Summary
Codemode now prefers head routes from the run’s checkout, so routes cached for other checkouts no longer cause a conflict.
Codemode calls prefer a head route from the run’s checkout.
No actionable issues found. Tests were inspected but not run.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Find authorized head routes for the parent scope and agent] --> B{Any head matches the run root?}
B -->|Yes| C[Keep matching heads]
B -->|No| D[Keep all candidate heads]
C --> E{Access settings agree?}
D --> E
E -->|No| F[Refuse and name conflicting fields and channels]
E -->|Yes| G[Inherit one complete head identity]