feat(cli): warn when --name disagrees with the resolved identity (#148)
* feat(cli): warn when --name disagrees with the resolved identity An explicit --name overrides whatever the shell is bound to. That is deliberate, and it is also how an identity drifts unnoticed: a session keeps sending under the name its bootstrap announced while its row has since been rebound or recovered under another one. bootstrap.rs tells every agent to pin that name into every command, so the pin outlives the thing it names, and nothing said so. The first sign was a peer replying to a name that no longer routed anywhere. CommandContext carries an identity_warning that the router prints to stderr: [hcom] warning: sending as 'riko', but this shell resolves to 'voni'. If 'riko' is stale, run 'hcom start --as riko' to reclaim it. It warns rather than refuses. A human at a terminal, and a relay acting for a remote instance, both legitimately pass a name that is not their own, so failing the command would break working setups to catch a rarer mistake. Two cases are exempt, both because the shell's own binding is not a second opinion worth weighing there. A subagent shares the parent's session and shell, so every subagent command resolves to the parent row. A verified Claude actor is already the exact acting agent for the call, and one acting through the actor env legitimately differs from the row its process binding names; comparing them would manufacture a warning on every call. Closes #140. * Keep --name drift check read-only and scoped - Read the process binding directly instead of resolve_identity, whose Codex recovery path can rebind or retire rows. - Only check when --name is passed; skip printing with --from. - Exempt only subagents of the bound row. - Word the warning as a name/binding mismatch; --name is the agent's own truth, so keep the start --as reclaim hint. * Only treat send --from before -- as an external sender has_from_flag scanned message text after -- too, which also let such a send bypass the identity gate. The drift warning is now only suppressed for send, since listen/events --from is a filter. * Recognize --from=NAME as an external sender --------- Co-authored-by: aannoo <aannoo@users.noreply.github.com>
G
Gissur committed
8a9511767348bbabefe878ffce70f70afea02e6b
Parent: 566640c
Committed by GitHub <noreply@github.com>
on 9/30/2026, 10:07:38 PM