Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
services:
postgres:
image: pgvector/pgvector:pg17
container_name: honcho-postgres
ports:
- "127.0.0.1:5433:5432"
environment:
- POSTGRES_DB=honcho
- POSTGRES_USER=honcho
- POSTGRES_PASSWORD=honcho
Comment on lines +6 to +10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Configuration mismatch will break default local startup.

Lines 6-10 configure Postgres as honcho:honcho@localhost:5433/honcho, but runtime defaults expect postgres:postgres@localhost:5432/postgres (see src/config.py and .env.template). Without explicit DB_CONNECTION_URI override, DB init/connection will fail.

Suggested alignment patch
-      - "127.0.0.1:5433:5432"
+      - "127.0.0.1:5432:5432"
@@
-      - POSTGRES_DB=honcho
-      - POSTGRES_USER=honcho
-      - POSTGRES_PASSWORD=honcho
+      - POSTGRES_DB=postgres
+      - POSTGRES_USER=postgres
+      - POSTGRES_PASSWORD=postgres
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- "127.0.0.1:5433:5432"
environment:
- POSTGRES_DB=honcho
- POSTGRES_USER=honcho
- POSTGRES_PASSWORD=honcho
- "127.0.0.1:5432:5432"
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker-compose.local.yml` around lines 6 - 10, The docker-compose Postgres
credentials/port (POSTGRES_DB=honcho, POSTGRES_USER=honcho,
POSTGRES_PASSWORD=honcho, and host port 5433) do not match the runtime defaults
expected by DB_CONNECTION_URI (postgres:postgres@localhost:5432/postgres);
either change the docker-compose service to use POSTGRES_DB=postgres,
POSTGRES_USER=postgres, POSTGRES_PASSWORD=postgres and map "127.0.0.1:5432:5432"
to match the runtime defaults, or explicitly set DB_CONNECTION_URI in the
service environment to "postgresql://honcho:honcho@localhost:5433/honcho" (and
update .env.template/any config default references accordingly) so the app can
connect without overriding at runtime.

volumes:
- honcho-postgres-data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U honcho -d honcho"]
interval: 60s
timeout: 5s
retries: 5
start_period: 30s

volumes:
honcho-postgres-data:
driver: local
driver_opts:
type: none
o: bind
device: /Users/headless/docker-volumes/honcho-postgres
Comment on lines +24 to +27
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Host-specific bind mount path is non-portable.

Line 26 hardcodes /Users/headless/..., which will fail on other machines/OSes. Prefer a plain named volume (or env-substituted host path if bind-mount is required).

Suggested portability patch
 volumes:
   honcho-postgres-data:
-    driver: local
-    driver_opts:
-      type: none
-      o: bind
-      device: /Users/headless/docker-volumes/honcho-postgres
+    driver: local
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker-compose.local.yml` around lines 23 - 26, The host-specific bind mount
under driver_opts (device: /Users/headless/docker-volumes/honcho-postgres) is
non-portable; replace it with a named volume or an env-substituted host path:
update the driver_opts/device entry to reference either a Docker named volume
(create a volumes: entry and use that name) or use an environment variable like
${HONCHO_PG_HOST_PATH} and document it in .env, ensuring the docker-compose
service uses the new volume name instead of the hardcoded path.

24 changes: 22 additions & 2 deletions src/utils/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,17 @@ def _is_tool_use_message(msg: dict[str, Any]) -> bool:
return True

# OpenAI format: tool_calls field on assistant message
return bool(msg.get("tool_calls"))
if msg.get("tool_calls"):
return True

# Google format: parts list with function_call entries
parts = msg.get("parts")
if isinstance(parts, list):
for part in parts:
if isinstance(part, dict) and "function_call" in part:
return True

return False


def _is_tool_result_message(msg: dict[str, Any]) -> bool:
Expand All @@ -115,7 +125,17 @@ def _is_tool_result_message(msg: dict[str, Any]) -> bool:
return True

# OpenAI format: role is "tool"
return msg.get("role") == "tool"
if msg.get("role") == "tool":
return True

# Google format: parts list with function_response entries
parts = msg.get("parts")
if isinstance(parts, list):
for part in parts:
if isinstance(part, dict) and "function_response" in part:
return True

return False


def _group_into_units(messages: list[dict[str, Any]]) -> list[list[dict[str, Any]]]:
Expand Down