Skip to content

fix(ui): disambiguate multi-account session labels - #124228

Merged
vyctorbrzezowski merged 7 commits into
openclaw:mainfrom
SebTardif:fix/123112-session-label-account
Aug 15, 2026
Merged

vyctorbrzezowski merged 7 commits into
openclaw:mainfrom
SebTardif:fix/123112-session-label-account

Conversation

@SebTardif

@SebTardif SebTardif commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

With more than one account on a channel, session keys namespace the account
(agent:main:telegram:direct:<chatId> vs agent:main:telegram:cards:direct:<chatId>).
The Control UI display resolver only understood the account-less shape, so the cards
session fell through to a raw key (telegram:cards:direct:42) while the default session
rendered as Telegram · 42. When both rows already carried a Gateway displayName such
as Alice, the two rows were indistinguishable in the sidebar.

The same resolver had a second gap: session keys written before #11881 spell direct chats
dm. The canonical parser still accepts both spellings (src/sessions/session-key-utils.ts),
but the display resolver recognized neither the dm shape nor its account segment, so
those rows leaked their raw key and were dropped from the sidebar's channel sections.

Addresses the session-label portion of #123112. That issue also reports that outbound
sends through a non-default account leave the target session's history empty. This change
does not implement or test that path, so the issue stays open.

Why This Change Was Made

Display should not have to recover the account from the key. The Gateway already parses
the canonical delivery route and records accountId on every session row
(src/gateway/session-classification.ts, packages/gateway-protocol/src/schema/sessions-row.ts).
The resolver now consumes that recorded fact and parses the key only as a fallback, for
panes rendered before their row arrives. The account suffix is applied at one point rather
than on each naming branch, so a future branch cannot silently skip it.

Which account to show is taken from the recorded value alone — never read out of the
rendered name, and never out of a (<accountId>) in a label — so a user label that happens
to read like an account cannot suppress or fake the discriminator. The rendered name is
consulted for exactly one thing: whether the suffix is already on the end.

That check is idempotence rather than inference, and it earns its place because the chat
pane's inline title rename is a live producer of suffixed labels. beginHeaderRename seeds
its input with customLabel ?? paneTitle, and paneTitle is the resolved display name,
which this PR teaches to carry the account. commitHeaderRename skips the write only when
the derived title comes back completely untouched, so a partial edit persists verbatim:
opening the rename on an unlabeled cards session and typing a word in front of
Alice · cards stores VIP Alice · cards. Appending unconditionally would then render
VIP Alice · cards · cards.

The sidebar dialog is no longer such a producer. It pre-filled with the resolved display
name, so submitting it persisted a derived string as a real user label, which then
outranked every later derivation. Sidebar rows now carry the stored label alongside the
resolved one and rename edits that, matching what the Sessions page already did.

Follow-up, not fixed here: an editable field should be seeded from the stored label, or at
most from the undecorated name, so presentation never becomes persisted data. Fixing it in
the chat pane changes a deliberate affordance from #121452 and wants its own discussion, so
this PR keeps the idempotence check and leaves the producer alone.

Key grammar is held to shapes producers actually emit. buildAgentPeerSessionKey scopes
accounts to direct sessions only (src/routing/session-key.ts), so an account segment is
accepted only before direct/dm. Both display and channel classification enforce that;
previously agent:<agent>:<channel>:<account>:group:<id> was filed under a channel even
though the canonical route parser rejects it.

User Impact

Sidebar rows, command palette entries, chat pane titles, recent chats, and dashboard rows
show the account for any session on a non-default account: Alice for the default account,
Alice · cards for the cards account. The default account adds no suffix and
account-less keys are unchanged. Sessions whose keys still use the pre-#11881 dm spelling
stop leaking their raw key and are grouped under their channel again.

Evidence

Control UI sidebar, isolated Gateway fixture, real Control UI under Playwright Chromium.
Two Telegram direct chats that both resolve to the name Alice:

  • agent:main:telegram:direct:42 renders Alice
  • agent:main:telegram:cards:direct:42 renders Alice · cards

