Skip to content

fix(feishu): return subagent thread delivery origin#83190

Merged
clawsweeper[bot] merged 2 commits into
openclaw:mainfrom
100menotu001:codex/threadbind-delivery-origin-contract
May 17, 2026
Merged

fix(feishu): return subagent thread delivery origin#83190
clawsweeper[bot] merged 2 commits into
openclaw:mainfrom
100menotu001:codex/threadbind-delivery-origin-contract

Conversation

@100menotu001
Copy link
Copy Markdown
Contributor

@100menotu001 100menotu001 commented May 17, 2026

Summary

  • return the Feishu/Lark bound conversation delivery origin from subagent_spawning after a child session bind succeeds
  • extend Feishu hook coverage for DM, topic, and sender-scoped topic thread-bound subagent spawns

Closes #83189.
Complements #83172 / #83170 by applying the same delivery-origin contract to Feishu/Lark.

Why

The generic sessions_spawn(thread=true, mode="session") path can only deliver the initial child run directly to the bound child conversation when the channel hook returns a routable deliveryOrigin. Feishu already had the bound conversation data but returned only threadBindingReady=true.

Real Behavior Proof

  • Behavior or issue addressed: Feishu/Lark subagent_spawning now returns the bound conversation deliveryOrigin after a successful thread-bound child session bind, so the generic spawn path has a routable initial child delivery target.
  • Real environment tested: Local OpenClaw source checkout on macOS using the real Feishu hook and thread binding manager modules from this branch; no mocked hook result was injected.
  • Exact steps or command run after this patch: Ran a direct Node/tsx proof command that created a Feishu thread binding manager, invoked handleFeishuSubagentSpawning, and printed the returned hook result for a topic conversation.
  • Evidence after fix: Terminal output from the real hook path:
{
  "status": "ok",
  "threadBindingReady": true,
  "deliveryOrigin": {
    "channel": "feishu",
    "accountId": "work",
    "to": "chat:oc_group_chat",
    "threadId": "om_topic_root"
  }
}
  • Observed result after fix: The Feishu hook result includes deliveryOrigin.channel="feishu", deliveryOrigin.to="chat:oc_group_chat", and deliveryOrigin.threadId="om_topic_root" immediately after binding succeeds. Before this patch the same code path returned only { status: "ok", threadBindingReady: true }.
  • What was not tested: Live Feishu network delivery with real Feishu credentials was not tested in this local environment; this PR is limited to the in-process hook return contract that the generic sessions_spawn delivery path consumes.

Verification

  • ./node_modules/.bin/vitest run extensions/feishu/src/subagent-hooks.test.ts
    • Test Files 1 passed (1)
    • Tests 11 passed (11)
  • ./node_modules/.bin/oxfmt --check --threads=1 extensions/feishu/src/subagent-hooks.ts extensions/feishu/src/subagent-hooks.test.ts
  • git diff --check HEAD~1..HEAD

Risk

Low. The change is limited to the Feishu/Lark subagent hook result and uses the same delivery-origin resolver already used by completion delivery.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 17, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 17, 2026

Codex review: passed.

Workflow note: Future ClawSweeper reviews update this same comment in place.

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 maintainer comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors can comment @clawsweeper re-review or @clawsweeper re-run on their own 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.

Summary
The PR returns a Feishu/Lark deliveryOrigin from subagent_spawning after successful thread-bound session binding, adds DM/topic/sender-scoped topic hook assertions, and adds a changelog entry.

Reproducibility: yes. by source inspection. Current main's Feishu subagent_spawning hook binds the child conversation but returns no deliveryOrigin, while the generic session-spawn path only directly routes the initial child run when result.deliveryOrigin is present.

Real behavior proof
Sufficient (terminal): The PR body includes copied terminal output from an after-patch run through the real Feishu hook and thread-binding modules showing the new deliveryOrigin result.

Next step before merge
No repair lane is needed; this automerge-opted PR already contains the focused fix and has no actionable review finding.

Security
Cleared: The diff only changes Feishu hook result shaping, tests, and changelog text; it adds no dependencies, permissions, workflow changes, secrets handling, or new network calls.

