Skip to content

fix(pi-embedded-runner): propagate sender identity to fix Feishu doc create auto-grant#32915

Merged
jalehman merged 7 commits intoopenclaw:mainfrom
cszhouwei:fix/feishu-doc-grant-senderid-propagation
Mar 6, 2026
Merged

fix(pi-embedded-runner): propagate sender identity to fix Feishu doc create auto-grant#32915
jalehman merged 7 commits intoopenclaw:mainfrom
cszhouwei:fix/feishu-doc-grant-senderid-propagation

Conversation

@cszhouwei
Copy link
Copy Markdown
Contributor

@cszhouwei cszhouwei commented Mar 3, 2026

Problem

When running via the embedded runner, sender identity (SenderId/SenderName/etc.) was not propagated from runEmbeddedPiAgent to runEmbeddedAttempt.

This caused plugin tool contexts to miss requesterSenderId. In Feishu specifically, it broke feishu_doc.create auto-grant behavior (returned "trusted requester identity unavailable" and skipped adding edit permission).

Root cause

src/agents/pi-embedded-runner/run.ts dropped the following fields when calling runEmbeddedAttempt({ ... }):

  • senderId
  • senderName
  • senderUsername
  • senderE164

Fix

Propagate the sender identity fields to runEmbeddedAttempt.

Reproduction (before fix)

  1. Configure Feishu channel and ensure feishu_doc is enabled.
  2. In a Feishu DM with the bot, ask it to create a doc using the tool call:
    • feishu_doc{ "action": "create", "title": "Test", "grant_to_requester": true }
  3. Observe the tool result includes:
    • requester_permission_added: false
    • requester_permission_skipped_reason: "trusted requester identity unavailable"

Verification (after fix)

Repeat the steps above and observe:

  • requester_permission_added: true
  • requester_open_id equals the Feishu requester open_id

Files

  • src/agents/pi-embedded-runner/run.ts

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: XS labels Mar 3, 2026
@cszhouwei
Copy link
Copy Markdown
Contributor Author

Notes:\n- This fixes Feishu doc create auto-grant failing with "trusted requester identity unavailable" when the run was triggered from a Feishu message but executed via embedded runner (senderId was dropped in run.ts).\n- Low-risk: only adds missing param propagation already present in RunEmbeddedPiAgentParams + attempt.ts + pi-tools.ts plumbing.\n

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR fixes a bug where four sender identity fields (senderId, senderName, senderUsername, senderE164) were declared in RunEmbeddedPiAgentParams and consumed downstream in runEmbeddedAttempt (passed to createOpenClawCodingTools for plugin tool context), but were never forwarded from runEmbeddedPiAgent to runEmbeddedAttempt.

The root cause was a straightforward omission at the call site; senderIsOwner was already being passed but its sibling identity fields were not.

The fix:

  • Adds four lines at lines 730-733 in run.ts to propagate the missing sender identity fields
  • Fields are placed adjacent to the existing senderIsOwner forwarding
  • Matches the field ordering in the type definition

Why this fix is safe:

  • Type safety is intact — EmbeddedRunAttemptParams inherits all four fields from RunEmbeddedPiAgentParams via EmbeddedRunAttemptBase, so no type changes were required
  • Because the fields are all optional, TypeScript did not surface a compile error when they were missing — the omission silently produced undefined values, which caused downstream plugin tools (e.g., feishu_doc.create) to treat the requester identity as unavailable
  • The fix is contained to a single call site; runEmbeddedAttempt is only invoked in one place in run.ts

Confidence Score: 5/5

  • This PR is safe to merge — it corrects a clear omission with no risk of regression.
  • The change is a four-line addition that restores already-declared, already-consumed fields at a single call site. Type safety is intact, and the behavior change (sender identity now reaches plugin tools) exactly matches the stated fix. No logic is restructured and no new dependencies are introduced.
  • No files require special attention.

Last reviewed commit: 9763c72

@cszhouwei cszhouwei changed the title fix(pi-embedded-runner): propagate sender identity to attempts fix(pi-embedded-runner): propagate sender identity to fix Feishu doc create auto-grant Mar 3, 2026
@jalehman jalehman self-assigned this Mar 6, 2026
@jalehman jalehman force-pushed the fix/feishu-doc-grant-senderid-propagation branch 2 times, most recently from 9b671ad to fa798db Compare March 6, 2026 22:02
@jalehman jalehman force-pushed the fix/feishu-doc-grant-senderid-propagation branch from fa798db to efb2293 Compare March 6, 2026 22:29
@jalehman jalehman merged commit e601bf2 into openclaw:main Mar 6, 2026
26 of 27 checks passed
vincentkoc pushed a commit to BryanTegomoh/openclaw-fork that referenced this pull request Mar 8, 2026
…create auto-grant (openclaw#32915)

Merged via squash.

Prepared head SHA: efb2293
Co-authored-by: cszhouwei <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
Saitop pushed a commit to NomiciAI/openclaw that referenced this pull request Mar 8, 2026
…create auto-grant (openclaw#32915)

Merged via squash.

Prepared head SHA: efb2293
Co-authored-by: cszhouwei <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
jenawant pushed a commit to jenawant/openclaw that referenced this pull request Mar 10, 2026
…create auto-grant (openclaw#32915)

Merged via squash.

Prepared head SHA: efb2293
Co-authored-by: cszhouwei <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
dhoman pushed a commit to dhoman/chrono-claw that referenced this pull request Mar 11, 2026
…create auto-grant (openclaw#32915)

Merged via squash.

Prepared head SHA: efb2293
Co-authored-by: cszhouwei <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
senw-developers pushed a commit to senw-developers/va-openclaw that referenced this pull request Mar 17, 2026
…create auto-grant (openclaw#32915)

Merged via squash.

Prepared head SHA: efb2293
Co-authored-by: cszhouwei <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
V-Gutierrez pushed a commit to V-Gutierrez/openclaw-vendor that referenced this pull request Mar 17, 2026
…create auto-grant (openclaw#32915)

Merged via squash.

Prepared head SHA: efb2293
Co-authored-by: cszhouwei <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants