Repository navigation
feat(agent-runtime): dispatch frozen configuration and verify Node adapters - #106
Conversation
b78f16e to
b5ef31a
Compare
|
Migration number collision with main: this PR (head Found while merging this PR with main and #103 for a pre-merge integration rehearsal; the two merge cleanly otherwise. |
b5ef31a to
1be0610
Compare
审查版本: 阻塞项是迁移编号、rebase 和 CI 状态;代码本身没有发现阻塞缺陷。 阻塞
非阻塞
已核对
未验证本地没有跑 PostgreSQL/race(Windows 环境),以 CI 和作者本地结果为准;部署侧仍应保持 |
1be0610 to
132cc6a
Compare
审查版本: 以下非阻塞事项建议本轮顺手处理(都很小):
已核对
最后:本运行其余三个 PR 的复审结论见 ora-space/circus#354。 |
publicSessionFailureCode collapsed every plugin-owned adapter failure into agent_failed, so a run could not say whether its configuration was missing, inconsistent, refused or not applied (ADR D2). The Node's bounded codes and the startup scan's agent_adapter_unavailable now pass through; anything else still becomes agent_failed.
The new public failure codes get their own message; an unknown code or provider text still shows the generic failure.
The startup scan also settles an undispatched run as failed/agent_adapter_unavailable when a fresh Node definitively lacks the frozen declaration's adapter capability; model-access already points at this table.
wanglongan587
left a comment
There was a problem hiding this comment.
审查版本:f454afe2170ee1fedac696b44ffe4447980dc9b5(增量 132cc6a..f454afe:3 commits、8 files、+64/−3)。结论:通过(无阻塞)。
说明:本 PR 的作者是 @wanglongan587(本人),GitHub 不允许作者提交原生 review,本轮继续以评论形式给出审查结论。请 owner 另指派 reviewer,或明确采信这条评论(已在运行 issue ora-space/circus#354 里提出)。
本轮增量
- A. 范围:
132cc6a..f454afe正好 3 个 commit(96a1072公开错误码、023c35c前端文案、f454afe结算文档),无 merge commit;除这三处外没有 proto、controlpb、controlgrpc、能力语义或迁移文件变化。 - B.
publicSessionFailureCode:放行 16 个有界码,新增 7 个(启动扫描的agent_adapter_unavailable;Node 的agent_model_configuration_required、agent_model_configuration_invalid、agent_model_protocol_mismatch、model_grant_mismatch、agent_model_adapter_failed、agent_model_adapter_not_applied)。精确 switch,未知码与供应商文本仍回落agent_failed;Go 表驱动测试覆盖全部新码与拒绝用例(internal/core/agent_run_failure_test.go),未过度放宽。 - C. 前端:7 个新码各有文案(
frontend/src/features/issues/thread/thread-failure.ts),模块 README 中英同步;本 head 的frontendjob 通过。 - D. 文档:
docs/agent-runs/startup-settlement.{md,en.md}的agent_adapter_unavailable行与internal/core/agent_run_startup.go、execution_startup.go一致;docs/models/model-access*、docs/operations/configuration*无过期清单。 - E. 描述:已改为
Refs ora-space/circus#354,#336作为来源说明、不再出现Refs;两份 ADR 仍为approved(specs3c41a34)。 - F. 迁移:main 最新是
0059,本 PR 的0060_node_model_adapter.sql顺延正确;internal/core/migrations/README{,.en}.md计数 61→62 与实际 62 个 SQL 一致;#111的0060_scheduled_tasks.sql冲突已在描述里写明「后合并者顺延 0061」。 - G. 回归抽查(未被新 commit 改坏):
agent_configuration字段 9、execution_work.input逐字比较、claim/scan/dispatch 三处能力语义、proto 数值文本保真(codec 测试)、legacy 输入缺省、plugins.personal_agent_target默认空。
非阻塞
- 描述里「The Thread names each of them」对
agent_model_adapter_failed/agent_model_adapter_not_applied目前不成立:它们是 Node 内部的PluginAgentErrordetail,配置会话启动失败实际报agent_start_failed/agent_unavailable。建议把描述收窄为「预留给 Node 内部 adapter 失败」,或由 desktop 后续真正上报(follow-up,不阻塞)。 agent_plugin_unavailable、prior_revision_*、workspace_unavailable等其他有界码仍回落agent_failed;建议记 follow-up,定「哪些码对用户公开」并建唯一清单(现在 Go、proto、前端、文档各自枚举)。- 前端测试只覆盖 7 个新码中的 2 个;建议表驱动覆盖全部。
- 合并前按描述再核对迁移号:#111 先合则本 PR 顺延
0061(同步测试名与 README 计数)。
验证与未覆盖
- 本地:
go build ./...、go test ./internal/core/ ./internal/controlgrpc/ ./internal/config/ ./internal/api/router/、go vet ./integration通过;新单测与 codec 测试通过。本地全量cmd测试的失败均为环境/已知问题(devsetup key-mode 已在主 clone 复现,与 PR 无关)。 - CI:本 head
check、frontend均 success(check带 PostgreSQL 与-race ./...)。 - 本地未跑 PostgreSQL/race,以 CI 为证据;未做真实 gateway/模型调用验收。
EricWvi
left a comment
There was a problem hiding this comment.
owner 审查 f454afe2170ee1fedac696b44ffe4447980dc9b5:Approve。本 PR 名义作者是本运行的 reviewer,无法提交原生 review,由 owner 直接审查。
核对:
- 能力证据:
RegisterNode上报modelAdapter。validAgentAdapterCapability只接受带modelProxy的 v1、两个 Linux target,以及不重复的openai-completions/anthropic-messages;重复注册时jsonText不一致按node_capability_conflict拒绝。老 Node 落成'{}',不会被当作支持(迁移注释和modelAdapterMessage都是"缺省即不支持")。 - 派发与启动结算一致:
dispatchRunExecution用declaredAgentCapable门禁;inspectAgentStartup用同一函数判定adapterUnavailable,结算为agent_adapter_unavailable/capability_rejected;scanStartingAgentRuns的declaredAdapterMismatchSQL与 Go 判定一一对应(target、contractVersion 文本比较、protocols ? protocol)。 - 会话规格:
run_agent_configurations+run_model_bindings冻结后下发;没有 binding 时显式报错。settings_json以字符串传递,保留数字的原样写法;回读时限制 256 KiB、要求单个 JSON 对象,并对数值做有界校验。 - 公开错误码:
publicSessionFailureCode放行新增的 7 个有界码,未知码仍回落agent_failed。 - proto / 迁移:
agent_configuration = 9、model_adapter = 10/8都是新增字段;0060_node_model_adapter.sql只加一列带默认值和类型 CHECK 的 jsonb。当前 main1f5f3d5的迁移到0059,0060 空着。 - 基线漂移:PR 基点
308057c之后,main 没有新增迁移,也没有和本 PR 重叠的文件(期间改动的是 modelgateway、workflowasset、残留回收查询和测试);git merge-tree合并无冲突。cloud#130 改成了模板 fixture,但TestMigration0060ModelAdapterFreshAndUpgrade走testSchema的空 schema,不受影响。 - 部署开关
plugins.personal_agent_target默认为空,关闭时不会接纳带声明的 Agent;按 #452 的结论,打开前必须先关闭 #452。
非阻塞:reviewer 记下的其他有界码回落清单,以及前端只覆盖 7 个码中的 2 个,留作 follow-up。
…adapter contract third_party/cloud moves from ora-space/cloud#106's branch head 132cc6a to Cloud main 4d35aad, which merged it. proto/ is identical between the two, and proto:check regenerates the committed client without a diff.
Summary
Adds Node capability persistence and an explicit deployment target gate (
plugins.personal_agent_target, empty by default). A stale or disconnected Node is not definitive refusal evidence. Runtime tokens and upstream keys never enter this control contract.Base: #101, including its exact-number replay fix, is merged. Rebased onto main
308057c; the diff contains only this Cloud control/capability delivery. On the rebase,AgentSessionSpec.agent_configurationmoved to field 9 because main now uses 8 forworkspace_directory, and the migration moved to0060_node_model_adapter.sqlafter main's 0058/0059. Controller/Node and plugin adapter changes are separate coordinated deliveries; keep the deployment gate empty until they are deployed.ADR: plugin-owned-model-adapters and personal-agent-configurations remain approved. This PR implements the Cloud control/capability portion, not the final cross-host rollout or publication acceptance.
Started under the run ora-space/circus#336 and handed over to the run referenced below.
Public failure codes:
publicSessionFailureCodenow passes the adapter path's bounded codes through instead of collapsing them intoagent_failed(ADR D2 keeps an incomplete configuration, an incompatible one, a refused grant and a failed preparation apart): the startup scan'sagent_adapter_unavailableand the Node'sagent_model_configuration_required,agent_model_configuration_invalid,agent_model_protocol_mismatch,model_grant_mismatch,agent_model_adapter_failedandagent_model_adapter_not_applied. The Thread has a message for each of them; any other text still becomesagent_failed. Today the Node reportsagent_model_adapter_failedandagent_model_adapter_not_appliedonly as internal detail (a configured start that fails ends asagent_start_failedoragent_unavailable); they are allowlisted so a Node that reports them as the session detail is shown precisely, not asagent_failed.docs/agent-runs/startup-settlementlists theagent_adapter_unavailablesettlement.Evidence
After: generated protobuf roundtrip preserves exact numeric text, legacy inputs stay absent, and current incarnation capabilities fence dispatch.
TestMigration0060ModelAdapterFreshAndUpgrade).Merge Danger
Door: one-way
Migration 0060 adds empty capability evidence to existing incarnations. Apply through cloudctl before starting this server. No existing Node is certified automatically.
Blast Radius: agent-admission
Empty target retains disabled admission. Do not enable the gate or publish configuration declarations before compatible hosts and plugins are deployed and verified.
Rebase verification (head
132cc6a, onto main308057c): the five patches keep their content apart from the field and migration renumbering above, the regeneratedinternal/controlpbmatchesbuf generate, and the migration READMEs (zh/en) gained the 0060 table row and entry. Locally:checkformat,buf lint,golangci-lint(0 issues),go vet ./integrationand the unit tests of the touched packages pass; the PostgreSQL/race/integration gates are left to CI.Merge order: this PR → ora-space/desktop#708 (re-pins
third_party/cloudto the main commit containing it) → ora-space/claude-code-agent#4 and ora-space/opencode-agent#10. Re-check the migration number against main right before merging: the open #111 also adds a0060_*.sql; whichever merges second moves to0061.Refs ora-space/circus#354