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(codex): scope image prompt to codex

cyh00594240b5e0
diff --git a/core/reply_enhancer.py b/core/reply_enhancer.py
index 275a7b7cf..a690f7728 100644
--- a/core/reply_enhancer.py
+++ b/core/reply_enhancer.py
@@ -208,9 +208,6 @@ Vibe Remote will automatically send the file as an attachment.
### Image syntax
If you want it sent as an image attachment rather than a regular file, use Markdown image syntax:
Example: ![Page screenshot](file:///tmp/screenshot.jpg)
-
-If you generate an image with Codex, include it in the final reply with Markdown image syntax:
-`![generated image](file:///absolute/path/to/image.png)`
"""
_QUICK_REPLIES_PROMPT = """\
diff --git a/modules/agents/codex/agent.py b/modules/agents/codex/agent.py
index 0dc945aba..2f30de4d7 100644
--- a/modules/agents/codex/agent.py
+++ b/modules/agents/codex/agent.py
@@ -17,6 +17,11 @@ from modules.agents.codex.turn_state import CodexTurnRegistry
logger = logging.getLogger(__name__)
+_CODEX_GENERATED_IMAGE_PROMPT = (
+ "If you generate an image with Codex, include it in the final reply with Markdown image syntax: "
+ "`![generated image](file:///absolute/path/to/image.png)`"
+)
+
class CodexAgent(BaseAgent):
"""Codex CLI integration via persistent ``codex app-server`` subprocess.
@@ -438,6 +443,7 @@ class CodexAgent(BaseAgent):
fallback_platform=platform,
)
)
+ instruction_parts.append(_CODEX_GENERATED_IMAGE_PROMPT)
if instruction_parts:
params["developerInstructions"] = "\n\n".join(part for part in instruction_parts if part)
diff --git a/tests/test_codex_agent.py b/tests/test_codex_agent.py
index c2b19f97e..3804b575c 100644
--- a/tests/test_codex_agent.py
+++ b/tests/test_codex_agent.py
@@ -601,7 +601,13 @@ class CodexAgentPayloadTests(unittest.IsolatedAsyncioTestCase):
agent.sessions = SimpleNamespace(set_agent_session_mapping=Mock())
request = SimpleNamespace(
working_path="/tmp/work",
- context=SimpleNamespace(platform="slack", platform_specific={}),
+ context=SimpleNamespace(
+ platform="slack",
+ platform_specific={},
+ user_id="U1",
+ channel_id="C1",
+ thread_id=None,
+ ),
base_session_id="session-1",
session_key="channel-1",
subagent_name=None,
@@ -632,7 +638,13 @@ class CodexAgentPayloadTests(unittest.IsolatedAsyncioTestCase):
agent.sessions = SimpleNamespace(set_agent_session_mapping=Mock())
request = SimpleNamespace(
working_path="/tmp/work",
- context=SimpleNamespace(platform="slack", platform_specific={}),
+ context=SimpleNamespace(
+ platform="slack",
+ platform_specific={},
+ user_id="U1",
+ channel_id="C1",
+ thread_id=None,
+ ),
base_session_id="session-1",
session_key="channel-1",
subagent_name="reviewer",
@@ -663,6 +675,36 @@ class CodexAgentPayloadTests(unittest.IsolatedAsyncioTestCase):
},
)
+ async def test_start_thread_adds_codex_generated_image_prompt_only_when_reply_enhancements_enabled(self):
+ agent = object.__new__(CodexAgent)
+ agent.controller = SimpleNamespace(config=SimpleNamespace(platform="slack", reply_enhancements=True))
+ agent.settings_manager = SimpleNamespace(get_channel_settings=lambda session_key: None)
+ agent.codex_config = SimpleNamespace(default_model=None)
+ agent._session_mgr = SimpleNamespace(set_thread_id=Mock())
+ agent.sessions = SimpleNamespace(set_agent_session_mapping=Mock())
+ request = SimpleNamespace(
+ working_path="/tmp/work",
+ context=SimpleNamespace(
+ platform="slack",
+ platform_specific={},
+ user_id="U1",
+ channel_id="C1",
+ thread_id=None,
+ ),
+ base_session_id="session-1",
+ session_key="channel-1",
+ subagent_name=None,
+ subagent_model=None,
+ subagent_reasoning_effort=None,
+ )
+ transport = SimpleNamespace(send_request=AsyncMock(return_value={"thread": {"id": "thread-1"}}))
+
+ await agent._start_thread(transport, request)
+
+ params = transport.send_request.await_args.args[1]
+ self.assertIn("If you generate an image with Codex", params["developerInstructions"])
+ self.assertIn("![generated image](file:///absolute/path/to/image.png)", params["developerInstructions"])
+
async def test_start_turn_uses_sandbox_policy_object(self):
agent = object.__new__(CodexAgent)
agent.settings_manager = SimpleNamespace(get_channel_settings=lambda session_key: None)
diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.py
index 3755c3319..4dc38dea8 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -84,8 +84,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
)
self.assertIn("## 1. Send files", prompt)
self.assertIn("Vibe Remote provides optional capabilities:", prompt)
- self.assertIn("If you generate an image with Codex", prompt)
- self.assertIn("![generated image](file:///absolute/path/to/image.png)", prompt)
+ self.assertNotIn("If you generate an image with Codex", prompt)
self.assertNotIn("## 2. Quick-reply buttons", prompt)
self.assertIn("## 4. User Context and Preferences", prompt)
self.assertIn("`/tmp/user_preferences.md`", prompt)