跳到主要内容

Status & Doctor

anyy status 回答“这个 profile 当前的 runtime state 是什么?”anyy doctor 回答 “本地 Anyy setup 看起来是否有效?”

当你想在终端里快速看运行状态时运行 status。命令失败、编辑 config 后,或准备提交 bug report 前运行 doctor。

应该运行哪个命令?

需求命令
确认 profile、home、role、timezone 和 subsystem stateanyy status
检查 resident service 是否安装且可达anyy gateway status
验证本地文件和配置anyy doctor
验证候选 config fileanyy doctor --config PATH
检查单个 channel 的 config 和 secret refsanyy channels doctor CHANNEL
给脚本消费结果给支持的命令加 --json

Status Command

anyy status

典型 human output:

◆ Anyy status
Gateway running
Profile default
Default role default
Home /Users/you/.anyy
Timezone Asia/Shanghai (host)

◆ Subsystems
Gateway listener open
Cron configured
Heartbeat configured
Storage ok
MCP configured

Status 会解析所选 profile、读取本地配置、在可达时检查 gateway socket,并总结 subsystems。 如果 gateway 正在运行,status 会在可用时使用 runtime data 填充 listener、timezone、role、MCP 和 storage 细节。

常用 flags:

anyy status --home PATH
anyy status --socket PATH
anyy status --json

脚本和 dashboards 使用 --json

Doctor Command

anyy doctor

Doctor 生成一组 checks,每项状态为 okwarnfailinfo。它的范围很具体: filesystem、profile、config、timezone、gateway listener config、channels、cron、heartbeat、 MCP 和 storage。

常用 flags:

anyy doctor --home PATH
anyy doctor --config PATH
anyy doctor --json

--config PATH 适合在把候选 config 放进 profile home 前先验证。

Checks

Filesystem

Doctor 会确认 resolved Anyy home 存在且是目录。Status 会打印同一个 resolved home,方便快速发现 profile 或 environment selection 错误。

Configuration

Doctor 会加载并验证 config.yaml,除非你传入 --config PATH。未知 top-level YAML fields 和无效 enum values 会失败,而不是被静默忽略。

字段默认值见配置参考

Gateway

有两个相关命令:

anyy gateway status
anyy status

gateway status 面向 service:它报告 resident service 是否安装、是否运行、是否可达、由哪个 service host 拥有、home path、socket,以及版本不一致警告。

status 面向 runtime:它报告 gateway RPC status endpoint 是否可达,并把 gateway listener details 合入 subsystem summary。

Doctor 会报告配置中的 gateway listener posture。Open TCP listener 会报告为 informational,因为它 可能是有意配置,但仍值得检查。

Providers

当前 CLI doctor 会把 provider configuration 作为 config validation 的一部分验证。它不会对每个 provider 发起 live model request。Provider runtime failures 通常会在 turn 运行时、setup/model 命令中,或 gateway runtime diagnostics 中出现。

如果 model call 失败,先检查:

anyy status
anyy setup model
anyy doctor

然后检查 config.yaml 中的 provider entry 和被引用的 secret。

Doctor 不能证明什么

Doctor 是本地 diagnostics command。通过 doctor 不代表每个外部 provider、platform API、MCP server 或 channel destination 都会接受下一次 live request。

需要测试外部服务时,使用 provider setup、channel live-smoke tests 或 subsystem-specific probes。

Channels

anyy doctor 包含 configured channel readiness probes。检查单个 channel 时使用 channel doctor, 因为它有 channel-specific checks:

anyy channels doctor telegram
anyy channels doctor telegram --json

Channel doctor 会验证 config block、required secret references、enablement 和 live-smoke readiness。 普通 doctor run 不会发送聊天消息。

Cron

Doctor 包含 cron status probes。需要 operational detail 时使用 cron command:

anyy cron list

Cron jobs 在 resident gateway 内运行,因此即使 cron config 有效,也需要运行中的 gateway 才能执行 scheduled work。

Heartbeat

可以直接查看 heartbeat status:

anyy heartbeat status
anyy heartbeat status --json

statusdoctor 报告 heartbeat 缺失、过旧、disabled 或 degraded 时使用它。该命令读取本地 heartbeat state,不调用模型。

MCP

Doctor 报告 MCP config 和 runtime readiness。Operational detail 使用:

anyy mcp status
anyy mcp list
anyy mcp probe SERVER_ID
anyy mcp logs SERVER_ID

如果 MCP server 配置为 lazy startup,status check 可能会在 server process 尚未启动时显示配置就绪。

Storage

Doctor 检查 state database 和 raw storage policy。Status 会在可用时总结 storage 和 raw backlog 信息。

常用维护命令:

anyy maintenance checkpoint-state
anyy maintenance compact-state
anyy maintenance prune-inactive-sessions

JSON Output

两个命令都支持 JSON:

anyy status --json
anyy doctor --json

status --json 输出一个 object。doctor --json 输出 check objects 数组:

[
{
"name": "filesystem",
"status": "ok",
"detail": "/Users/you/.anyy"
}
]

机器消费者应依赖 namestatus,不要依赖 detail 中的 human wording。

Remediation

当状态不对时按这个顺序处理:

  1. 确认正在检查目标 profile。

    anyy profile list
    anyy status
  2. 验证本地文件和 config。

    anyy doctor
  3. 单独检查 resident service。

    anyy gateway status
    anyy gateway restart
  4. 运行 subsystem-specific command。

    anyy channels doctor telegram
    anyy mcp status
    anyy cron list
  5. 如果涉及 state maintenance,先创建备份。

    anyy backup create

常见失败模式见故障排查