Skip to content

feat(users-page): show openclaw channel + username columns#1

Merged
alexanderkreidich merged 1 commit into
openclaw-stablefrom
sasha/2bb-284-openclaw-users-columns
Apr 16, 2026
Merged

feat(users-page): show openclaw channel + username columns#1
alexanderkreidich merged 1 commit into
openclaw-stablefrom
sasha/2bb-284-openclaw-users-columns

Conversation

@alexanderkreidich

Copy link
Copy Markdown

Summary

Surfaces OpenClaw trace metadata on the Users page so operators can see which channel a user came from (telegram, mattermost, …) and a human-readable sender name next to the raw userId.

Two new columns are added between User ID and Environment:

  • Channel — from metadata['openclaw_channel']
  • Username — prefers openclaw_sender_username, falls back to openclaw_sender_name, then openclaw_sender_label (raw sender IDs are never used)

Why now

LiteLLM just started producing Mattermost OpenClaw metadata (see 2bb-dev/litellm#5). With that in place, the Users page today shows the hashed trace_user_id (mattermost:pwanex3ne3fx58nr5oaxg4j54w) with no way to tell at a glance which platform the user is on or what their display name is. These two columns fix that.

No persistence change

Channel + username are derived from existing traces.metadata ClickHouse Map values. getUserMetrics in packages/shared/src/server/repositories/traces.ts aggregates them with:

  • anyIf(t.openclaw_channel, t.openclaw_channel != '')
  • coalesce(nullIf(username, ''), nullIf(name, ''), nullIf(label, '')) — priority-ordered

…and propagates them through the users.metrics tRPC endpoint into the React DataTable. No new columns, no new indexes, no migrations.

Tests

Backend integration tests added in `web/src/tests/server/users-ui-table.servertest.ts`:

  • `surfaces openclaw_channel and coalesced openclaw sender identity`
  • `returns null openclaw fields when trace metadata is missing`

These require ClickHouse (servertest pattern) — not runnable locally without docker, but work alongside the existing `getUserMetrics` tests in the same file.

Files changed

  • `packages/shared/src/server/repositories/traces.ts` — `getUserMetrics` query + DTO
  • `web/src/server/api/routers/users.ts` — `users.metrics` exposes the new fields
  • `web/src/pages/project/[projectId]/users.tsx` — two new columns + row data mapping
  • `web/src/tests/server/users-ui-table.servertest.ts` — coverage

Test plan

  • `pnpm test --selectProjects server -- -t "surfaces openclaw_channel"` against a ClickHouse that has openclaw-tagged traces
  • Load `/project//users` with at least one Telegram + one Mattermost trace and confirm both channels render
  • Confirm users without any openclaw metadata still render (columns blank)

Refs: 2BB-284 · Pairs with 2bb-dev/litellm#5

🤖 Generated with Claude Code

Surfaces OpenClaw trace metadata on the Users page so channel
(telegram, mattermost, ...) and a human-readable sender name appear
alongside userId. Username prefers openclaw_sender_username, falls
back to openclaw_sender_name, then openclaw_sender_label; never shows
raw sender IDs.

Values are derived from existing trace metadata in the ClickHouse
traces table - no persistence-schema changes. Extends the existing
getUserMetrics query to aggregate with anyIf(x != '') over the
two new computed columns and propagates them through users.metrics
tRPC and the Users table columns.

Adds backend integration tests covering the coalesce priority and
the null-metadata case.

Refs: 2BB-284
@github-actions

Copy link
Copy Markdown

@claude review

@alexanderkreidich alexanderkreidich merged commit 1366ea8 into openclaw-stable Apr 16, 2026
5 of 15 checks passed
@alexanderkreidich alexanderkreidich deleted the sasha/2bb-284-openclaw-users-columns branch April 17, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant