Skip to content

feat(agent): add fork delegation and subagent model settings - #3978

Merged
wsp1911 merged 5 commits into
openBitFun:mainfrom
wsp1911:dev-pc
Nov 17, 2026
Merged

wsp1911 merged 5 commits into
openBitFun:mainfrom
wsp1911:dev-pc

Conversation

@wsp1911

@wsp1911 wsp1911 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Group the collaboration tools under a shared Rust module.
  • Add AgentFork for background delegation with inherited conversation context and expose its default model under Settings → Execution & Collaboration → Subagents.
  • Add a host-owned setting that lets users disallow per-call subagent model overrides. Propagate fork activity through the existing chat, CLI, and remote tool presentations.

Type and Areas

Type: Feature, refactor

Areas: Rust agent runtime and tools, Web UI settings and chat, CLI, Peer Device, Remote Connect, mobile web, HarmonyOS, docs and locales

Motivation / Impact

Agents can delegate work that depends on the current conversation while keeping the default model under user control. Forked agents retain the parent tool definitions for first-request prompt-cache reuse. The runtime still checks delegation permission when a launch tool is called.

Verification

Passed before rebase:

  • cargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,git --lib -- fork_subagent_request_allows_requested_model_override call_impl_rejects_nested_subagent_delegation (2 tests)
  • pnpm --dir src/web-ui run test:run src/app/scenes/settings/pages/shared/RuntimeSettings.test.tsx src/app/scenes/settings/settingsRegistry.test.ts src/infrastructure/config/services/modelSelections.test.ts src/infrastructure/config/components/common/SettingsControlSizing.test.ts (64 tests, including simulated legacy Peer configuration)
  • pnpm run check:web and pnpm run i18n:audit

Passed after rebase:

  • pnpm run capabilities:check and pnpm run capabilities:test (16 tests)
  • git diff --check HEAD~3..HEAD and node scripts/check-git-object-sizes.mjs --base HEAD~3 --head HEAD

Reviewer Notes

AI-assisted, lightly tested with focused local checks. Live remote scenarios, provider cache hits, and native UI visuals were not exercised. The model override setting remains enabled by default for existing installations. Model pool selection uses the existing host capability, and legacy peers use the existing single-model configuration path.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@wsp1911
wsp1911 force-pushed the dev-pc branch 2 times, most recently from e4465c9 to 26e1ad6 Compare November 17, 2026 12:13
Add a default-enabled configuration setting and execution settings toggle. Hide model selection parameters and guidance when disabled, and enforce the execution host policy before collaboration calls run.

Refresh tool specifications when the policy changes and negotiate peer support. Cover configuration compatibility, tool catalogs, execution checks, and settings behavior.
- Add AgentFork for background delegation with inherited context.
- Preserve the parent tool definitions for fork prompt-cache reuse and
  enforce delegation policy when a launch tool is called.
- Expose the fork default model in execution settings and track fork
  runs across chat, CLI, and remote surfaces.
Box collaboration policy inputs before constructing async state so
nested catalog scopes cannot multiply large futures on the stack.
Keep manual compaction preparation behind a heap allocation boundary.

Preserve lazy policy loading and nested presentation snapshots. Add
regression coverage for future size, scope inheritance, and cleanup,
and document focused verification with the default thread stack.

Validation: 16 focused PTC-enabled Rust tests pass after probe removal;
the Rust CI configuration contract passes. Ubuntu CI passed with the
same production fixes before removing temporary diagnostics.
Capture core test output and exact Cargo artifacts on Linux, macOS,
and Windows. Diagnose stack overflows with bounded isolated reruns,
platform debugger traces, and a larger-stack comparison while keeping
the original test result as the CI gate.

Reuse existing binaries without extra builds or Rust test runs on
successful CI paths. Preserve evidence when a test cannot be identified
or a debugger is unavailable, and clean up timed-out process trees.

Add platform contract tests and document artifact use and limitations.

Validation: 26 diagnostic tests, focused CI assertions, and YAML checks
pass. A native Windows fixture verifies real stack-overflow detection,
large-stack recovery, and process-tree cleanup. Native debugger traces
remain to be validated on their respective hosts. The full GitHub
configuration suite still has unrelated local shell-environment failures.
@wsp1911
wsp1911 merged commit 8165280 into openBitFun:main Nov 17, 2026
14 checks passed
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.

1 participant