Skip to content

Commit a5de041

Browse files
committed
fix: restore CLI chat response display after stream_output refactor
The stream_output flag introduced in #170 defaults to False, which bypasses CliChannel.stream_events() and relies on send() for output. Since send() only handled errors, normal responses were silently dropped. - Force stream_output=True for `bub chat` so streaming remains the primary display path. - Store stream_output override as an instance variable instead of mutating the settings object. Made-with: Cursor
1 parent 963df65 commit a5de041

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/bub/builtin/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def chat(
8383

8484
framework = ctx.ensure_object(BubFramework)
8585

86-
manager = ChannelManager(framework, enabled_channels=["cli"])
86+
manager = ChannelManager(framework, enabled_channels=["cli"], stream_output=True)
8787
channel = manager.get_channel("cli")
8888
if channel is None:
8989
typer.echo("CLI channel not found. Please check your hook implementations.")

src/bub/channels/manager.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@ class ChannelSettings(BaseSettings):
3939

4040

4141
class ChannelManager:
42-
def __init__(self, framework: BubFramework, enabled_channels: Collection[str] | None = None) -> None:
42+
def __init__(
43+
self,
44+
framework: BubFramework,
45+
enabled_channels: Collection[str] | None = None,
46+
stream_output: bool | None = None,
47+
) -> None:
4348
self.framework = framework
4449
self._channels: dict[str, Channel] = self.framework.get_channels(self.on_receive)
4550
self._settings = ChannelSettings()
51+
self._stream_output = stream_output if stream_output is not None else self._settings.stream_output
4652
if enabled_channels is not None:
4753
self._enabled_channels = list(enabled_channels)
4854
else:
@@ -139,7 +145,7 @@ async def listen_and_run(self) -> None:
139145
try:
140146
while True:
141147
message = await wait_until_stopped(self._messages.get(), stop_event)
142-
task = asyncio.create_task(self.framework.process_inbound(message, self._settings.stream_output))
148+
task = asyncio.create_task(self.framework.process_inbound(message, self._stream_output))
143149
task.add_done_callback(functools.partial(self._on_task_done, message.session_id))
144150
self._ongoing_tasks.setdefault(message.session_id, set()).add(task)
145151
except asyncio.CancelledError:

0 commit comments

Comments
 (0)