Control UI sidebar: Alice vs Alice · cards

The browser fixture now builds ordinary Gateway rows: an origin-derived displayName, no
user label, and the accountId the Gateway projects from the canonical route. Without both
traits the scenario would exercise the label-precedence branch instead of the shipped one.

Resolver regressions in ui/src/lib/session-display.test.ts:

Key / row Expected
Account-less direct, displayName: Alice Alice
Account-qualified direct, accountId: cards, displayName: Alice Alice · cards
Account-qualified dm, accountId: cards, displayName: Alice Alice · cards
Unnamed account-qualified dm Telegram · …567890 · cards
accountId: default no account suffix
accountId: work, label Alice (work) Alice (work) · work
accountId: cards, label Alice · cards Alice · cards, not doubled
Canonical account-less group key Telegram Group, unchanged
agent:main:dm:account:group:room not read as an account-qualified group
Account-less key, accountId: cards on the row only Alice · cards
Key says cards, row says ops Alice · ops, the projection wins
resolveChannelSessionInfo on a dm key channel session on telegram
resolveChannelSessionInfo on <channel>:<account>:group:<id> not a channel session

Commands:

$ node scripts/run-vitest.mjs ui/src/lib/session-display.test.ts
$ node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner \
    ui/src/e2e/session-management.account-label.e2e.test.ts
$ node scripts/check-changed.mjs --dry-run -- ui/src/lib/session-display.ts \
    ui/src/lib/session-display.test.ts ui/src/e2e/session-management.account-label.e2e.test.ts
[check:changed:dry-run] lanes=coreTests, ui

Prior attempt #123186 parsed the key into the unnamed fallback only and closed unmerged:
named displayName rows still collided. Surface: production +81/-32 across four files
(net +49), of which 34 added lines are comments and 14 are an unchanged block re-indented
into a helper; tests +213/-1.

Related:

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 15, 2026, 7:31 PM ET / 23:31 UTC.

ClawSweeper review

What this changes

The PR makes Control UI session labels distinguish non-default channel accounts and legacy direct-message keys, while keeping sidebar rename dialogs bound to stored user labels.

Merge readiness

⚠️ Needs maintainer review before merge - 4 items remain

The PR’s core Gateway-row-based label repair is sound, but it mislabels configured named default accounts and needs one focused correction before merge.

Priority: P2
Reviewed head: 9241a661fd8ca4e902edee119ebadab170398887

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The branch has strong direct UI proof and a coherent core repair, but the named-default compatibility defect blocks merge.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): A running Control UI screenshot directly demonstrates the primary account-label distinction; the focused repair needs refreshed proof for a configured named default.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): A running Control UI screenshot directly demonstrates the primary account-label distinction; the focused repair needs refreshed proof for a configured named default.
Evidence reviewed 8 items PR suppresses only a literal default account: The new suffix helper omits only accountId === "default", so any configured named default is rendered with an account suffix.
Telegram supports named configured defaults: Telegram resolves channels.telegram.defaultAccount to the account ID used as its default, rather than requiring the literal default ID.
Named-default contract has regression coverage: The existing Telegram test configures defaultAccount: "alerts" and verifies that alerts is the default account.
Findings 1 actionable finding [P2] Project the configured default-account fact
Security None None.

How this fits together

Gateway session rows carry routing facts into the Control UI display resolver, which produces labels for sidebars and chat panes. Rename actions then persist only user-owned labels back through the Gateway session mutation flow.

flowchart LR
  A[Channel account configuration] --> B[Gateway session row]
  C[Session routing key] --> B
  B --> D[Control UI display resolver]
  D --> E[Sidebar and chat titles]
  E --> F[Rename action]
  F --> G[Stored user label]
Loading

Before merge

  • Project the configured default-account fact (P2) - defaultAccount may be a named account such as alerts, but this check suppresses only literal default. Gateway rows expose only accountId, so a named configured default renders as Alice · alerts, contrary to the stated default-account behavior. Project default identity from the Gateway and cover a named default before merge.
  • Resolve merge risk (P1) - A configured named default account, such as Telegram alerts, will display · alerts despite the PR’s stated default-account behavior because the UI receives only an account ID.
  • Resolve merge risk (P1) - Production code is net +52 lines; the added canonical display and stored-label boundary is justified, but the repair should avoid adding a UI-side plugin-config lookup.
  • Complete next step (P2) - A narrow owner-boundary repair can add the missing default-account projection and regression coverage without changing product direction.

Findings

  • [P2] Project the configured default-account fact — ui/src/lib/session-display.ts:121-122
Agent review details

Security

None.

PR surface

Source +52, Tests +212. Total +264 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 81 29 +52
Tests 2 213 1 +212
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 294 30 +264

Review metrics

Metric Value Why it matters
Production vs test delta production +81/-29 (net +52); tests +213/-1 The positive bug-fix growth adds one display-owner boundary and compatibility grammar; it should remain bounded to a Gateway-projected default-account fact rather than UI config inference.

Stored data model

Persistent data-model change detected: serialized state: ui/src/components/session-organizer-controller.ts, serialized state: ui/src/e2e/session-management.account-label.e2e.test.ts, serialized state: ui/src/lib/session-display.test.ts, serialized state: ui/src/lib/session-display.ts, unknown-data-model-change: ui/src/e2e/session-management.account-label.e2e.test.ts, unknown-data-model-change: ui/src/lib/session-display.test.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #123112
Summary: This PR is a candidate fix for the session-label portion of the canonical multi-account report, with the outbound-history behavior intentionally left open.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Project configured-default identity (recommended)
    Add a generic Gateway row fact for the configured default account, preserve raw account IDs, and cover named-default and non-default rendering before merge.
  2. Intentionally name configured defaults
    Accept the visible suffix for named configured defaults only if maintainers explicitly change the stated default-account display contract.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Add an additive Gateway default-account fact derived through the channel plugin contract, update Control UI suffix logic to use it, and add named-default regression and browser proof.

Technical review

Best possible solution:

Project an additive Gateway default-account fact through the existing generic channel-plugin resolver, retain raw accountId, and let the UI suppress the suffix only from that recorded fact.

Do we have a high-confidence way to reproduce the issue?

Yes—source establishes that a configured defaultAccount: "alerts" resolves to alerts, while this PR appends every nonliteral account ID; no execution was needed to identify the mismatch.

Is this the best way to solve the issue?

No—the UI cannot determine configured-default identity from accountId alone; a Gateway-projected fact via the existing generic plugin resolver is the maintainable owner-boundary fix.

Full review comments:

  • [P2] Project the configured default-account fact — ui/src/lib/session-display.ts:121-122
    defaultAccount may be a named account such as alerts, but this check suppresses only literal default. Gateway rows expose only accountId, so a named configured default renders as Alice · alerts, contrary to the stated default-account behavior. Project default identity from the Gateway and cover a named default before merge.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5014839937b9.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): A running Control UI screenshot directly demonstrates the primary account-label distinction; the focused repair needs refreshed proof for a configured named default.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: The patch leaves a bounded but user-visible multi-account label error for installations with a configured named default.
  • merge-risk: 🚨 compatibility: Merging changes labels for existing persisted sessions and currently misidentifies configured named defaults.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): A running Control UI screenshot directly demonstrates the primary account-label distinction; the focused repair needs refreshed proof for a configured named default.
  • proof: sufficient: Contributor real behavior proof is sufficient. A running Control UI screenshot directly demonstrates the primary account-label distinction; the focused repair needs refreshed proof for a configured named default.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. A running Control UI screenshot directly demonstrates the primary account-label distinction; the focused repair needs refreshed proof for a configured named default.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs ui/src/lib/session-display.test.ts src/gateway/session-classification.test.ts extensions/telegram/src/accounts.test.ts.
  • [P1] node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-management.account-label.e2e.test.ts.
  • [P1] node scripts/check-changed.mjs --dry-run -- ui/src/lib/session-display.ts ui/src/lib/session-display.test.ts src/gateway/session-classification.ts packages/gateway-protocol/src/schema/sessions-row.ts.

