fix(desktop): annotate the resolvable target for aliased LOCAL rows too

The contributor fix covers remote rows. The reporter's video shows the
sibling shape: with a remote gateway active, the LOCAL twin carries the
'default-this-device' alias, and message_agent's local resolver only
knows bare profile names / 'hermes'. Emit the same target annotation
whenever a local row's alias differs from its resolvable handle.
This commit is contained in:
Teknium
2026-09-03 00:01:51 -07:00
parent 2e542c92e6
commit bd6cc48b94
2 changed files with 26 additions and 1 deletions

View File

@@ -265,6 +265,25 @@ describe('the mention middleware', () => {
expect(result.text).toMatch(/on Vera/)
})
it('annotates the resolvable handle for a local row whose UI alias differs', async () => {
// The reporter's shape (#97678 / Discord video): the LOCAL twin carries
// the 'default-this-device' alias when the remote gateway is active.
// The local resolver only knows bare profile names / 'hermes'.
const { handler } = await contributions({
focused: 'ops',
profiles: [
{ connectionId: 'local', connectionKind: 'local', handle: 'default-this-device', name: 'default' },
{ name: 'ops' }
]
})
const result = await handler({ text: 'ping @default-this-device' })
expect(result.text).toMatch(/@default-this-device = agent profile "default"/)
expect(result.text).toMatch(/message_agent target: "hermes"/)
expect(result.text).not.toMatch(/message_agent target: "default-this-device/)
})
it('passes a draft with no mention straight through', async () => {
const { handler } = await contributions()
const draft = { text: 'no tags here' }

View File

@@ -742,9 +742,15 @@ export default {
const target =
bot.remoteSource && bot.connectionId ? `${bot.name}@${bot.connectionId}` : botHandle(bot.name)
// Local rows get the same annotation whenever their UI alias
// ('default-this-device') differs from the resolvable handle —
// otherwise the agent has only the alias to go on and the local
// path rejects it the same way (#97678).
const where = bot.remoteSource
? ` — on ${bot.connectionLabel || bot.connectionId} (message_agent target: "${target}")`
: ''
: handle !== target
? ` (message_agent target: "${target}")`
: ''
return `@${handle} = agent profile "${bot.name}"${title ? ` ("${title}")` : ''}${where}`
})