Add profile-aware parallel subagent fleets / 新增可配置并行子智能体 Fleet#6636
Merged
SivanCola merged 3 commits intoJul 18, 2026
Conversation
Problem: Custom subagent profiles could only be run serially through skill execution, making multi-document workloads unnecessarily slow and leaving concurrent writers without one session-wide safety boundary. Root cause: Task execution had no runtime profile selector or shared fleet scheduler, and write coordination was split across entry points without atomic parent reservations or enforceable path claims. Fix: - add profile-aware task and fleet execution with session-wide total/writer concurrency limits - normalize and enforce write path claims, including sandboxed Bash roots and parent write reservations - make background tasks queue asynchronously and keep parallel_tasks on the shared scheduler - expose concurrency and read-only profile controls in Desktop and document the contracts Verification: - go test ./... - cd desktop && go test ./... - go test -race ./internal/agent ./internal/boot ./internal/config ./internal/skill - cd desktop/frontend && pnpm typecheck && pnpm test:typecheck && pnpm test - ./scripts/cache-guard.sh
Problem: Path-bound Bash retained sandbox cache and temporary-directory write lanes, wildcard tool allowlists could reject valid narrowed calls, and stale scheduler code blocked lint. Root cause: Bash root rebinding did not enable minimal-write confinement, tool lists were intersected before live-registry pattern expansion, and obsolete control flow remained after scheduler unification. Fix: Restrict rebound Bash to claim roots, expand both allowlists before intersection, remove stale scheduler parameters and helpers, and add focused execution regressions. Verification: - golangci-lint v2.12.2: 0 issues - go test ./... - go test -race ./internal/agent ./internal/tool/builtin ./internal/boot ./internal/config ./internal/skill - cd desktop && go test ./... - ./scripts/cache-guard.sh
Problem: Cancelled fleet writers could be reported as skipped after they had started, and preflight conflicts could cite the wrong task numbers when read-only items were interleaved. Root cause: The cancellation path stopped draining terminal worker results after waiting, while write claims were compacted into a writer-only slice before indexed validation. Fix: Drain every started worker result after cancellation, reserve skipped for tasks that never started, and retain one claim slot per original fleet item. Add deterministic cancellation and mixed-task indexing regressions. Verification: - go test -race ./internal/agent -run '^TestFleet' -count=1 - go test ./internal/agent - go test ./... - golangci-lint v2.12.2: 0 issues - ./scripts/cache-guard.sh - git diff --check
SivanCola
marked this pull request as ready for review
July 18, 2026 14:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
profileandwrite_pathssupport totask; profile bodies become the complete child system prompt instead of inheriting the concise default.fleetfor 2–64 independently reported subagent tasks, with foreground or background execution and fixed registration order:task→parallel_tasks→fleet.Why
Custom subagent profiles were only directly runnable through the serial skill path. A workload such as ten independent documents therefore queued one child after another even when the work and output paths were independent.
This change makes profile execution available to the parallel task surface while keeping write safety explicit. Writers with disjoint declared paths can run concurrently; a writer that omits
write_pathsconservatively claims the whole workspace.Safety and behavior
max_subagent_concurrencydefaults to 6;max_parallel_writersdefaults to 3. Both normalize to 1–32 and writers never exceed total concurrency.PreToolUseand hold it through execution, closing check-before-write races with background subagents.taskreturns its job id before waiting for a scheduler slot.Backward compatibility
taskcallswrite_pathsremain valid and now take a conservative whole-workspace scheduling claim.read-onlyremains the legacy writable default. CLI/Desktop round-trip the managed field without dropping unrelated frontmatter.Verification
go test ./...cd desktop && go test ./...go test -race ./internal/agent ./internal/boot ./internal/config ./internal/skillcd desktop/frontend && pnpm typecheck && pnpm test:typecheck && pnpm test./scripts/cache-guard.shIntegration notes
internal/agent,internal/boot, andinternal/config; this branch may need a rebase if that PR lands first.Cache impact
Cache-impact: medium — the upgrade intentionally adds the
fleettool and extends thetaskschema, causing one prompt-cache cold start. After that, tool order is fixed and profile names never enter tool schemas or the parent system prompt.Cache-guard:
./scripts/cache-guard.shpassed, including all release cache-hit scenarios.System-prompt-review: required — custom and named built-in profile bodies now intentionally become the complete child system prompt. Ordinary
taskandread_only_taskdefaults are unchanged.