Repository navigation
Conversation
…renders live The isControlUiVisible gate in the agent-event handler prevented chat delta/final broadcasts for runs originating from non-webchat channels (Telegram, Discord, etc.). This meant TUI clients viewing a Telegram session would never receive live assistant-response events — messages only appeared after a manual history reload. Remove the isControlUiVisible condition from the chat-event emission path. The TUI already filters by session key, so cross-session noise is not a concern. External-channel runs now broadcast chat events identically to webchat-originated runs. Fixes #41937 Co-Authored-By: Claude Opus 4.6 <[email protected]>
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Hidden (non-control-UI-visible) agent runs now broadcast chat/session events to all subscribers
DescriptionIn
With the new condition, runs marked not control-UI-visible will still:
This can cause privacy/information disclosure because the codebase does not show any per-session authorization on the broadcast path, and node session subscription ( Vulnerable code (post-change): if (sessionKey) {
if (!isToolEvent || toolVerbose !== "off") {
nodeSendToSession(sessionKey, "agent", isToolEvent ? toolPayload : agentPayload);
}
if (!isAborted && evt.stream === "assistant" && typeof evt.data?.text === "string") {
emitChatDelta(sessionKey, clientRunId, evt.runId, evt.seq, evt.data.text, evt.data.delta);
}
// ... emits chat final/error as well
}Impact depends on deployment, but in a multi-session/multi-device environment it can expose external-channel conversations (and potentially sensitive tool metadata) to connected UI clients or any node subscribed to the session key. RecommendationReintroduce explicit visibility/authorization gating for external-channel runs, or replace it with a more precise allowlist:
Example (conceptual): const allowSessionFanout = isControlUiVisible || isTrustedTuiSubscriber(sessionKey);
if (allowSessionFanout && sessionKey) {
// existing nodeSendToSession + emitChatDelta/final logic
}Also consider adding server-side authorization in Analyzed PR: #41964 at commit Last updated on: 2026-03-10T09:15:47Z |
Greptile SummaryThis PR fixes a live-streaming gap in the TUI for external-channel (Telegram, iMessage, etc.) sessions by removing the Key changes:
Confidence Score: 4/5
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded. Current main has not implemented this PR's one-line Best possible solution: Close this PR as superseded by #73402. Review and land #73402, or an equivalent implementation, that subscribes the TUI to What I checked:
So I’m closing this here and keeping the remaining discussion on the canonical linked item. Codex review notes: model gpt-5.5, reasoning high; reviewed against db40ec404a91. |
Summary
Fixes #41937
Inbound Telegram (and other external-channel) messages update the session correctly, but the TUI never renders the assistant response live — it only appears after a manual session/history reload. The root cause is the
isControlUiVisiblegate added in #36030: runs originating from non-webchat channels setisControlUiVisible: false, which suppresseschatevent broadcasts (delta/final) entirely. The TUI relies on these broadcasts to stream assistant responses.Fix: Remove the
isControlUiVisiblecondition from the chat-event emission path increateAgentEventHandler. The TUI already filters events by session key (isSameSessionKey), so there is no risk of cross-session noise. TheisControlUiVisibleflag remains in use for pre-tool-start delta flushing.Changes
src/gateway/server-chat.ts: Changeif (isControlUiVisible && sessionKey)→if (sessionKey)so chat delta/final events are broadcast for all runs that have a resolved session key.src/gateway/server-chat.agent-events.test.ts: Update the test that previously verified suppression to now verify that external-channel runs emit chat events.Test plan
pnpm test -- --run src/gateway/server-chat.agent-events.test.ts— 23/23 passpnpm test -- --run src/tui/tui-event-handlers.test.ts— 17/17 passpnpm test -- --run src/infra/agent-events.test.ts— 4/4 passpnpm tsgo— no type errorspnpm check— lint/format clean