Skip to content

feat(feishu): configurable group and DM display-name resolution#38958

Closed
futuremind2026 wants to merge 5 commits intoopenclaw:mainfrom
MaGonglei:pr/feishu-dm-display-chatmembers-20260307-01
Closed

feat(feishu): configurable group and DM display-name resolution#38958
futuremind2026 wants to merge 5 commits intoopenclaw:mainfrom
MaGonglei:pr/feishu-dm-display-chatmembers-20260307-01

Conversation

@futuremind2026
Copy link
Copy Markdown
Contributor

@futuremind2026 futuremind2026 commented Mar 7, 2026

Summary

  • restore Feishu group display names in session labels
  • restore topic/root-message labels for topic-scoped Feishu sessions
  • restore DM peer-name fallback through chatMembers
  • prefer user_id before open_id when resolving group sender display names

Current Scope

This PR was refreshed on top of current main.

Older config-schema/type changes from the original branch were intentionally dropped because current upstream main already covers that layer. The refreshed PR now only carries the remaining behavior changes that are still missing on main:

  • extensions/feishu/src/bot.ts
  • extensions/feishu/src/bot.test.ts
  • src/config/sessions/group.ts
  • src/config/sessions.test.ts

Behavior

  • keep Feishu group labels human-readable instead of collapsing to slug-like fallbacks
  • append chat id only when it is not already visible
  • surface topic/root labels in thread-scoped context labels
  • use chatMembers for DM display-name fallback
  • prefer user_id for group sender-name lookup when available

Validation

Local refresh validation:

  • branch was rebuilt directly on current main
  • note: temporary local test-worktree environment on my side could not give a reliable fresh root-vitest run after the refresh, so authoritative verification should come from GitHub Actions on this refreshed branch

Notes

  • duplicate combined draft PR #48898 was closed; this PR remains the canonical upstream Feishu thread for this change set
  • current upstream main already includes the older config-schema/type layer, so this PR is now intentionally much smaller than the original version

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 7, 2026

Greptile Summary

This PR adds two configurable display-name resolution features to the Feishu integration — resolveGroupNames for group chat labels and resolveDmDisplayNames for DM labels — both defaulting to true for backward compatibility. The implementation refactors name resolution into dedicated helpers and aligns the DM member lookup with the current SDK path while retaining a compatibility fallback.

Key observations:

  • The new config flags and defaults are correctly defined in config-schema.ts and respected at runtime in bot.ts with ?? true guards.
  • The shared senderNameCache between DM and group lookup paths is an intentional optimization; display output is best-effort and does not affect routing or session keys.
  • The channel.ts JSON schema receives the two new boolean fields but omits the closely-related pre-existing resolveSenderNames flag, creating an inconsistency where all three optimization flags are declared together in config-schema.ts (lines 172–174 and 221–223) but the schema only documents two of them.

Confidence Score: 4/5

  • Safe to merge; all changes are display-only and backward-compatible with defaults of true.
  • The logic is well-scoped (display labels only, no routing changes), defaults preserve existing behaviour, caching is correct, and 73 tests pass. One minor inconsistency exists in the channel.ts JSON schema where resolveSenderNames is absent alongside the two newly documented flags, creating incomplete documentation of the optimization flags group.
  • extensions/feishu/src/channel.ts — the JSON schema omits resolveSenderNames while adding the two sibling flags.

Last reviewed commit: 823e02f

Comment thread extensions/feishu/src/channel.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 823e02f151

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/config-schema.ts Outdated
Comment thread extensions/feishu/src/bot.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1ffe1379f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot.ts Outdated
Comment thread extensions/feishu/src/bot.ts Outdated
@futuremind2026
Copy link
Copy Markdown
Contributor Author

Follow-up update: preserve Feishu unicode group names in session display labels and add topic/thread labels for topic-scoped Feishu sessions.

  • Group display names now keep human-readable subject text (instead of slug fallback like g-oc_...).
  • Topic-scoped sessions now attach ThreadLabel / MessageThreadId when root/topic context exists, so WebUI can show sub-topic context.
  • Non-topic sessions keep thread fields unset (no fake topic).

Validation:

  • extensions/feishu/src/bot.test.ts + extensions/feishu/src/config-schema.test.ts
  • src/config/sessions.test.ts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cba1d7351c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot.ts Outdated
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Mar 8, 2026
@futuremind2026
Copy link
Copy Markdown
Contributor Author

Pushed a follow-up commit to fix the failing CI check on this PR:

  • fix(ci): sync doctor gateway auth token test formatting
  • Syncs src/commands/doctor-gateway-auth-token.test.ts with current main formatting so pnpm check passes again.

Local verification on the updated branch:

  • pnpm check ✅
  • pnpm vitest run --config vitest.extensions.config.ts extensions/feishu/src/bot.test.ts extensions/feishu/src/config-schema.test.ts ✅
  • pnpm vitest run src/commands/doctor-gateway-auth-token.test.ts ✅

CI has been re-triggered after push; waiting for the full matrix results.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a37e02b5e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot.ts Outdated
@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from 0a37e02 to 8c5d999 Compare March 8, 2026 04:54
@openclaw-barnacle openclaw-barnacle Bot removed the commands Command implementations label Mar 8, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c5d999af5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot.ts Outdated
@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from 8c5d999 to 3a56c54 Compare March 8, 2026 05:10
@futuremind2026
Copy link
Copy Markdown
Contributor Author

Follow-up update:

  • Rebased this PR branch onto latest main and force-pushed.
  • PR head is now 3a56c540adf30c28e2ba356e6107d0d0293d146f.
  • Core regression checks for this PR change set are passing (including check).

Current blocker:

  • secrets still fails on appcast.xml:364 during full detect-secrets fallback.
  • This appears to be an upstream baseline issue (same failure pattern is present on recent main CI runs), not specific to this PR diff.

I can proceed with a baseline-focused follow-up patch if maintainers prefer unblocking this PR directly from here.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a56c540ad

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot.ts Outdated
Comment thread extensions/feishu/src/bot.ts Outdated
@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from 5e74e1e to 8506dda Compare March 8, 2026 07:22
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8506ddacdb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot.ts Outdated
@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from 8506dda to 65422d2 Compare March 11, 2026 03:05
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65422d227a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/config/sessions/group.ts
@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from 65422d2 to d3d08ba Compare March 11, 2026 04:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4779acdd0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot.ts Outdated
@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from e4779ac to 9dd06ad Compare March 17, 2026 15:00
@futuremind2026
Copy link
Copy Markdown
Contributor Author

Refreshed this PR onto current main and reduced it to the remaining Feishu behavior changes that are still missing upstream. Duplicate combined draft #48898 was closed; this PR remains the canonical upstream Feishu thread.

@MaGonglei
Copy link
Copy Markdown

Status update after refresh onto current main:

  • This PR was rebuilt on top of current openclaw/main and now only keeps the remaining Feishu runtime behavior that is not in upstream yet.
  • Older config-schema/type-layer churn from the previous branch version was intentionally dropped because current upstream main already covers that part.
  • The duplicate combined draft PR was closed instead of maintaining overlapping review threads.

Current CI note:

  • The failing Windows shards are hitting the same unrelated failures seen on another independent refreshed PR in this maintenance batch.
  • The current failures are in src/plugins/bundle-mcp.test.ts, src/plugin-sdk/index.test.ts, src/memory/embeddings-gemini.test.ts, src/logging/logger.browser-import.test.ts, and src/hooks/plugin-hooks.test.ts.
  • Those files are outside this PR's diff.

I am keeping this PR open because the remaining Feishu diff is still real and not covered by upstream yet.

@MaGonglei
Copy link
Copy Markdown

Addressed the remaining lookup-compat concern in 79dae3206b. The refreshed branch now restores the original opt-out semantics by gating both DM display-name lookup and group-name lookup behind
esolveSenderNames again, so existing deployments with
esolveSenderNames: false do not start making new Feishu lookup calls. A regression test was added in extensions/feishu/src/bot.test.ts to cover both the DM and group paths.

@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from 79dae32 to 5ee8ac6 Compare March 19, 2026 02:20
@futuremind2026
Copy link
Copy Markdown
Contributor Author

Refreshed this PR onto current main and force-pushed the branch at 5ee8ac60fd.

This refresh ports the remaining Feishu behavior onto the current upstream sender-name split instead of keeping the older inline implementation:

  • restore DM display-name fallback via chat-members lookup
  • preserve the existing resolveSenderNames: false opt-out semantics for both DM and group lookups
  • keep group session labels human-readable instead of falling back to raw or sluggified ids
  • restore topic/thread labels for topic-scoped Feishu sessions
  • keep sender name resolution working when the inbound event has user_id but thread history still uses open_id

Validation rerun on the refreshed branch:

  • pnpm exec vitest run --config vitest.extensions.config.ts extensions/feishu/src/bot.test.ts
  • pnpm exec vitest run src/config/sessions.test.ts
  • pnpm check

CI has been re-triggered after the force-push.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 846684478c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot-sender-name.ts Outdated
@futuremind2026
Copy link
Copy Markdown
Contributor Author

Addressed one more multi-account edge here.

The sender/direct-member display-name cache is now scoped by �ccount.accountId, so the same open_id / user_id no longer leaks names across different Feishu accounts.

Pushed in 846684478c8ab925ead1d836f5767f2e0690cb22.

Added regression coverage in extensions/feishu/src/bot-sender-name.test.ts and verified with:

  • pnpm exec vitest run --config vitest.extensions.config.ts extensions/feishu/src/bot-sender-name.test.ts

@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from 8466844 to 9d30caa Compare March 23, 2026 22:06
@futuremind2026
Copy link
Copy Markdown
Contributor Author

Refreshed this branch onto the latest origin/main and kept the verified Feishu fixes in place.

Additional follow-up in this refresh:

  • normalized topic thread labels so they no longer emit literal ? placeholders
  • switched the group/topic separator to /
  • switched truncated topic/thread-id fallbacks to ...
  • added an assertion that the finalized ThreadLabel is now oc-group / Role-Task-Routing and does not contain ?

Scoped verification completed:

  • pnpm exec vitest run --config vitest.extensions.config.ts extensions/feishu/src/bot.test.ts extensions/feishu/src/bot-sender-name.test.ts
  • pnpm exec vitest run src/config/sessions.test.ts
  • pnpm build

pnpm check still hits the current unrelated origin/main lint failure in src/infra/exec-approvals-allow-always.test.ts, so I did not expand this PR to fix that separate mainline issue.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10e9622c2c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/feishu/src/bot.ts Outdated
@futuremind2026 futuremind2026 force-pushed the pr/feishu-dm-display-chatmembers-20260307-01 branch from 8f3682d to b4ec285 Compare March 27, 2026 17:25
@openclaw-barnacle
Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 22, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented Apr 26, 2026

Codex automated review: keeping this open.

Keep #38958 open. Current main at 406ae72 still lacks the PR's remaining Feishu runtime behavior: DM display-name fallback through chatMembers, resolved human-readable group labels, and root/topic-derived thread labels. The provided PR discussion also shows #38378 and #48898 were closed unmerged in favor of this thread, while #51032 only overlaps the group-label subset and does not supersede the DM/topic work.

Best possible solution:

Keep #38958 open for maintainer review, or land an equivalent focused Feishu implementation on main: add DM chatMembers display-name fallback with contact fallback and permission notices, scope sender/direct/group caches by account and relevant chat/sender ids, resolve group names after admission/dedup checks while preserving resolveSenderNames opt-out semantics, preserve human-readable Feishu group labels in session display names, surface root/topic labels only for topic-scoped sessions, and keep regression coverage for cache scoping plus user_id/open_id matching.

What I checked:

Remaining risk / open question:

Codex Review notes: model gpt-5.5, reasoning high; reviewed against 406ae72fd278.

@vincentkoc
Copy link
Copy Markdown
Member

ProjectClownfish could not safely update this branch, so it opened a narrow replacement PR instead.

Replacement PR: #73399
Source PR: #38958
Contributor credit is preserved in the replacement PR body and changelog plan.

@vincentkoc vincentkoc closed this Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants