fix: keep main session displayName on outbound sends#4693
Conversation
| if (params.route.baseSessionKey === mainSessionKey) { | ||
| try { | ||
| await updateLastRoute({ |
There was a problem hiding this comment.
[P2] Swallowing session-store write errors makes debugging hard
The new try { await updateLastRoute(...) } catch {} intentionally avoids blocking outbound sends, but it also drops any signal that session store writes are failing (permissions, invalid store path, JSON parse errors, etc.). Consider at least logging at debug/warn level so failures don’t silently degrade routing/history.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/infra/outbound/outbound-session.ts
Line: 841:843
Comment:
[P2] Swallowing session-store write errors makes debugging hard
The new `try { await updateLastRoute(...) } catch {}` intentionally avoids blocking outbound sends, but it also drops any signal that session store writes are failing (permissions, invalid store path, JSON parse errors, etc.). Consider at least logging at debug/warn level so failures don’t silently degrade routing/history.
How can I resolve this? If you propose a fix, please make it concise.bfc1ccb to
f92900f
Compare
|
Closing as AI-assisted stale-fix triage. Linked issue #4683 ("Bug: Session displayName updates to last message recipient instead of session owner") is currently closed and was closed on 2026-02-03T20:02:35Z with state reason completed. If this specific implementation is still needed on current main, please reopen #4693 (or open a new focused fix PR) and reference #4683 for fast re-triage. |
Summary
sessions_listdisplayName to the last recipientlastTo,lastChannel,lastAccountId,lastThreadId) so routing remains accurateContext
Outbound sends call
ensureOutboundSessionEntry, which previously used the inbound metadata pipeline even when DM scope collapsed to the main session key. That path derives the origin label fromctx.From, so the main session’s displayName became the last recipient. The fix skips origin updates for main-session routes and only persists delivery context in that case.Testing
Closes #4683
Greptile Overview
Greptile Summary
This PR updates
ensureOutboundSessionEntry(src/infra/outbound/outbound-session.ts) to avoid updating origin-derived session metadata when an outbound DM route collapses to the agent’s main session key. For those “main-session” routes it now only persists delivery context (viaupdateLastRoute) so routing fields likelastTo/lastChannel/lastAccountId/lastThreadIdremain accurate, while preventing the main sessiondisplayNamefrom being overwritten by the most recent recipient. Per-peer session behavior continues to use the inbound metadata pipeline (recordSessionMetaFromInbound).Confidence Score: 4/5
ensureOutboundSessionEntryand only alters behavior when the outbound route collapses to the agent main session key. It uses existing store primitives (updateLastRoute) and keeps the previous behavior for non-main session routes. Main remaining risk is silent failure of session-store writes due to swallowed errors, which can mask operational issues.Context used:
dashboard- CLAUDE.md (source)dashboard- AGENTS.md (source)