verify

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Verifying changes in Honcho

在Honcho中验证变更

Prerequisites

前提条件

Docker Compose is the preferred way to run the stack —
docker-compose.yml
at the repo root brings up Postgres (pgvector), Redis, the API server, and the deriver worker together. If Docker Compose isn't available, the stack can also run directly on the host (see Launch below); you'll need Postgres with pgvector and Redis reachable, plus a
.env
with connection strings and an LLM provider key for any flow that hits a model (deriver, dialectic, dreamer).
Working in a worktree? It carries neither
.env
nor
node_modules
. Copy
.env
from the main checkout (that's where the provider keys live), and run
bun install
in
sdks/typescript
if you'll run the full test suite — otherwise the pre-push gate fails on a phantom
Cannot find package 'zod'
.
Docker Compose是运行该栈的首选方式——仓库根目录下的
docker-compose.yml
会启动Postgres(pgvector)、Redis、API服务器以及deriver worker。如果无法使用Docker Compose,该栈也可以直接在主机上运行(参见下文的启动部分);你需要可访问的带pgvector的Postgres和Redis,此外还需要一个包含连接字符串的
.env
文件,以及用于任何调用模型的流程(deriver、dialectic、dreamer)的LLM提供商密钥。
使用工作树(worktree)?它不会携带
.env
或
node_modules
。从主检出目录复制
.env
(提供商密钥存储在那里),如果要运行完整测试套件,在
sdks/typescript
中执行
bun install
——否则预推送检查会因出现不存在的
Cannot find package 'zod'
错误而失败。

Launch

启动

First check whether the stack is already running via Docker Compose:
bash
docker compose ps          # look for api / deriver / database / redis
docker compose up -d       # start it if not
A running stack is not the same as your branch's code running — check the CREATED column; the images may be weeks old. For verifying a diff, the cheap path is to reuse the stack's Postgres/Redis containers but run the branch's API as a host process on a spare port:
bash
uv run uvicorn src.main:app --port 8901   # branch code, stack's DB/Redis
uv run python -m src.deriver              # if the diff touches the worker
This avoids both an image rebuild and the port/project-name conflicts a second compose stack in a worktree would cause. Without Docker at all, run the two processes the same way against host Postgres + Redis (API default port 8000 via
uv run fastapi dev src/main.py
).
When reading server logs, note that with the main
.env
the telemetry emitter spams connection warnings at an unreachable endpoint —
grep -v telemetry.emitter
before looking for the real error.
首先通过Docker Compose检查栈是否已在运行:
bash
docker compose ps          # 查看api / deriver / database / redis
docker compose up -d       # 如果未运行则启动它
运行中的栈并不等同于运行你的分支代码——查看CREATED列;镜像可能已经是几周前的了。要验证代码差异,简便的方法是复用栈的Postgres/Redis容器,但在空闲端口上以主机进程运行分支的API:
bash
uv run uvicorn src.main:app --port 8901   # 分支代码,使用栈的DB/Redis
uv run python -m src.deriver              # 如果代码差异涉及worker
这样既避免了镜像重建,也避免了工作树中第二个compose栈会导致的端口/项目名称冲突。完全不使用Docker的话,以相同方式运行这两个进程,对接主机上的Postgres + Redis(API默认端口8000,通过
uv run fastapi dev src/main.py
启动)。
查看服务器日志时请注意,使用主
.env
文件时,遥测发射器会向无法访问的端点发送大量连接警告——在查找真实错误前先执行
grep -v telemetry.emitter
过滤。

Drive it

运行验证

Prefer driving through the
honcho-cli
skill; fall back to the SDKs (
sdks/python
,
sdks/typescript
), then raw REST against
/v3
, in that order when a method isn't available at the higher level. The
honcho-integration
skill covers how to use the SDKs.
When a change updates endpoints or makes schema changes, verify across all three surfaces — CLI, SDKs, and REST — since they can drift independently.
For LLM-path changes, the fastest synchronous surface is dialectic at the
minimal
reasoning level: send a couple of messages, then hit
/v3/.../peers/{peer_id}/chat
and observe the response.
优先通过
honcho-cli
skill进行验证;如果更高层级没有可用方法,再回退到SDK(
sdks/python
、
sdks/typescript
),最后直接调用
/v3
的REST接口。
honcho-integration
skill涵盖了SDK的使用方法。
当变更更新了端点或修改了 schema 时,需在三个层面(CLI、SDK和REST)都进行验证,因为它们可能会各自出现偏差。
对于LLM路径的变更,最快的同步层面是
minimal
推理级别的dialectic:发送几条消息,然后调用
/v3/.../peers/{peer_id}/chat
并观察响应。

Configuration

配置

Configuration is central to both driving the app and running tests: it's how API keys reach the server and how a config-related change gets exercised at all. Settings come from environment variables or files, with precedence env >
.env
>
config.toml
> defaults. To verify a configuration change, set the relevant option through one of these layers, restart the affected process, and observe the behavioral difference at the surface — the same mechanism lets you point provider base URLs, model choices, and timeouts at credentials and proxies you actually have.
Two concrete levers: deep-nested settings (e.g.
[dialectic.levels.minimal.model_config.overrides.provider_params]
) are miserable as env vars — drop a partial
config.toml
in the repo root instead. And for load-time config behavior,
uv run python -c "import src.config; ..."
is faster than booting the server.
配置对于运行应用和测试都至关重要:它是API密钥传递到服务器的方式,也是配置相关变更得以生效的途径。设置来自环境变量或文件,优先级为环境变量 >
.env
>
config.toml
> 默认值。要验证配置变更,通过其中一个层级设置相关选项,重启受影响的进程,然后观察运行时层面的行为差异——同样的机制可以让你将提供商基础URL、模型选择和超时时间指向你实际拥有的凭据和代理。
两个实用技巧:深层嵌套的设置(例如
[dialectic.levels.minimal.model_config.overrides.provider_params]
)作为环境变量使用起来非常麻烦——可以在仓库根目录放置一个部分配置的
config.toml
文件代替。而对于加载时的配置行为,
uv run python -c "import src.config; ..."
比启动服务器更快。

Test suites

测试套件

Three test types matter here. All run in CI, but they're also runnable locally with whatever API keys and configuration you have — Honcho's config surface is large, so options like per-agent timeouts and provider base URLs can be pointed at your own keys/proxies to exercise a change:
bash
undefined
这里有三种重要的测试类型。所有测试都会在CI中运行,但你也可以使用自己的API密钥和配置在本地运行——Honcho的配置层面很广泛,因此诸如每个agent的超时时间和提供商基础URL等选项可以指向你自己的密钥/代理,以验证变更:
bash
undefined

Unit tests (pytest; spins up its own infra via fixtures)

单元测试(pytest;通过fixture启动自己的基础设施)

uv run pytest tests/
uv run pytest tests/

Unified tests — step-based end-to-end flows defined in JSON

统一测试——基于步骤的端到端流程,以JSON定义

(config hierarchy, multi-turn interactions, LLM-as-judge assertions)

(配置层级、多轮交互、LLM作为判断者的断言)

uv run python -m tests.unified.run uv run python -m tests.unified.run --test-dir tests/unified/test_cases
uv run python -m tests.unified.run uv run python -m tests.unified.run --test-dir tests/unified/test_cases

Live LLM tests — real provider calls, for testing specific backends.

实时LLM测试——真实的提供商调用,用于测试特定后端。

Needs provider API keys AND model vars — without LIVE_LLM_*_MODELS the

需要提供商API密钥和模型变量——如果没有设置LIVE_LLM_*_MODELS,

tests silently deselect that provider. See tests/live_llm/README.md.

测试会自动跳过该提供商。参见tests/live_llm/README.md。

export LLM_ANTHROPIC_API_KEY=... export LIVE_LLM_ANTHROPIC_45_PLUS_MODELS=claude-sonnet-4-5 uv run pytest tests/live_llm -n 0 --live-llm --no-header -q
undefined
export LLM_ANTHROPIC_API_KEY=... export LIVE_LLM_ANTHROPIC_45_PLUS_MODELS=claude-sonnet-4-5 uv run pytest tests/live_llm -n 0 --live-llm --no-header -q
undefined