Review details

Best possible solution:

Land this narrow Feishu plugin hook and regression-test change after exact-head checks, without changing generic spawn routing or adding configuration.

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

Yes, by source inspection. Current main's Feishu subagent_spawning hook binds the child conversation but returns no deliveryOrigin, while the generic session-spawn path only directly routes the initial child run when result.deliveryOrigin is present.

Is this the best way to solve the issue?

Yes. Reusing the existing Feishu delivery-origin resolver immediately after a successful bind is the narrowest maintainable fix and keeps the generic spawn contract unchanged.

What I checked:

  • Current Feishu spawning gap: On current main, handleFeishuSubagentSpawning binds the Feishu child conversation and returns status ok with threadBindingReady, but no deliveryOrigin. (extensions/feishu/src/subagent-hooks.ts:347, 59b85d4eb979)
  • Generic spawn contract: The generic session-spawn path normalizes result.deliveryOrigin from subagent_spawning and only carries a routable child delivery target when the hook returns it. (src/agents/subagent-spawn.ts:675, 59b85d4eb979)
  • Hook contract supports deliveryOrigin: PluginHookSubagentSpawningResult already allows deliveryOrigin, and the hook merge logic preserves the first returned deliveryOrigin. (src/plugins/hook-types.ts:587, 59b85d4eb979)
  • PR implementation: The PR extends the Feishu spawning result type and returns resolveFeishuDeliveryOrigin from the successful bind result using the binding's conversation and delivery metadata. (extensions/feishu/src/subagent-hooks.ts:356, 44a6200a915c)
  • PR regression coverage: The PR updates Feishu hook tests to assert deliveryOrigin for DM, topic, and sender-scoped topic thread-bound subagent spawns. (extensions/feishu/src/subagent-hooks.test.ts:57, 44a6200a915c)
  • Real behavior proof supplied: The PR body includes after-patch terminal output from a direct Node/tsx run through the real Feishu hook and thread-binding manager modules showing status ok, threadBindingReady true, and a Feishu deliveryOrigin. (44a6200a915c)

Likely related people:

  • Ayaan Zaidi: Git blame and -S history show commit 30263f6 introduced the current Feishu subagent hook, delivery-origin resolver, thread-binding manager, plugin hook merge contract, and generic subagent spawn path involved here. (role: introduced behavior / adjacent owner; confidence: high; commits: 30263f6d35b1; files: extensions/feishu/src/subagent-hooks.ts, extensions/feishu/src/thread-bindings.ts, src/agents/subagent-spawn.ts)

Remaining risk / open question:

  • Live Feishu network delivery with real credentials was not independently exercised in this read-only review; confidence rests on the hook contract, source trace, targeted tests, and supplied terminal proof.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 59b85d4eb979.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 17, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. P2 Normal backlog priority with limited blast radius. impact:message-loss Channel message delivery can be lost, duplicated, or misrouted. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. labels May 17, 2026
@Takhoffman
Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 17, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 17, 2026

🦞🔧
ClawSweeper applied a repair to this PR branch.

Repair: kept the fix on this contributor branch instead of opening a replacement PR.
Validation: pnpm check:changed; pnpm lint; pnpm check:test-types
Updated head: 44a6200a915c
Run: https://github.com/openclaw/clawsweeper/actions/runs/25996998743

Current state: exact-head review queued immediately; GitHub checks and the review verdict gate final merge.

Automerge progress:

  • 2026-05-17 16:53:38 UTC review queued 4dfff1708d14 (queued)
  • 2026-05-17 17:06:49 UTC review queued 44a6200a915c (after repair)

@clawsweeper clawsweeper Bot force-pushed the codex/threadbind-delivery-origin-contract branch from 4dfff17 to 44a6200 Compare May 17, 2026 17:06
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 17, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 17, 2026
@clawsweeper clawsweeper Bot merged commit 7c41695 into openclaw:main May 17, 2026
115 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge impact:message-loss Channel message delivery can be lost, duplicated, or misrouted. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Feishu subagent thread binding omits delivery origin for initial child run

2 participants