Skip to content

fix(agent): avoid using trigger requestId as platform message id#907

Merged
dingyi222666 merged 1 commit into
ChatLunaLab:v1-devfrom
vioaki:fix-trigger-virtual-message-id
Jun 7, 2026
Merged

fix(agent): avoid using trigger requestId as platform message id#907
dingyi222666 merged 1 commit into
ChatLunaLab:v1-devfrom
vioaki:fix-trigger-virtual-message-id

Conversation

@vioaki

@vioaki vioaki commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Avoid exposing Agent Trigger's internal requestId as a platform message id in virtual sessions.

Previously, virtual trigger sessions set event.message.id from requestId, which could be mapped to session.messageId and later treated by adapters as a real platform message reference.

Changes

  • Stop setting event.message.id in buildVirtualSession().
  • Stop passing requestId into virtual session construction.
  • Update trigger session tests.

Verification

  • mocha packages/extension-agent/tests/trigger_session.spec.ts
  • tsc -p packages/extension-agent/tsconfig.json --noEmit
  • corepack yarn fast-build extension-agent

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 69fcb4e6-39ab-4203-b430-2e3420faa507

📥 Commits

Reviewing files that changed from the base of the PR and between 7517510 and 9ce5b98.

📒 Files selected for processing (3)
  • packages/extension-agent/src/trigger/executor.ts
  • packages/extension-agent/src/trigger/session.ts
  • packages/extension-agent/tests/trigger_session.spec.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/extension-agent/src/trigger/executor.ts
  • packages/extension-agent/src/trigger/session.ts
  • packages/extension-agent/tests/trigger_session.spec.ts

Walkthrough

收窄 buildVirtualSession 的 action 参数以移除 requestId 字段;相应地更新了调用点(executor)和三个测试用例,事件的 message 不再包含 id 字段。

变更

移除虚拟会话中的 requestId 字段

层级 / 文件 摘要
函数契约与实现更新
packages/extension-agent/src/trigger/session.ts
buildVirtualSession 的参数类型 actionPick<WakeupAction, 'message' | 'messageName' | 'requestId'> 收窄为 Pick<WakeupAction, 'message' | 'messageName'>。构建的事件消息不再使用 action.requestId 赋值 message.id
调用点更新
packages/extension-agent/src/trigger/executor.ts
_resolveTarget 方法的两处 buildVirtualSession 调用(处理 bindingKey 与目标路由)以及 _dispatchReply 方法的用户分支均移除了 requestId 字段的传递。
测试用例更新
packages/extension-agent/tests/trigger_session.spec.ts
三个测试用例的 buildVirtualSession 调用参数移除了 requestId。首个测试用例的预期消息结构移除了 id 字段,并将对 message.id 的断言改为验证 message 不包含 id 属性。

预期代码审查工作量

🎯 3 (Moderate) | ⏱️ ~20 minutes

诗歌

🐰 我造了一场虚拟会话,
requestId 轻轻走开,
消息只带内容名,
签名更简更安稳,
测试点头说没问题。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题「fix(agent): avoid using trigger requestId as platform message id」准确概括了改动的主要目的——防止Agent Trigger的内部requestId暴露为平台消息id。
Description check ✅ Passed 描述详细解释了问题背景、具体改动内容和验证步骤,与文件改动内容完全对应。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request removes the 'requestId' property from virtual sessions across the 'extension-agent' package. Specifically, it updates 'ChatLunaAgentTriggerExecutor' to stop passing 'requestId', modifies 'buildVirtualSession' to exclude 'requestId' from its parameters and output, and updates the corresponding unit tests to reflect these changes. There are no review comments, so I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@dingyi222666

Copy link
Copy Markdown
Member

Merging is blocked
Commits must have verified signatures.。。。

让 codex 帮你弄弄签名去

@vioaki vioaki force-pushed the fix-trigger-virtual-message-id branch from 7517510 to 9ce5b98 Compare June 6, 2026 20:19
@dingyi222666 dingyi222666 merged commit 690493b into ChatLunaLab:v1-dev Jun 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants