Repository navigation
fix(ui): surface non-default account in channel session labels (#123112) - #123186
licheer-zte wants to merge 2 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@licheer-zte Nice catch on the multi-account key shape. The fallback path fix looks right, and suppressing the literal One gap relative to the issue report: once the gateway supplies a shared peer Suggested small follow-up in the same file:
Sketch: const withAccountDisambiguator = (rawName: string): string => {
if (!accountId) return rawName;
if (rawName.toLowerCase().includes(accountId.toLowerCase())) return rawName;
return `${rawName} · ${accountId}`;
};
// on label / displayName / derivedTitle returns:
return withAccountDisambiguator(applyTypedPrefix(name));
// fallbackName can keep building the account into the string as you already doRegression cases worth adding: expect(
resolveSessionDisplayName("agent:main:telegram:cards:direct:42", {
displayName: "Alice",
}),
).toBe("Alice · cards");
expect(
resolveSessionDisplayName("agent:main:telegram:direct:42", {
displayName: "Alice",
}),
).toBe("Alice");
expect(
resolveSessionDisplayName("agent:main:telegram:cards:direct:42", {
displayName: "Alice · cards",
}),
).toBe("Alice · cards"); // no double-appendAlso, CI Happy to leave the implementation to you; thanks for landing the key-parse fix quickly. |
51c4001 to
ba32195
Compare
|
Codex review: needs real behavior proof before merge. Reviewed August 15, 2026, 2:53 AM ET / 06:53 UTC. ClawSweeper reviewWhat this changesThe PR makes fallback labels for account-qualified direct and group session keys include a non-default account identifier. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 6 items remain Keep open: the fallback-label repair is useful, but named sessions still discard the non-default account and can remain indistinguishable; the prior P1 finding is unchanged. The PR also needs real Control UI proof before merge. Priority: P2 Review scores
Verification
How this fits togetherGateway routing encodes a channel account in direct-session keys, then the Control UI turns session rows into names for the sidebar, palette, and chat surfaces. Explicit gateway-provided names take precedence over fallback names. flowchart LR
A[Inbound channel route] --> B[Account-qualified session key]
B --> C[Gateway session row]
C --> D[Control UI name resolver]
D --> E{Named field present?}
E -->|Yes| F[Sidebar and palette label]
E -->|No| G[Account-aware fallback label]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +30. Total +42 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Carry the parsed non-default account through the resolver and append it exactly once to every named precedence path, retain default-account output, remove or source-prove the group form, and attach sanitized before/after Control UI proof. Do we have a high-confidence way to reproduce the issue? Yes, at source level: resolving an account-qualified key with Is this the best way to solve the issue? No. The fallback regex is the right owner surface, but it does not carry account identity into the higher-precedence names users normally see. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7bb3909e4b5a. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(ui): surface non-default account in channel session labels (#123112) This is item 1/1 in the current shard. Shard 17/22. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
按合入模式(2026-08-10 定稿)关闭:ClawSweeper 最新 review(2026-08-15,head ed9c02e)评级 🦪 silver shellfish (2/6),1 个 actionable finding 未修 + 未变的 P1 行为缺口,blocker 是真实 Control UI 运行截图/录像。本环境无法产出 UI 运行证据,关闭释放产能。 |
What Problem This Solves
With
channels.telegram.accounts.<default, cards>configured, the default-account DM session key isagent:main:telegram:direct:<chatId>while a session reached through thecardsaccount isagent:main:telegram:cards:direct:<chatId>. The Control UI's session display only understands the account-less shape, so the account-qualified key falls throughparseSessionKeyto the raw-key fallback and renders the full routing key (telegram:cards:direct:42) instead of a friendly label — while the default-account session rendersTelegram · 42. Multi-account sessions are indistinguishable at a glance in the sidebar/session list, and the raw key structure leaks into the UI (exactly what theshortenPeerIddesign is meant to prevent). The same fall-through affects account-qualified group keys (agent:main:telegram:cards:group:<id>).Why
ui/src/lib/session-display.tsparseSessionKeymatches direct DMs with/^agent:[^:]+:([^:]+):direct:(.+)$/and groups with/^agent:[^:]+:([^:]+):group:(.+)$/. Theper-account-channel-peerDM scope (used for non-default accounts) inserts a normalized account segment between channel and kind:agent:<agent>:<channel>:<accountId>:direct:<peerId>(src/routing/session-key.ts:238-242). Neither regex accepts the optional account segment, so those keys skip the friendly direct/group branches entirely and fall through to the genericagent:<x>:branch (session-display.ts:191-195), which returns the raw remainder of the key. The channel grouping regex (CHANNEL_SESSION_KEY_RE) already tolerates the optional account segment — only the label path is broken.User Impact
Telegram (cards) · 42instead of the rawtelegram:cards:direct:42, so sidebar/session-list rows are distinguishable at a glance and opaque routing keys stay out of the UI.:default:segments render exactly as before (Telegram · 42), so default setups see zero change.Telegram (cards) Group); account-less groups are unchanged.Evidence
Pre-fix behavior, captured on
mainwith the account-qualified key (raw key leaks; default session gets the friendly label):Post-fix regression tests (
ui/src/lib/session-display.test.ts, includes new cases for DM/group account labels,:default:suppression, and peer-id shortening with an account):Related grouping suite unaffected:
UI typecheck clean:
[AI-assisted] Implementation and evidence generated with agent tooling.