Skip to content

Service assistants run every turn on a harness; Native is no longer offered (#1257, part 1) - #1307

Merged
zhaozhaozz merged 2 commits into
agent-CI-Infra:mainfrom
zhaozhaozz:feat/issue-1257-remove-native
Nov 24, 2026
Merged

zhaozhaozz merged 2 commits into
agent-CI-Infra:mainfrom
zhaozhaozz:feat/issue-1257-remove-native

Conversation

@zhaozhaozz

@zhaozhaozz zhaozhaozz commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #1257

First of the two PRs planned on the Issue (comment 7119998844): the service assistants. The project-role half (Native registration, the runTools fallback, the Manager dispatch branch, frozen task snapshots and role_instances) follows in the second PR, which closes the Issue.

What changes

The management assistant and the group assistant run every turn through serviceHarnessTurn.

Own tasks always run on the host's driver (src/service-roles/own-tasks.ts, review F2). OwnTaskHost.run is required; the inline loop and the host's request, results and clean members, which only that loop used, are removed.

Native-only media handling (src/channels/media.ts): MediaTurn.addImages, fitRequest and recoverModelError, and the private state only they used. Images still reach a harness through takeToolImages.

Selectable backends: service roles and group bindings accept pi, codex and claude_code (serviceHarnesses in src/service-roles/roles.ts, shared by both). Submitting native returns unknown_role_harness from the existing check. The console selects drop the Native option.

Fallback migration (retireNativeServiceAssistants, src/roles/native-to-pi.ts). It handles a management assistant, service role or group binding still saved on Native, for example one chosen by hand after migration:1255.

  • It moves the value to Pi at start-up under the 服务助手、群绑定和项目角色默认改用 Pi,已有 Native 配置迁到 Pi #1255 revision rules: a service role gets a new revision, a group binding keeps its own (its fence).
  • When it moves anything, the start-up log gets a [migration:1257] line with the counts.
  • It runs at every start without a marker. No write path can store Native any more, so after the first start it finds nothing; the query is two SELECTs on small tables. The marker-based one-time migration in the plan (F3) is for the project-role data in the second PR, which scans frozen task snapshots.

Docs: docs/design/agent-and-harness-runtime.md (default backends, service assistant turns, assistant computers), docs/design/assistants-and-channels.md and docs/features/assistants-and-channels.md.

Tests

Removed with the Native loop, as listed in the plan:

One deviation from the plan, adding coverage rather than removing it: the third channel-media case (import a resource, convert it on the computer, view it with view_workspace_image, plus that tool's path, symlink and fence checks) is not Native-specific, so it now runs on the scripted driver instead of being deleted.

New or changed:

  • native-to-pi.test.mjs: Native rows written after 服务助手、群绑定和项目角色默认改用 Pi,已有 Native 配置迁到 Pi #1255 move to Pi when a file-backed store is reopened, with the expected revisions and audit rows; the log line appears once; the API refuses native.
  • channel-service-bindings upgrade case: a binding whose legacy role was Native reads pi after the restart.
  • role-permissions (own-task host with run), assistant-computer-turns (no warning only when nothing is enabled), console-assistant-computers (the warning without a choice).
  • e2e service-roles and channel-assistant-roles: the backend list is Pi, Codex and Claude Code, and choosing Codex keeps the computer warning.

Verification

On head 1d99119f (base e52008a4):

  • npm run check: passed.
  • npm test: 2650 tests. Two sets failed in the full run at load average 11–17 (other jobs on the host): codex-harness (the grace-window timing asserts, which fail the same way in the base run) and repository-skills-request (one 90 s timeout). Both pass when run alone on this head.
  • Timing, base e52008a4 vs this head, same host: 517 s vs 570 s wall time, with host load from other jobs in both runs. The sets this PR touches took 294 s vs 243 s in total; the largest drops are channel-service-bindings (71→55 s), channel-turn-messages (61→45 s) and management (47→34 s).
  • npm run test:e2e: 565 passed.

Head 74290cd2 (review fixes on top of 1d99119f: two design-doc statements, the model-role-impact e2e seed, and the dead groupHarness knob in channel-fixture.mjs):

  • npm run check: passed.
  • Every test file that uses boundGroup (17 sets, 222 tests): passed.
  • test/e2e/models/model-role-impact.spec.mjs: passed (3 tests).
  • The rest of the code is unchanged from 1d99119f, so its npm test and e2e results above still apply.

Screenshots

Full viewports at 1440×900 and 390×1000 from the e2e harness, which has no assistant computers (scrollWidth <= innerWidth at both widths). Headless Chromium draws no popup for a <select>, so the "options" captures give the select a list size to show every option in place.

全局设置 → 管理助手设置: Pi(推荐) selected by default, the computer warning below it:

Same page, options shown, Codex chosen: the options are Pi(推荐), Codex, Claude Code; the warning stays for every backend:

New group binding (project administrator), 高级设置:Agent 后端 unfolded, options shown, Codex chosen: the same three options; the warning outside the fold stays:

Group list after saving: the group set to Codex shows the Codex badge:

…ness; Native is no longer offered

The management assistant and the group assistant lose their Native loops:
every turn, and every own task, goes through serviceHarnessTurn. Service
roles and group bindings accept pi, codex and claude_code; a value still
saved as native moves to Pi at start-up. MediaTurn drops the image fitting
and recovery only the Native loops used, and the assistant computer warning
no longer depends on the chosen backend.
@zhaozhaozz
zhaozhaozz marked this pull request as ready for review November 24, 2026 03:30
@agent-ci-infra-bot

Copy link
Copy Markdown
Contributor

检视结论:可以合入(无阻塞问题),1 条文档一致性建议

检视版本:head 1d99119f(base e52008a4),32 个文件,+253/−724。工作区 HEAD 与该提交一致。
范围:按 PR 描述,这是 #1257 第一部分(服务助手);项目角色的 Native 移除留给后续 PR,本次不以其缺失判缺口。

逐项核对

  1. 单一来源:serviceHarnesses = ['pi','codex','claude_code'](src/service-roles/roles.ts:20)同时服务角色校验(definition)、群绑定校验与 GET /api/channels/service-bindings 的 harnesses。src/channels/service-bindings.ts 原来那份本地 harnesses 常量已删除,提交 native 会落到既有的 unknown_role_harness,不是新增的分支语义。
  2. 迁移:retireNativeServiceAssistants 在 Store 构造中紧跟 migrateNativeToPi 执行(src/storage/database.ts:307-308),在事务内把残留 native 的服务角色(revision+1)与群绑定(revision 不变,属授权围栏)改为 pi;无残留时不写日志、不写审计,可重复执行。test/st/src/roles/native-to-pi.test.mjs 的新用例关库重开走真实启动路径,断言了 revision 规则、审计行、“启动两次只搬一次”以及 API 拒绝 native。
  3. 旧循环删除后的完整性:src/channels/service-session.ts、src/management/agent.ts、src/service-roles/own-tasks.ts 删掉 Native 循环后,execute/ownHost/resultFiles 仍被使用(例如 service-session.ts:437 的摘要请求还在用 request),没有留下未用变量或悬空引用;OwnTaskHost.run 变成必填,两个宿主都在 adapter 内赋值后才可能被工具调用。roleHarness('native') 仍可达(adapters 里 native 留给项目角色,runTools 保留),但已没有任何写入路径能让服务助手存回 native,所以退役值与运行期回退不冲突。
  4. 图片与上下文预算:控制面侧 MediaTurn.addImages/fitRequest/recoverModelError 随 Native 一起删除;Pi 的等价能力在 runner(runner/image-budget.mjs、test/ut/runner/image-budget.test.mjs)与 src/agent/pi.ts 的 20 MiB 检查里,channel-media 保留了 view/import/导出、2 MiB 串行化、越权路径等用例,被删的只是 Native 专有断言,不是行为无人覆盖。
  5. 控制台:群绑定与服务角色的后端下拉都去掉了 native;harnessComputerWarning() 改为无参、构造时读一次状态——剩下三个后端都需要助手电脑,因此不再有“选 Native 就隐藏警告”的分支,console-assistant-computers、channel-assistant-roles、service-roles 三个测试同步改写。
  6. 文档:两份 docs/design 与一份 docs/features 都说明了 serviceHarnesses 与 [migration:1257];仅剩一处残留表述,见下。

验证情况

本机没有 node_modules,未在本地运行 npm run check 与 npm test。证据取该版本绑定的 CI:head 1d99119f 上 12 个 check run 全部 success,含 unit shard 1/2、unit shard 2/2、e2e、CodeQL 与四个镜像构建。结论基于完整 diff 阅读 + 这些版本绑定检查。

发现

  • F1(建议,不阻塞) docs/design/assistants-and-channels.md:25 仍写服务助手的 checkout_repository“天然兼容 native 后端”“非 Native 后端(pi、claude_code、codex)经 serviceHarnessTurn 透传”,与本 PR 后的事实和同文件第 23 行(只剩三个后端)相反。

同一份文档的“对话后端”条目在本 PR 里已改成只剩 pi、codex、claude_code(第 23 行),但本条仍把 checkout_repository 描述为“天然兼容 native 后端”,并把统一后的执行路径写成“非 Native 后端(pi、claude_code、codex)经 serviceHarnessTurn 透传 githubApiUrl 与实时仓库解析器”。服务助手在这一版已经没有 native 后端(serviceHarnesses,src/service-roles/roles.ts:20,以及 retireNativeServiceAssistants),两条描述互相矛盾,维护者会误以为服务助手仍可选 Native。

建议改为:控制面受控检出始终在控制面完成、不向容器暴露 GitHub 凭据(与后端无关);githubApiUrl 与实时仓库解析器对所有服务助手后端(pi、codex、claude_code)经 serviceHarnessTurn 透传。属文档表述修正,不影响代码行为。

Reviewed commit: 1d99119
Coverage: PR #1307; 32 changed file(s)

@zhaozhaozz

Copy link
Copy Markdown
Collaborator Author

Reviewed head 1d99119fa8b76743b459ffa231ee2331590d75a5 (base e52008a4).

The code change is sound: the Native service-assistant loops and the media helpers only they used are removed, Pi/Codex/Claude Code remain, own tasks now require the host's run, the retained workspace-image case runs on the scripted driver, and the required checks (unit, e2e, the four image builds, CodeQL) pass on this head. I found no code or test defects. Two documentation statements still describe the pre-#1257 behavior and should be corrected before merge:

  1. docs/design/assistants-and-channels.md:25 — the checkout_repository bullet still says the tool is "naturally compatible with the native backend ... while non-Native backends (pi, claude_code, codex) pass githubApiUrl ... through serviceHarnessTurn". After this PR service assistants cannot run on Native and every turn goes through serviceHarnessTurn (line 23 of the same file), so the native/non-native split is stale and contradicts the change.
    Expected: state that all offered backends (pi, codex, claude_code) go through serviceHarnessTurn, and drop the Native clause.
    Cause: the sentence predates removing Native from serviceHarnesses.
  2. docs/design/agent-and-harness-runtime.md:37 — the native row still says it suits "lightweight control-plane / service role sessions". Service roles no longer accept native (serviceHarnesses in src/service-roles/roles.ts:20, and line 63 of this same document).
    Expected: describe the row as the control-plane backend that remains available to project roles (or remove the row in part 2, but do not claim service-role sessions now).

Minor, not blocking:

  • test/e2e/models/model-role-impact.spec.mjs:53 seeds a channel_service_bindings row with harness='native' at runtime. That state is no longer reachable after the start-up retirement, and the equivalent unit fixture was changed to pi in this PR; use 'pi' so the fixture matches the current contract.
  • test/fixtures/channel-fixture.mjs:155,162 keeps the f.groupHarness/scriptedGroup switch although its only two users were deleted here; consider removing the now-dead knob.

I did not enqueue this head: the checks are green, but the documentation must match the shipped behavior first.

…a Native backend; drop the dead group backend knob
@zhaozhaozz

Copy link
Copy Markdown
Collaborator Author

Fixed in 74290cd2 (pushed; the PR head is now this commit):

  1. docs/design/assistants-and-channels.md: the checkout_repository bullet now says the checkout always runs in the control plane whatever the backend, and that every service assistant backend (pi, codex, claude_code) gets githubApiUrl and the live repository resolver through serviceHarnessTurn. The Native clause is gone.
  2. docs/design/agent-and-harness-runtime.md: the native row now says only project roles can still choose it and service assistants no longer offer it (删除 Native agent 后端 #1257). The row itself goes in part 2.

Minor points, also done:

  • test/e2e/models/model-role-impact.spec.mjs seeds the binding with 'pi'.
  • test/fixtures/channel-fixture.mjs: the groupHarness switch is removed; boundGroup always uses the scripted driver.

Verification on 74290cd2: npm run check passed; all 17 test files that use boundGroup (222 tests) and the model-role-impact e2e spec passed. The rest of the code is unchanged from 1d99119f. I also grepped docs/ for other non-Native or Native-backend wording about service assistants and found none.

@agent-ci-infra-bot

agent-ci-infra-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

复核 head 1d99119fa8b76743b459ffa231ee2331590d75a5(base e52008a4),你提的四点全部属实,逐条给出可直接采用的措辞。

1. docs/design/assistants-and-channels.md:25 —— 属实(即此前 F1 所指同一处,这里补上可直接替换的句子)
该行仍写「天然兼容 native 后端与 Bot PAT 账号;同时非 Native 后端(pi、claude_code、codex)经 serviceHarnessTurn 透传……」,与同文件 :23「每一轮都经 serviceHarnessTurn」以及 src/service-roles/roles.ts:20 的 serviceHarnesses 相反。建议把该分句替换为:

……全程不向容器暴露任何 GitHub 凭据,对 GitHub App 与 Bot PAT 账号都适用;pi、claude_code、codex 三个可选后端均经 serviceHarnessTurn 透传 githubApiUrl 与实时仓库解析器,支持容器内原生 git / gh 按仓动态申请短期只读 App 安装令牌并在回合结束统一吊销。

src/service-roles/checkout.ts:20 的工具说明已是 "works for both GitHub App and bot PAT accounts across all backends",措辞正好可以对齐。

2. docs/design/agent-and-harness-runtime.md:37 —— 属实
native 行仍称「适合轻量控制面/服务角色会话」,与同文件 :63「服务助手不再有 native 后端」及 src/service-roles/roles.ts:20 冲突。native 驱动本身仍注册、项目角色仍可手动选择(src/roles/harness.ts:118),所以只需改后半句:

| native | 控制面进程内 | 内置标准工具循环与 ToolTranscript 折叠;服务助手已不再提供(#1257),项目角色仍可手动选择。 |

如果 part 2 会连同项目角色的 Native 一起删掉这一行,也可以留到那时处理,但 :37 与 :63 的矛盾在本 PR 内已经成立,顺手改的成本更低。

3. test/e2e/models/model-role-impact.spec.mjs:53 —— 属实(不阻塞)
仍以 harness='native' 直接 INSERT channel_service_bindings。该用例只断言删除确认里的名称与取消后的不变量(同文件 :56-62),不读后端取值,改成 'pi' 不影响断言,并可与本 PR 已改好的单测 test/st/src/models/model-delete.test.mjs:147 对齐。同文件 :15 的 harness_ref: { id: 'native' } 属于项目角色,仍然有效,无需改动。

4. test/fixtures/channel-fixture.mjs:155,162 —— 属实(可选清理)
本 PR 删掉最后两个传 groupHarness 的用例后,test/ 内已无任何地方赋值 f.groupHarness,scriptedGroup 现在恒被调用;删掉这个开关和 ...(f.groupHarness ? …) 分支即可,纯清理。

bot 无法推送到他人的 feat/issue-1257-remove-native 分支,以上改动需要你在该分支提交。第 1、2 点属于发布前应修的文档事实偏差,第 3、4 点可一并带上。

@zhaozhaozz
zhaozhaozz added this pull request to the merge queue Nov 24, 2026
@zhaozhaozz

Copy link
Copy Markdown
Collaborator Author

Reviewed head 74290cd24b9ff848ad3899638b221fcfd23d1b3d (base e52008a4).

The follow-up commit addresses both documentation findings and the two minor fixture notes: the checkout_repository bullet no longer claims a Native backend, the native row now describes the backend as available to project roles only, the model-impact e2e fixture uses pi, and the unused groupHarness switch is gone. I re-read the delta (4 files, +5/-6) and confirmed the rest of the diff is unchanged from the previously reviewed 1d99119f.

Required checks (unit shards, e2e, the four image builds) and CodeQL all pass on this head. No blocking findings. Enqueued 74290cd2 with expectedHeadOid=74290cd24b9ff848ad3899638b221fcfd23d1b3d; the queue entry is QUEUED at position 1.

Merged via the queue into agent-CI-Infra:main with commit b7c90cb Nov 24, 2026
12 checks passed
@zhaozhaozz
zhaozhaozz deleted the feat/issue-1257-remove-native branch November 24, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant