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(auth): tighten opencode credential heuristic

cyh9f459dfc7e3e
diff --git a/core/agent_auth_service.py b/core/agent_auth_service.py
index be126c172..0cbda4b2b 100644
--- a/core/agent_auth_service.py
+++ b/core/agent_auth_service.py
@@ -1108,11 +1108,15 @@ class AgentAuthService:
if URL_RE.search(candidate):
return False
+ alnum_count = sum(ch.isalnum() for ch in candidate)
has_digit = any(ch.isdigit() for ch in candidate)
has_upper = any(ch.isupper() for ch in candidate)
has_lower = any(ch.islower() for ch in candidate)
separator_count = sum(candidate.count(ch) for ch in ("-", "_", ".", ":", "="))
+ if alnum_count < 8:
+ return False
+
if candidate.startswith("sk-"):
return True
diff --git a/tests/test_agent_auth_service.py b/tests/test_agent_auth_service.py
index e8f79ad7b..a60abc2f0 100644
--- a/tests/test_agent_auth_service.py
+++ b/tests/test_agent_auth_service.py
@@ -684,6 +684,33 @@ class AgentAuthServiceTests(unittest.IsolatedAsyncioTestCase):
self.assertFalse(consumed)
service.submit_code.assert_not_awaited()
+ async def test_maybe_consume_setup_reply_ignores_separator_only_opencode_text(self):
+ controller = _StubController()
+ service = AgentAuthService(controller)
+ context = MessageContext(user_id="U1", channel_id="C1")
+ done_task = asyncio.create_task(asyncio.sleep(0))
+ await done_task
+ flow = AgentAuthFlow(
+ flow_id="flow-opencode-separator-ignore",
+ backend="opencode",
+ settings_key="C1",
+ initiator_user_id="U1",
+ context=context,
+ process=SimpleNamespace(returncode=None),
+ reader_task=done_task,
+ waiter_task=done_task,
+ pty_master_fd=11,
+ awaiting_code=True,
+ provider="opencode",
+ )
+ service._flows[flow.flow_key] = flow
+ service.submit_code = AsyncMock()
+
+ consumed = await service.maybe_consume_setup_reply(context, "--------------------")
+
+ self.assertFalse(consumed)
+ service.submit_code.assert_not_awaited()
+
async def test_maybe_consume_setup_reply_ignores_plain_text_without_callback_shape(self):
controller = _StubController()
service = AgentAuthService(controller)