fix(restart): preserve channel metadata across /restart so reply lands in thread
cmd_restart only persisted channel + chat_id across the os.execv boundary, so when the new process announced "Restart completed" the OutboundMessage had no Slack thread_ts and the reply fell back to the channel root. Serialize msg.metadata into NANOBOT_RESTART_NOTIFY_METADATA, restore it on the RestartNotice, and forward it to OutboundMessage so the completion message follows the same routing as the original /restart invocation. Made-with: Cursor
This commit is contained in:
@@ -28,7 +28,11 @@ async def cmd_stop(ctx: CommandContext) -> OutboundMessage:
|
||||
async def cmd_restart(ctx: CommandContext) -> OutboundMessage:
|
||||
"""Restart the process in-place via os.execv."""
|
||||
msg = ctx.msg
|
||||
set_restart_notice_to_env(channel=msg.channel, chat_id=msg.chat_id)
|
||||
set_restart_notice_to_env(
|
||||
channel=msg.channel,
|
||||
chat_id=msg.chat_id,
|
||||
metadata=dict(msg.metadata or {}),
|
||||
)
|
||||
|
||||
async def _do_restart():
|
||||
await asyncio.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user