| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "reasonix/internal/agent" |
| 5 | "reasonix/internal/control" |
| 6 | ) |
| 7 | |
| 8 | // controllerTaskSessionID never derives a canonical identity from its empty |
| 9 | // compatibility path. Legacy controllers keep their persisted branch IDs. |
| 10 | func controllerTaskSessionID(ctrl control.SessionAPI) string { |
| 11 | if ctrl == nil { |
| 12 | return "" |
| 13 | } |
| 14 | if lifecycle, ok := ctrl.(control.IdentityLifecycle); ok && lifecycle.UsesExclusiveSession() { |
| 15 | if ref, bound := lifecycle.SessionRef(); bound { |
| 16 | return ref.SessionID |
| 17 | } |
| 18 | return "" |
| 19 | } |
| 20 | return agent.BranchID(ctrl.SessionPath()) |
| 21 | } |
| 22 |