What I checked:

Likely related people:

  • vyctorbrzezowski: Recent main work owns the chat-session interaction surface, and their PR commits refined the Gateway-row and rename-boundary approach. (role: recent area contributor; confidence: high; commits: 5014839937b9, 754978e5e99d, 0c4288a2286d; files: ui/src/pages/chat/chat-pane-session-menu.ts, ui/src/lib/session-display.ts)
  • steipete: The merged chat-header session-menu work established the inline rename producer whose derived labels this PR must remain compatible with. (role: feature introducer; confidence: medium; commits: 9d77e5c3b75b; files: ui/src/pages/chat/chat-pane-session-menu.ts)
  • quotentiroler: The merged direct-message naming migration established the retained dm session-key compatibility path changed by this PR. (role: compatibility change author; confidence: medium; commits: 223eee0a20c4; files: src/sessions/session-key-utils.ts)
  • Yuval Dinodia: Current shallow blame reaches the Telegram default-account resolver at a graft boundary, so this is a routing candidate with incomplete historical provenance. (role: adjacent default-account contributor; confidence: low; commits: b5a0deb068cb; files: extensions/telegram/src/account-selection.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Project configured-default identity from Gateway rather than inferring it in the UI.
  • Add a named-default regression and refreshed Control UI evidence showing the default remains unsuffixed.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (8 earlier review cycles)
  • reviewed 2026-08-15T18:47:39.151Z sha 9219d7b20b979a7549418efed8f99d7ec1c0b4ed :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T19:55:31.848Z sha 4985dc198fd57a971dfd31bdb3e3dec0df8091a3 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T20:05:04.520Z sha 4985dc198fd57a971dfd31bdb3e3dec0df8091a3 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T20:22:41.068Z sha 7384f4c33f3f2eab54d0563f5a8228bce546918f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T20:28:18.659Z sha 7384f4c33f3f2eab54d0563f5a8228bce546918f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T22:17:20.243Z sha 7ca022d :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T22:24:10.311Z sha 7ca022d :: needs changes before merge. :: [P1] Preserve account-qualified stored labels
  • reviewed 2026-08-15T22:32:59.192Z sha af73ff7 :: needs maintainer review before merge. :: none

@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 15, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 15, 2026
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Pushed a follow-up commit that changes behavior beyond the previously reviewed head, so this needs a fresh look rather than a carry-over.

What changed since 9219d7b20b97:

  • The resolver consumes the accountId the Gateway already projects onto session rows (src/gateway/session-classification.ts) instead of re-deriving it from the key. Key parsing stays only as a fallback for panes rendered before their row arrives.
  • Key parsing and channel classification cover the pre-refactor: unify peer kind to ChatType, rename dm to direct #11881 dm spelling. Keys written before that rename still persist and the canonical parser still accepts both (src/sessions/session-key-utils.ts); those rows previously leaked their raw key and were dropped from the sidebar's channel sections.
  • The account-qualified group branch is removed. buildAgentPeerSessionKey scopes accounts to direct sessions only (src/routing/session-key.ts), so group keys stay on their canonical shape and an account-looking segment in a custom key is not read as an account.
  • A label ending in (<accountId>) no longer suppresses the account discriminator. Only the exact · <accountId> suffix does, because the sidebar rename dialog pre-fills with the resolved name (ui/src/components/session-organizer-controller.ts) and that string can come back in as a stored label.
  • The browser fixture builds ordinary Gateway rows — origin-derived displayName, no user label, projected accountId — so it exercises the shipped path instead of label precedence.

Both rank-up moves from the last review are addressed. The closing reference is narrowed to the session-label portion, so #123112 stays open for the outbound-history path it also reports.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 15, 2026
@vyctorbrzezowski

vyctorbrzezowski commented Aug 15, 2026 •

Copy link
Copy Markdown
Member

Suffix detection no longer reads rendered text. The account is appended from the recorded value alone; the · <accountId> check is gone entirely. It only existed to defend against a string the UI produced itself: the sidebar rename dialog pre-filled with the resolved display name, so submitting it persisted a derived string as a real user label that then outranked every later derivation. Sidebar rows now carry the stored label next to the resolved one (userLabel), and rename edits that — matching what the Sessions page already did. Confirmation dialogs and menus keep using the resolved name, which is correct for display. That was the only path persisting a derived string.

Channel classification is held to canonical shapes. An account segment is accepted only before direct/dm, mirroring buildAgentPeerSessionKey (src/routing/session-key.ts). agent:<agent>:<channel>:<account>:group:<id> and agent:<agent>:<channel>:<account>:channel:<id> no longer name a channel. That also retired an assertion in the existing suite which had pinned agent:main:slack:acct-1:channel:C1 as a Slack session — the canonical route parser rejects that key, so the assertion was pinning a shape no producer emits.

I did not take the "consume the Gateway classification fact" option, and I want to flag why rather than have it read as an oversight. Rows do carry a canonical peerKind, and gating on it is the better long-term shape. But channel on a row comes from deliveryFields.channel ?? parseGroupKey(key), so a direct session with no recorded delivery has no channel, and the E2E sessionRow fixture sets no peerKind at all — gating on it would silently reclassify every fixture-backed sidebar assertion. That is a worthwhile follow-up with its own fixture work, not something to fold in here.

Tests now prove the projection is authoritative. Previously every fixture duplicated an account the key already carried, so ignoring row.accountId still passed. Added a case where only the projection supplies account identity, and a disagreement case asserting the projection wins over the key guess.

On the closing reference: closingIssuesReferences is empty and the body has read "Addresses the session-label portion of #123112" since before this review posted; neither commit message carries a closing keyword. That finding looks like it was raised against the pre-edit body. #123112 stays open for the outbound-history path.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

SebTardif and others added 3 commits August 15, 2026 14:49
Parse the optional account segment on per-account-channel-peer DM and
group keys so Control UI no longer falls through to the raw routing
key. Append a non-default account as " · accountId" on label,
displayName, and fallback so two Alice rows from different Telegram
accounts stay distinguishable.

Signed-off-by: Sebastien Tardif <[email protected]>
The display resolver was reading the account out of the session key and
inferring it from label text. That missed the shipped `dm` spelling of
direct keys, invented an account-qualified group shape no key builder
emits, and treated any name ending in "(<account>)" as already
disambiguated.

The Gateway already projects the canonical `accountId` onto every session
row from the delivery route, so display consumes that and parses the key
only for panes rendered before their row arrives. Key parsing now covers
both `direct` and the pre-openclaw#11881 `dm` spelling, group keys go back to
their canonical account-less shape, and the account suffix is applied at
a single point instead of five.

`resolveChannelSessionInfo` classifies `dm` keys as channel sessions and
no longer reads a peer kind sitting in the channel slot as a channel.
Three related text-inference defects in the same display neighborhood:

The account suffix was skipped when the resolved name already ended in
" · <account>". That reads rendered output as if it were a fact, and it
cannot tell an account apart from a user label that happens to look like
one. The suffix is now appended from the recorded account alone.

The string it was defending against came from the sidebar rename dialog,
which pre-filled with the resolved display name. Submitting persisted a
derived string as a real user label, which then outranked every later
derivation. Sidebar rows now carry the stored label alongside the
resolved one, and rename edits that, matching the Sessions page.

Channel classification accepted an account segment before any peer kind,
so `agent:<x>:<channel>:<account>:group:<id>` was filed under a channel
even though accounts qualify direct chats only and the canonical route
parser rejects the shape. The grammar now allows an account only before
`direct`/`dm`.

Resolver tests now prove the row projection is authoritative rather than
duplicating an account the key already carries: one case where only the
projection supplies it, and one where the two disagree.
@SebTardif
SebTardif force-pushed the fix/123112-session-label-account branch from 7384f4c to 0c4288a Compare August 15, 2026 21:53
SebTardif and others added 2 commits August 15, 2026 15:09
The existing sidebar rename coverage uses a row that already has a stored
label, so it passes whether rename pre-fills the stored label or the
resolved display name. It could not catch the round-trip this branch
repaired.

Adds a browser case on a displayName-only row with a projected account:
the sidebar shows "Alice · cards" and the rename field opens blank. On
the parent commit the field opens holding "Alice · cards", which is the
string that used to become a real user label on submit.
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Good catch — the existing rename coverage used a row that already had a stored label, so it passed whether the field pre-filled the stored label or the resolved display name. It could not have caught the round-trip this branch repairs.

Added the case you asked for to the account-label E2E: a displayName-only row on the cards account, with no user label. The sidebar renders Alice · cards, and opening Rename asserts the field is blank.

On the parent commit that field opens holding Alice · cards. The path is session-organizer-controller.ts pre-filling defaultValue: session.label, where app-sidebar-session-navigation-logic.ts sets label to resolveSessionDisplayName(row.key, row, …) — for this fixture, the decorated name. That is exactly the string that became a real user label on submit and then outranked every later derivation.

One note on the branch state: it was rebased onto current main after the last review, so the three earlier commits carry new SHAs (0d67ac29, 754978e5, 0c4288a2). I verified the rebase preserved all six touched files byte-for-byte before building on top. The full-CI run on the pre-rebase equivalent of 0c4288a2 was green across every shard.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 15, 2026
A persisted label that already ends in " · accountId" must stay as-is
so "Alice · cards" does not become "Alice · cards · cards".

Signed-off-by: Sebastien Tardif <[email protected]>
@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

[P1] Preserve account-qualified stored labels

Pushed af73ff7: withAccountDisambiguator is idempotent for an exact · accountId suffix, so a stored Alice · cards stays Alice · cards.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 15, 2026
The comment above withAccountDisambiguator claimed the rendered name is
never inspected, which the suffix check contradicts. State the real
contract instead: the account itself still comes only from the recorded
value, and the endsWith check is idempotence against the chat pane's
inline rename, which seeds its input with the rendered title and
persists a partial edit verbatim.
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Thanks for pushing af73ff7 — I went to revert it and ended up keeping it, so I owe you the reasoning.

My starting position was that the guard defended a state the product cannot produce. The suffix ships in this PR, and the rename work in this same PR moved both the sidebar dialog and the Sessions page onto the stored label, so neither of those can persist a derived " · <account>" string any more. On that reading the only way to store Alice · cards is to type it deliberately, and the documented contract for a deliberately typed label is verbatim plus the discriminator — the Alice (work) / work row in the table.

That reading was wrong, and the surface I missed is the chat pane's inline title rename. beginHeaderRename seeds the input with customLabel ?? this.paneTitle, and paneTitle is the resolved display name — which, after this PR, carries the account suffix. commitHeaderRename only skips the write when the derived title comes back completely untouched; any partial edit is a normal label write and goes through verbatim. So an operator who opens the rename on an unlabeled cards session, sees Alice · cards, and types a word in front of it stores VIP Alice · cards. Without your guard that row then renders VIP Alice · cards · cards.

I confirmed that end to end against this head rather than reading it off the diff: driving beginHeaderRename with a cards row pre-fills Alice · cards, and committing VIP Alice · cards patches that exact string onto the session.

So the guard is earning its place, and it is idempotence rather than inference — the account still comes only from the recorded accountId, and the check never decides whether a session belongs to an account, only whether the suffix is already on the end. I have pushed one commit on top of yours (9241a66, comment text only) that rewrites the comment above withAccountDisambiguator, which still claimed the rendered name is never inspected, and corrected the same claim in the PR body. Naming the producer at the call site matters more than usual here, because the next person to read that function will otherwise delete the check for exactly the reason I almost did.

The deeper fix belongs at the producer: an editable field should be seeded with the stored label, or at most with the undecorated name, so presentation never becomes persisted data. That is a change to a deliberate affordance from #121452 and wants its own discussion, so I have recorded it as a follow-up in the PR body instead of widening this one. Landing the idempotence guard now keeps the reachable flow rendering correctly in the meantime.

Nice catch, and thanks for your patience through the review rounds. Landing this once exact-head CI finishes. #123112 stays open for the outbound-history half, as your description already says.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 15, 2026
@vyctorbrzezowski
vyctorbrzezowski merged commit bf4ec4b into openclaw:main Aug 15, 2026
120 checks passed
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
* fix(ui): disambiguate multi-account session labels

Parse the optional account segment on per-account-channel-peer DM and
group keys so Control UI no longer falls through to the raw routing
key. Append a non-default account as " · accountId" on label,
displayName, and fallback so two Alice rows from different Telegram
accounts stay distinguishable.

Signed-off-by: Sebastien Tardif <[email protected]>

* fix(ui): take the session account from the gateway row

The display resolver was reading the account out of the session key and
inferring it from label text. That missed the shipped `dm` spelling of
direct keys, invented an account-qualified group shape no key builder
emits, and treated any name ending in "(<account>)" as already
disambiguated.

The Gateway already projects the canonical `accountId` onto every session
row from the delivery route, so display consumes that and parses the key
only for panes rendered before their row arrives. Key parsing now covers
both `direct` and the pre-openclaw#11881 `dm` spelling, group keys go back to
their canonical account-less shape, and the account suffix is applied at
a single point instead of five.

`resolveChannelSessionInfo` classifies `dm` keys as channel sessions and
no longer reads a peer kind sitting in the channel slot as a channel.

* fix(ui): stop inferring session identity from rendered text

Three related text-inference defects in the same display neighborhood:

The account suffix was skipped when the resolved name already ended in
" · <account>". That reads rendered output as if it were a fact, and it
cannot tell an account apart from a user label that happens to look like
one. The suffix is now appended from the recorded account alone.

The string it was defending against came from the sidebar rename dialog,
which pre-filled with the resolved display name. Submitting persisted a
derived string as a real user label, which then outranked every later
derivation. Sidebar rows now carry the stored label alongside the
resolved one, and rename edits that, matching the Sessions page.

Channel classification accepted an account segment before any peer kind,
so `agent:<x>:<channel>:<account>:group:<id>` was filed under a channel
even though accounts qualify direct chats only and the canonical route
parser rejects the shape. The grammar now allows an account only before
`direct`/`dm`.

Resolver tests now prove the row projection is authoritative rather than
duplicating an account the key already carries: one case where only the
projection supplies it, and one where the two disagree.

* ci: retrigger after check-lint shard cancel

Signed-off-by: Sebastien Tardif <[email protected]>

* test(ui): prove rename opens on the stored label

The existing sidebar rename coverage uses a row that already has a stored
label, so it passes whether rename pre-fills the stored label or the
resolved display name. It could not catch the round-trip this branch
repaired.

Adds a browser case on a displayName-only row with a projected account:
the sidebar shows "Alice · cards" and the rename field opens blank. On
the parent commit the field opens holding "Alice · cards", which is the
string that used to become a real user label on submit.

* fix(ui): do not double-append a stored account suffix

A persisted label that already ends in " · accountId" must stay as-is
so "Alice · cards" does not become "Alice · cards · cards".

Signed-off-by: Sebastien Tardif <[email protected]>

* docs(ui): name the producer the account suffix check defends

The comment above withAccountDisambiguator claimed the rendered name is
never inspected, which the suffix check contradicts. State the real
contract instead: the account itself still comes only from the recorded
value, and the endsWith check is idempotence against the chat pane's
inline rename, which seeds its input with the rendered title and
persists a partial edit verbatim.

---------

Signed-off-by: Sebastien Tardif <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants