Skip to content

fix(feishu): hide meaningless 'main' card header in streaming and static cards#48385

Closed
Pengxiao-Wang wants to merge 2 commits intoopenclaw:mainfrom
Pengxiao-Wang:fix/feishu-streaming-card-header
Closed

fix(feishu): hide meaningless 'main' card header in streaming and static cards#48385
Pengxiao-Wang wants to merge 2 commits intoopenclaw:mainfrom
Pengxiao-Wang:fix/feishu-streaming-card-header

Conversation

@Pengxiao-Wang
Copy link
Copy Markdown

Summary

  • Suppress the "main" fallback in resolveCardHeader when agentId === "main" and no identity name/emoji is configured
  • Skip the card header entirely when both name and emoji are empty
  • Applies to both streaming cards and static card replies

Why

When no agent identity is configured (the common default setup), the card header displays the raw agentId value "main", which is confusing and provides no useful information to end users.

Test plan

  • Default agent (no identity configured) — verify streaming and static cards have no header
  • Agent with custom identity name — verify header shows the configured name
  • Agent with custom emoji — verify header shows the emoji
  • Subagent with non-"main" agentId — verify header shows the agentId as fallback

🤖 Generated with Claude Code

…tic cards

When no agent identity name or emoji is configured, `resolveCardHeader`
falls back to the raw `agentId`. For the default agent this produces a
card titled "main", which is confusing for end users.

Suppress the fallback when `agentId === "main"` and skip the header
entirely when both name and emoji are empty. This applies to both
streaming cards and static card replies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: XS labels Mar 16, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 16, 2026

Greptile Summary

This PR fixes a UX issue in the Feishu integration where the raw string "main" was being displayed as a card header title for the default agent — a confusing artifact of the agent ID being used as a fallback when no identity is configured.

The change modifies resolveCardHeader to suppress "main" as a fallback name and adds an early return producing title: "" when both name and emoji are empty. Both the streaming card path (line 272) and the static card path (line 433) are updated to conditionally omit the header when cardHeader.title is falsy, which correctly handles the empty-string sentinel.

Key observations:

  • The core logic is sound and correctly handles all four documented test scenarios (default agent, name-only identity, emoji-only identity, non-"main" subagent).
  • One minor edge case: when agentId === "main", no name is set, but an emoji IS configured, the title becomes "🤖 " (emoji followed by a trailing space from the template literal `${emoji} ${name}` where name is ""). Trimming the final composed title would resolve this.
  • resolveCardNote (line 67) still falls back to the raw agentId (including "main"), so the note footer still shows "Agent: main" for the default agent. This is a pre-existing inconsistency and out of scope for this PR, but may be worth a follow-up.

Confidence Score: 4/5

  • Safe to merge; the change is narrowly scoped, functionally correct, and only introduces a minor cosmetic edge case.
  • Both streaming and static card code paths were correctly updated. The sentinel value approach (empty string title → omit header) is consistent throughout. The one minor issue — a trailing space in the title when only emoji is set for the "main" agent — is a cosmetic edge case with no runtime impact.
  • No files require special attention.

Comments Outside Diff (1)

  1. extensions/feishu/src/reply-dispatcher.ts, line 54-58 (link)

    Trailing space in title when only emoji is configured

    When agentId === "main", identity.name is empty/unset, but identity.emoji is configured, name resolves to "". The early return is skipped (because emoji is truthy), and the title is built as `${emoji} ${name}` which produces e.g. "🤖 " — a trailing space after the emoji. This is a new edge case introduced by this change (previously name always fell back to a non-empty agentId).

    A simple fix is to trim the final composed title:

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/feishu/src/reply-dispatcher.ts
Line: 54-58

Comment:
**Trailing space in title when only emoji is configured**

When `agentId === "main"`, `identity.name` is empty/unset, but `identity.emoji` is configured, `name` resolves to `""`. The early return is skipped (because `emoji` is truthy), and the title is built as `` `${emoji} ${name}` `` which produces e.g. `"🤖 "` — a trailing space after the emoji. This is a new edge case introduced by this change (previously `name` always fell back to a non-empty `agentId`).

A simple fix is to trim the final composed title:

```suggestion
  if (!name && !emoji) return { title: "", template: identity?.theme ?? "blue" };
  return {
    title: (emoji ? `${emoji} ${name}` : name).trim(),
    template: identity?.theme ?? "blue",
  };
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: e176af9

When only emoji is set and name is empty (e.g. agentId === "main"),
the template literal `${emoji} ${name}` produces a trailing space.
Trim the composed title to avoid this cosmetic edge case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vincentkoc vincentkoc self-assigned this Apr 25, 2026
@vincentkoc vincentkoc added dedupe:child Duplicate issue/PR child in dedupe cluster close:superseded PR close reason labels Apr 25, 2026
@vincentkoc
Copy link
Copy Markdown
Member

Covered by #71542. Current main now omits the generic main card header for Feishu streaming and static cards while preserving configured names, emoji, and non-main agent fallbacks.

Closing this as superseded. Thanks for catching the default-header polish issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu close:superseded PR close reason dedupe:child Duplicate issue/PR child in dedupe cluster size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants