Skip to content

fix: treat feishu bind conversation ids as peers - #95913

Closed
arkyu2077 wants to merge 1 commit into
openclaw:mainfrom
arkyu2077:fix/issue-95734
Closed

arkyu2077 wants to merge 1 commit into
openclaw:mainfrom
arkyu2077:fix/issue-95734

Conversation

@arkyu2077

Copy link
Copy Markdown
Contributor

Summary

Make openclaw agents add --bind ... generate routeable Feishu conversation bindings when the bind target is a chat or user conversation id instead of a channel account name.

Changes

  • split --bind specs on the first channel separator so Feishu topic ids keep their full :topic: suffix
  • map Feishu conversation-like ids such as oc_..., ou_..., on_..., chat:..., and user:... into match.peer bindings
  • add integration coverage for group chat and topic conversation ids

Testing

  • pnpm test -- --run src/commands/agents.bind.feishu.integration.test.ts src/commands/agents.bind.matrix.integration.test.ts

Fixes #95734

@clawsweeper

clawsweeper Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 30, 2026, 11:06 PM ET / 03:06 UTC.

Summary
The PR changes agent bind parsing so Feishu-looking conversation IDs after --bind feishu: become match.peer bindings and adds Feishu parser coverage.

PR surface: Source +39, Tests +59. Total +98 across 2 files.

Reproducibility: yes. source-level: current parseBindingSpecs writes feishu:oc_test as match.accountId, while Feishu inbound sends peer and the router prioritizes peer bindings. I did not run a live Feishu route in this read-only review.

Review metrics: 2 noteworthy metrics.

  • Feishu bind reinterpretation: 9 prefixes or aliases parsed as peer IDs. These values change the persisted binding shape for documented --bind <channel>:<account> inputs and need compatibility review.
  • Parser validation change: 1 existing extra-colon rejection removed. Removing this guard affects all channel bind specs, not only Feishu topic conversation IDs.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #95734
Summary: This PR is one unmerged candidate fix for the canonical Feishu agents add --bind accountId-vs-peer routing bug; the issue remains open and no candidate has merged.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🧂 unranked krab
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal output or Feishu route logs showing the generated binding and route behavior after the fix.
  • Preserve documented account-bind semantics and the existing extra-colon validation unless maintainers choose a new grammar.
  • Rebase and resolve the conflicting branch after the bind-contract direction is settled.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists parser tests but no redacted after-fix CLI output, Feishu route logs, recording, or linked artifact showing the real setup behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Existing Feishu account-scoped binds whose account names look like Feishu IDs or aliases can silently become peer/default-account bindings, changing message routing after upgrade.
  • [P1] The PR removes the existing extra-colon validation for every channel, so unsupported values like matrix:work:extra stop erroring and can become ambiguous account IDs.
  • [P1] Core now embeds Feishu-specific ID prefixes even though Feishu conversation parsing already lives in the Feishu plugin, increasing drift risk as Feishu topic/sender forms evolve.
  • [P1] The branch is currently conflicting and has no redacted after-fix CLI output, Feishu route logs, recording, or linked artifact from a real setup.

Maintainer options:

  1. Fix the bind contract before merge (recommended)
    Preserve documented account-bind semantics and unsupported extra-colon rejection unless maintainers explicitly adopt a new peer grammar with an account escape, docs, and tests.
  2. Choose a sibling candidate after syntax review
    Maintainers can select another open candidate if it better matches the desired Feishu bind grammar, then close the remaining PRs only after a fix merges or becomes clearly viable.
  3. Accept prefix inference intentionally
    Maintainers may accept Feishu prefix inference only with upgrade notes and proof that existing account-scoped setups remain expressible and do not misroute messages.

Next step before merge

  • [P1] Manual review is needed because the remaining blocker is a compatibility-sensitive bind grammar and ownership choice across multiple open candidate PRs, not a narrow safe automation repair.

Security
Cleared: The diff changes TypeScript command parsing and tests only; it does not touch dependencies, workflows, secrets, permissions, downloads, or package resolution.

Review findings

  • [P1] Preserve account-scoped Feishu binds — src/commands/agents.bindings.ts:364-372
  • [P2] Preserve extra-colon validation outside the chosen peer syntax — src/commands/agents.bindings.ts:349-351
  • [P2] Move Feishu ID detection out of the core parser — src/commands/agents.bindings.ts:250-252
Review details

Best possible solution:

Land one compatibility-safe bind contract, preferably plugin-owned Feishu conversation recognition or explicit peer syntax with an account escape, plus docs, focused tests, and redacted real CLI or route proof.

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

Yes, source-level: current parseBindingSpecs writes feishu:oc_test as match.accountId, while Feishu inbound sends peer and the router prioritizes peer bindings. I did not run a live Feishu route in this read-only review.

Is this the best way to solve the issue?

No as submitted: generating a peer-shaped Feishu binding is the right target, but silently reinterpreting account binds and hardcoding Feishu IDs in core is not the safest maintainable fix.

