Skip to content

Remove the Native backend: project roles, Manager dispatch and frozen task configurations (#1257) - #1311

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

zhaozhaozz merged 1 commit into
agent-CI-Infra:mainfrom
zhaozhaozz:feat/issue-1257-remove-native-roles

Conversation

@zhaozhaozz

@zhaozhaozz zhaozhaozz commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1257

Second of the two PRs planned on the Issue (comment 7119998844), after #1307 (service assistants, merged): the project roles. After this PR there is no Native backend and no control-plane tool loop left.

What changes

Native is not registered any more (src/roles/harness.ts). Every driver brings its own transport; roleHarness has no runTools fallback (review F4). Submitting native for a role returns unknown_role_harness from the existing check; the role editor's backend list (from the API) no longer offers it.

runAgent requires an adapter (src/agent/runtime.ts). Without one it throws agent_adapter_required (a plain error: every production caller passes one). runTools is deleted, and with it the spec fields only it read (temperature, maxOutputChars). ToolTranscript and boundedBatch in src/agent/tool-context.ts lost their last users and go too.

Manager event dispatch always runs the configured driver (src/dispatch/manager.ts, review F2). The inline Native loop is deleted.

  • Addition beyond the plan: when the control plane refuses a dispatch decision, the Native loop told the model created: false, the blocking task_id and what to do next ("answer the person with github_write …, then ignore_event"). The harness path, which production Pi Managers already use, returned only the code and reason. The refusal now comes back as a SubmissionError carrying those same facts, so nothing the Manager was told is lost.
  • A decision that stays invalid now ends at the driver's turn limit (agent_turn_limit) instead of after the Native loop's single correction. This is what Pi Managers already did. The event stays pending and is retried as before.

src/roles/run.ts: the request-based finalization reserve applies to process and pi only.

text_json and native_resume stay (review F5, F6): process declares text_json; native_resume, native_access, native_workspace_id and pi_native are Pi's own identifiers.

One-time start-up migration retireNativeProjectRoles, marker migration:1257:retire-native-roles (review F3). It follows #705's retireAcpTaskExecutionConfigs, in one transaction, and moves what still names Native:

  • Saved configurations:
    • V2 roles move under a new configuration revision (updated_by: migration:1257, a role_config_revisions row, an audit entry).
    • Legacy harnesses entries are rewritten in place.
  • Frozen task_execution_configs snapshots: V2 roles and legacy maps. The snapshot revision passes both the frozen one and the project's current one, as [需求] Claude Code 与 Codex 在项目容器内运行:原生工具、平台管理工具与容器内模型中转 #705 did. A waiting or reopened task resumes instead of stopping at unknown_role_harness.
  • role_instances: each takes the backend of its task's migrated role, else Pi. session and harness_state are cleared, so the next run rebuilds from task records.

A role whose pinned model profile needs text_json output moves to process, as planned; every other role moves to pi. When anything moved, the start-up log gets one [migration:1257] line with the counts.

Local data (read-only query of the running deployment):

  • no saved configuration on Native;
  • 35 frozen task configurations (17 succeeded, 12 completed, 3 cancelled, 3 pr_opened), none with a text_json role;
  • 40 role instances.

Expected start-up line after deploying: [migration:1257] Native retired: 0 roles in 0 projects (0 to Process for text_json output, the rest to Pi), 35 frozen task configurations, 40 role instances.

Docs: docs/design/agent-and-harness-runtime.md (backend table, default backends and the #1257 migrations), docs/features/roles-and-rules.md, docs/design/testing-architecture.md, docs/design/README.md and docs/design/storage-and-knowledge.md.

Tests

  • Pins moved off Native: tests that pinned a project role to Native now use the test-only scripted driver (平台内部调用和测试不再依赖 Native 工具循环 #1256) where they test role and task mechanics in process. Paired ['native', 'process'(, 'pi')] cases keep their other halves, as planned. Where a test needed a real, listed alternative backend (role editor, saved configurations, e2e), it uses process.
  • Kept on purpose: history rows that record a run on Native (task_runs.harness, old instances shown by the console) stay as they are, since old databases keep them.
  • agent-runtime:
  • Dispatch: refusal assertions read the submission facts (code, reason, created, task_id, instruction); the stays-invalid case expects agent_turn_limit.
  • New: native-to-pi.test.mjs:
  • tool-context and tool-result-files unit tests: drop the transcript and batch cases; the result-file cases use boundedResult.

Verification

On head ddd98d26 (base 05b2e57b). It was rebased onto #1306; the conflict in src/dispatch/manager.ts keeps #1306's expanded refusal instruction in the SubmissionError facts. Earlier, #1308's new delivery-baseline-transparency test pinned Native and now pins the scripted driver.

  • npm run check: passed.
  • npm test: 2653 tests. Two sets failed in the full run, both also failing in the main baseline under load, and both pass when run alone on this head:
    • codex-harness: grace-window timing asserts;
    • repository-skills-request: one case at its 90 s limit; it takes about 75 s alone.
  • npm run test:e2e: 565 passed.
  • Timing, measured before the rebases on the same host: base b7c90cbf took 843 s, this change 557 s (2664 vs 2638 tests). Host load from other jobs differed a lot between the two runs (load average peaked at 25 vs 15), so this is not a clean comparison. On this head, npm test took 534 s.

Screenshots

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

Project settings → 角色 → dev, Agent 后端: the options are Pi(推荐), Claude Code, Codex, 容器内 ACP, iCode, WorkSwarm and Process; Native is gone (the list comes from the API):

@zhaozhaozz
zhaozhaozz marked this pull request as ready for review November 24, 2026 06:08
@zhaozhaozz

Copy link
Copy Markdown
Collaborator Author

Reviewed head 59cec706, base main @ 5e2769b7. The code and tests themselves raise no blocking finding, but the branch can no longer be merged as-is: main has advanced to 05b2e57b (#1306) and this PR now reports CONFLICTING / mergeStateStatus: DIRTY. Please rebase onto origin/main and resolve:

  1. src/dispatch/manager.ts — Require structured background, recommended options, and pros/cons when asking humans for decisions #1306 rewrote the Manager's refused-decision guidance (explain the background and blocker; when several viable options exist list concrete candidates with one recommended option and each option's pros and cons; state the prerequisite directly for a single-path blocker) in exactly the block this PR moves from the inline Native loop into the SubmissionError clues. Keep Require structured background, recommended options, and pros/cons when asking humans for decisions #1306's expanded wording in the new SubmissionError instruction (and its matching Manager system-prompt sentence) while deleting the loop; do not drop either side of the conflict.
  2. test/st/src/roles/delivery-description.test.mjs — both sides add imports (roleAssignmentContext, workspaceProfile on main, the scripted driver fixture here); keep both. Require structured background, recommended options, and pros/cons when asking humans for decisions #1306 also added a development-team test that reuses the fixture whose backends this PR moves from native to scripted, so rerun that file after resolving.

Non-blocking, easy to include in the same push: AGENTS.md:17 still lists native among the Harness backends ("pi、native、process、claude_code、codex"). Drop it to match the remaining registered drivers.

No queue entry and no auto-merge were present on this head; I will re-review once the rebased head is pushed.

… brings its own transport

Native is no longer registered: roleHarness has no control-plane tool loop to
fall back to, runAgent requires an adapter, and the Manager's event dispatch
always runs its configured driver. A refused dispatch decision returns the
refusal and what to do next to the Manager as submission facts. ToolTranscript,
boundedBatch and runTools go with the loop.

A one-time start-up migration (migration:1257:retire-native-roles) moves what
still names Native to Pi, or to Process for a role whose pinned model profile
needs text_json: saved role configurations, frozen task_execution_configs
snapshots and role_instances (session and harness state cleared).
@zhaozhaozz
zhaozhaozz force-pushed the feat/issue-1257-remove-native-roles branch from 59cec70 to ddd98d2 Compare November 24, 2026 06:48
@zhaozhaozz

Copy link
Copy Markdown
Collaborator Author

Rebased onto main @ 05b2e57b (#1306); the PR head is now ddd98d26 (pushed and checked on the fork).

  1. src/dispatch/manager.ts: the inline loop stays deleted. Require structured background, recommended options, and pros/cons when asking humans for decisions #1306's expanded refusal wording is now the instruction in the SubmissionError facts: explain the background and blocker; when several viable options exist, list concrete candidates with one recommended option and their pros and cons; for a single-path blocker, state the required action directly. Require structured background, recommended options, and pros/cons when asking humans for decisions #1306's Manager system-prompt sentence merged unchanged.
  2. test/st/src/roles/delivery-description.test.mjs: both imports are kept (roleAssignmentContext, workspaceProfile from main, and the scripted driver registration). The file passes, including Require structured background, recommended options, and pros/cons when asking humans for decisions #1306's new development-team case.
  3. Non-blocking: AGENTS.md no longer lists native among the Harness backends.

Verification on ddd98d26:

The PR body's verification section is updated.

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

Copy link
Copy Markdown
Collaborator Author

Re-reviewed rebased head ddd98d26 against main @ 05b2e57b.

Rebase resolution checked in the diff against the previously reviewed 59cec706; it contains only #1306's changes plus the AGENTS.md fix, with nothing of this PR lost:

All 12 required checks pass (unit, unit shard 1/2+2/2, e2e, CodeQL, Analyze (actions/js/python), four image builds), mergeStateStatus: CLEAN. Locally on this head: npm run build, npm run check, and 53/53 tests across delivery-description, native-to-pi, dispatch, tool-context, human-decision-prompts, and harness.

Queued at ddd98d26 (expectedHeadOid set to this head); I will confirm the merge against the reviewed patch.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

删除 Native agent 后端

1 participant