fix(feishu): gate reasoning previews to stream sessions#61271
Conversation
Greptile SummaryThis PR correctly gates Feishu reasoning preview callbacks to sessions with Confidence Score: 5/5Safe to merge; the fix is logically correct and all remaining findings are P2. The core gate ( No files require special attention; the minor efficiency concern in the broadcast observer path of Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/feishu/src/bot.ts
Line: 1115-1119
Comment:
**Unnecessary disk read for observer agents**
`resolveFeishuReasoningPreviewEnabled` is called for every agent in the broadcast loop — including observer agents — but `allowReasoningPreview` is only consumed inside the `if (agentId === activeAgentId)` branch. Each observer agent pays a `skipCache: true` disk read whose result is immediately discarded. Moving the call inside the active-agent branch eliminates these wasted reads.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(feishu): gate reasoning previews to ..." | Re-trigger Greptile |
| const agentSessionKey = buildBroadcastSessionKey(route.sessionKey, route.agentId, agentId); | ||
| const allowReasoningPreview = resolveFeishuReasoningPreviewEnabled({ | ||
| storePath: core.channel.session.resolveStorePath(cfg.session?.store, { agentId }), | ||
| sessionKey: agentSessionKey, | ||
| }); |
There was a problem hiding this comment.
Unnecessary disk read for observer agents
resolveFeishuReasoningPreviewEnabled is called for every agent in the broadcast loop — including observer agents — but allowReasoningPreview is only consumed inside the if (agentId === activeAgentId) branch. Each observer agent pays a skipCache: true disk read whose result is immediately discarded. Moving the call inside the active-agent branch eliminates these wasted reads.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/feishu/src/bot.ts
Line: 1115-1119
Comment:
**Unnecessary disk read for observer agents**
`resolveFeishuReasoningPreviewEnabled` is called for every agent in the broadcast loop — including observer agents — but `allowReasoningPreview` is only consumed inside the `if (agentId === activeAgentId)` branch. Each observer agent pays a `skipCache: true` disk read whose result is immediately discarded. Moving the call inside the active-agent branch eliminates these wasted reads.
How can I resolve this? If you propose a fix, please make it concise.
Summary
stream.reasoning:stream, thread that permission into the reply dispatcher, and add regression coverage plus a changelog entry.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
streaming: trueas permission to exposeonReasoningStream, without checking the session's persisted reasoning mode.reasoningLevel === "stream".Regression Test Plan (if applicable)
extensions/feishu/src/reasoning-preview.test.ts,extensions/feishu/src/reply-dispatcher.test.ts,extensions/feishu/src/bot.test.tsreasoning:stream.User-visible / Behavior Changes
reasoning:stream.Diagram (if applicable)
Security Impact (required)
Yes, explain risk + mitigation:Repro + Verification
Environment
streaming: true; session store entry toggled betweenreasoningLevel: streamandreasoningLevel: onSteps
reasoning:stream.Expected
reasoning:stream.Actual
Evidence
Human Verification (required)
reasoningLevellookup and dispatcher callback gating;git diff --checkafter rebase.pnpm test:serial -- ...for the touched Feishu tests kept hanging in this workspace after startup, so I did not get a clean local Vitest result to claim.Review Conversations
Compatibility / Migration
Risks and Mitigations
reasoning:streamcould stop showing previews if the store lookup path regresses.