Full review comments:

  • [P1] Preserve account-scoped Feishu binds — src/commands/agents.bindings.ts:364-372
    This detects Feishu-looking values before account resolution and then drops explicitAccountId when a peer is inferred. A configured Feishu account named like oc_prod or ou_work would now become a peer/default-account binding instead of matching that account; keep an explicit peer syntax or account escape before changing documented account selection.
    Confidence: 0.88
  • [P2] Preserve extra-colon validation outside the chosen peer syntax — src/commands/agents.bindings.ts:349-351
    The parser now splits only on the first colon, so the existing matrix:work:extra rejection path becomes an account id of work:extra. This removes the current guard against ambiguous bind specs for every channel, so keep the rejection unless a documented grammar and coverage cover the affected channels.
    Confidence: 0.86
  • [P2] Move Feishu ID detection out of the core parser — src/commands/agents.bindings.ts:250-252
    The core command parser now embeds Feishu-specific prefixes and aliases even though Feishu already owns conversation-id behavior in its plugin code. Route this through a plugin-owned hook or a generic explicit peer grammar to avoid duplicated channel policy.
    Confidence: 0.82

Overall correctness: patch is incorrect
Overall confidence: 0.89

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: The PR targets a bounded Feishu routing bug with a manual config workaround, but compatibility and proof blockers prevent merge.
  • merge-risk: 🚨 compatibility: The diff changes documented bind parsing and generated persisted binding shape for existing account-style inputs.
  • merge-risk: 🚨 message-delivery: Misclassified Feishu account or peer bindings can route inbound messages to the wrong agent or fall back to the default agent.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists parser tests but no redacted after-fix CLI output, Feishu route logs, recording, or linked artifact showing the real setup behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +39, Tests +59. Total +98 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 41 2 +39
Tests 1 59 0 +59
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 100 2 +98

What I checked:

  • Repository policy read: Root AGENTS.md was read fully; its OpenClaw PR review, core/plugin ownership, CLI compatibility, and proof guidance affected this review. (AGENTS.md:1, fa3c9de45965)
  • PR head hardcodes Feishu ID taxonomy in core: The PR adds resolveFeishuConversationBindingPeer to the core command parser with Feishu prefixes and aliases such as ou_, on_, oc_, chat:, and open_id:. (src/commands/agents.bindings.ts:250, 1f649f42c2e8)
  • PR head reclassifies Feishu account-looking bind values: The PR computes feishuPeer before account resolution and then passes undefined as explicitAccountId when a Feishu-looking value is found, so account names with those prefixes can become peer/default-account bindings. (src/commands/agents.bindings.ts:364, 1f649f42c2e8)
  • Current CLI docs define two-segment binds as account selection: Current docs define --bind <channel>:<account> as matching one account and --bind <channel> as default/plugin-resolved account scope, making silent Feishu prefix reinterpretation compatibility-sensitive. Public docs: docs/cli/agents.md. (docs/cli/agents.md:64, fa3c9de45965)
  • Current parser rejects extra colon segments: Current main explicitly rejects extra colon segments to avoid silently changing the requested account; the PR removes that guard for all channels by splitting only on the first colon. (src/commands/agents.bindings.ts:319, fa3c9de45965)
  • Adjacent test expects extra-colon rejection: The existing Matrix integration test expects matrix:work:extra to produce an error, but this PR would parse it as account id work:extra. (src/commands/agents.bind.matrix.integration.test.ts:36, fa3c9de45965)

Likely related people:

  • vincentkoc: Current blame on the parser, docs, and route resolver points to commit cb00045 touching this surface, though it appears to be a broad update rather than original feature ownership. (role: recent broad surface updater; confidence: medium; commits: cb00045afca9; files: src/commands/agents.bindings.ts, src/routing/resolve-route.ts, docs/cli/agents.md)
  • gumadeiras: Git history shows commit 96c7702 introduced account-scoped bind and routing commands, including the current channel:account CLI behavior. (role: introduced adjacent command surface; confidence: high; commits: 96c77025263d; files: src/commands/agents.bindings.ts, src/commands/agents.commands.add.ts, docs/cli/agents.md)
  • Takhoffman: Commit 89e3969 added Feishu ACP/subagent session binding and the Feishu conversation-id helper file that owns topic/sender conversation semantics. (role: adjacent Feishu conversation contributor; confidence: medium; commits: 89e3969d640c; files: extensions/feishu/src/conversation-id.ts, extensions/feishu/src/bot.ts, extensions/feishu/src/thread-bindings.ts)
  • OfflynAI: Commit b554516 added wildcard peer binding support in the route resolver tier this generated config needs to target. (role: adjacent peer-routing contributor; confidence: medium; commits: b554516f215f; files: src/routing/resolve-route.ts, src/routing/resolve-route.test.ts)
  • steipete: Commit dbfa316 introduced multi-agent routing and multi-account providers, the broader routing model involved in this bind contract. (role: introduced broader routing structure; confidence: medium; commits: dbfa316d19d5; files: src/routing/resolve-route.ts, src/config/types.agents.ts, docs/concepts/multi-agent.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 23, 2026
@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 Jul 16, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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

Labels

commands Command implementations merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: agents add --bind generates accountId format, but router only matches peer format

1 participant