Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(slack): address codex follow-up review

cyh77bcaf2a9e66
diff --git a/modules/im/slack.py b/modules/im/slack.py
index 283fc6811..716c82e76 100644
--- a/modules/im/slack.py
+++ b/modules/im/slack.py
@@ -278,7 +278,9 @@ class SlackBot(BaseIMClient):
context.user_id,
)
kwargs["channel"] = recovered_channel_id
+ kwargs.pop("thread_ts", None)
context.channel_id = recovered_channel_id
+ context.thread_id = None
return await self.web_client.chat_postMessage(**kwargs)
async def send_dm(self, user_id: str, text: str, **kwargs) -> Optional[str]:
diff --git a/tests/test_slack_dm_mentions.py b/tests/test_slack_dm_mentions.py
index d297ec34f..6ee89a4a5 100644
--- a/tests/test_slack_dm_mentions.py
+++ b/tests/test_slack_dm_mentions.py
@@ -119,6 +119,7 @@ class SlackDmMentionTests(unittest.IsolatedAsyncioTestCase):
async def test_send_message_recovers_dm_channel_after_channel_not_found(self):
slack = SlackBot(SlackConfig(bot_token="xoxb-test"))
sent_channels = []
+ sent_thread_ts = []
class _WebClient:
def __init__(self):
@@ -126,6 +127,7 @@ class SlackDmMentionTests(unittest.IsolatedAsyncioTestCase):
async def chat_postMessage(self, **kwargs):
sent_channels.append(kwargs["channel"])
+ sent_thread_ts.append(kwargs.get("thread_ts"))
if self.fail_once:
self.fail_once = False
raise sys.modules["slack_sdk.errors"].SlackApiError(
@@ -149,11 +151,14 @@ class SlackDmMentionTests(unittest.IsolatedAsyncioTestCase):
self.assertEqual(message_ts, "1710000000.000001")
self.assertEqual(sent_channels, ["D123", "D999"])
+ self.assertEqual(sent_thread_ts, ["1710000000.000100", None])
self.assertEqual(context.channel_id, "D999")
+ self.assertIsNone(context.thread_id)
async def test_send_message_with_buttons_recovers_dm_channel_after_channel_not_found(self):
slack = SlackBot(SlackConfig(bot_token="xoxb-test"))
sent_channels = []
+ sent_thread_ts = []
class _WebClient:
def __init__(self):
@@ -161,6 +166,7 @@ class SlackDmMentionTests(unittest.IsolatedAsyncioTestCase):
async def chat_postMessage(self, **kwargs):
sent_channels.append(kwargs["channel"])
+ sent_thread_ts.append(kwargs.get("thread_ts"))
if self.fail_once:
self.fail_once = False
raise sys.modules["slack_sdk.errors"].SlackApiError(
@@ -191,7 +197,9 @@ class SlackDmMentionTests(unittest.IsolatedAsyncioTestCase):
self.assertEqual(message_ts, "1710000000.000002")
self.assertEqual(sent_channels, ["D123", "D999"])
+ self.assertEqual(sent_thread_ts, ["1710000000.000100", None])
self.assertEqual(context.channel_id, "D999")
+ self.assertIsNone(context.thread_id)
async def test_get_user_info_prefers_normalized_profile_names(self):
slack = SlackBot(SlackConfig(bot_token="xoxb-test"))
diff --git a/tests/test_upgrade_flow.py b/tests/test_upgrade_flow.py
index 9f6875071..0f95e429b 100644
--- a/tests/test_upgrade_flow.py
+++ b/tests/test_upgrade_flow.py
@@ -226,7 +226,21 @@ def test_delayed_restart_helper_prefers_stable_launcher_over_sys_executable(monk
monkeypatch.setattr(api.shutil, "which", lambda binary: f"/usr/bin/{binary}" if binary == "python3" else None)
monkeypatch.setattr(api.sys, "executable", "/volatile/.venv/bin/python", raising=False)
- assert api._delayed_restart_helper_command() == ["/usr/bin/python3"]
+ monkeypatch.setattr(api.os.path, "exists", lambda path: path == "/volatile/.venv/bin/python")
+ monkeypatch.setattr(api.os, "access", lambda path, mode: path == "/volatile/.venv/bin/python")
+
+ assert api._delayed_restart_helper_command() == ["/volatile/.venv/bin/python"]
+
+
+def test_delayed_restart_helper_skips_missing_sys_executable_on_windows(monkeypatch):
+ monkeypatch.setattr(api.os, "name", "nt", raising=False)
+ monkeypatch.setattr(api.sys, "executable", "C:\\missing\\python.exe", raising=False)
+ monkeypatch.setattr(api.os.path, "isabs", lambda path: path.startswith("C:\\"))
+ monkeypatch.setattr(api.os.path, "exists", lambda path: False)
+ monkeypatch.setattr(api.os, "access", lambda path, mode: False)
+ monkeypatch.setattr(api.shutil, "which", lambda binary: "C:\\Python311\\python.exe" if binary == "python" else None)
+
+ assert api._delayed_restart_helper_command() == ["C:\\Python311\\python.exe"]
def test_cmd_upgrade_uses_upgrade_plan_env(monkeypatch):
diff --git a/vibe/api.py b/vibe/api.py
index 07ae74af4..598be5690 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -45,16 +45,16 @@ _OPENCODE_OPTIONS_TTL_SECONDS = 30.0
def _delayed_restart_helper_command() -> list[str]:
candidates: list[list[str]] = []
+ current = sys.executable
+
+ if current and os.path.isabs(current) and os.path.exists(current) and os.access(current, os.X_OK):
+ candidates.append([current])
if os.name == "nt":
candidates.extend((["py", "-3"], ["python"], ["python3"]))
else:
candidates.extend((["python3"], ["python"]))
- current = sys.executable
- if current:
- candidates.append([current])
-
for candidate in candidates:
binary = candidate[0]
if os.path.isabs(binary):