feat(#2761): multi-agent orchestration — copilot/worker pattern#2779
feat(#2761): multi-agent orchestration — copilot/worker pattern#2779windoliver wants to merge 9 commits intodevelopfrom
Conversation
Type Safety Progress 📉Current: 276 type: ignore comments ✅ Progress! Keep eliminating type suppressions! |
Type Safety Progress 📉Current: 276 type: ignore comments ✅ Progress! Keep eliminating type suppressions! |
Type Safety Progress 📉Current: 265 type: ignore comments ✅ Progress! Keep eliminating type suppressions! |
- Add process hook types (ProcessSpawnHookContext, ProcessTerminateHookContext, VFSProcessHook) to contracts/vfs_hooks.py - Add TaskManagerProtocol to contracts/agent_runtime_types.py to fix CopilotOrchestrator LEGO tier violation (system_services -> bricks) - Add process hook dispatch to KernelDispatch (register, pre/post spawn, post terminate) - Add sys_proc_spawn, sys_proc_kill, sys_proc_wait, sys_proc_list, sys_dispatch syscalls to NexusFS with hook integration - Add ProcessAuditHook for spawn/terminate audit logging - Wire ProcessManager + ToolDispatcher through factory boot - Add agent_loop, copilot_orchestrator, process_audit_hook implementations - Update README with agent runtime quickstart and architecture examples - 266 tests passing (208 unit + 10 e2e + 48 scheduler)
Previous commit incorrectly overwrote develop's README during merge conflict resolution. This restores the full OS-architecture README from develop and only adds the copilot/worker delegation quickstart.
… fixes - Extract agent_step() single-turn function from agent_loop() - Add AgentVFSProtocol + AgentSearchProtocol (decouple from NexusFS) - Add registry-based spawn (agent_id lookup like installed binary) - Fix import-linter: use importlib pattern for bricks.a2a imports - Fix e2e test: use _StubProcessManager for Protocol-compatible fixtures - Extend AgentSpec with runtime fields (model, tools, prompt, limits) - Add StepAction/StepResult/AgentNotFoundError to contracts - 63 new/updated tests across 4 test files
Show agent_id registry lookup (Option A) as the primary spawn path, with inline AgentProcessConfig as backward-compatible Option B.
- test_full_lifecycle: use orchestrator.complete_task() instead of direct tm.update_task_state() so the asyncio.Event in collect() gets set properly - test_partial_cancel: accept WORKING state (background _run_worker may have transitioned from SUBMITTED) - _make_mock_td: return ToolResult objects from _dispatch() instead of raw strings, matching agent_loop's _dispatch_tool expectations
- Agent Engine section now shows AgentProcessConfig with all key fields (model, system_prompt, tools, max_turns, max_context_tokens) - New "Registry-Based Spawn" section shows AgentSpec registration and spawn-by-name pattern (like installed binaries in /usr/bin/) - Copilot/Worker section now shows full import paths, WorkerConfig fields with inline comments, and DeliveryPolicy usage - Fix: `registry` no longer appears out of nowhere
After the #2776 refactoring that renamed LocalBackend → CASLocalBackend, the README and live LLM e2e test still used the old import path.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.
| Benchmark suite | Current: 3f4b0d9 | Previous: 8cca243 | Ratio |
|---|---|---|---|
tests/benchmarks/test_core_operations.py::TestFileOperationBenchmarks::test_write_small_file |
75.54370716430918 iter/sec (stddev: 0.04459602137253007) |
300.78711742209896 iter/sec (stddev: 0.00047809087645420096) |
3.98 |
tests/benchmarks/test_core_operations.py::TestBulkOperationBenchmarks::test_write_batch_10 |
27.969178798253438 iter/sec (stddev: 0.0013931588749504598) |
39.188778970248656 iter/sec (stddev: 0.001138536110711972) |
1.40 |
tests/benchmarks/test_rebac_latency.py::TestL1CacheHit::test_l1_cache_hit_latency |
16553.73243238054 iter/sec (stddev: 0.000010926039033361148) |
29000.081830264273 iter/sec (stddev: 0.000003409453269809088) |
1.75 |
tests/benchmarks/test_service_delegation.py::TestAsyncDelegationOverhead::test_version_get_delegation |
6559.310038051228 iter/sec (stddev: 0.000025041315679128562) |
8930.124477576594 iter/sec (stddev: 0.00003489369801859649) |
1.36 |
tests/benchmarks/test_service_delegation.py::TestAsyncDelegationOverhead::test_rebac_check_delegation |
4642.175264378427 iter/sec (stddev: 0.004855035428926194) |
8769.424929753402 iter/sec (stddev: 0.000028394751338990928) |
1.89 |
tests/benchmarks/test_service_delegation.py::TestAsyncDelegationOverhead::test_mcp_list_mounts_delegation |
6487.711891739203 iter/sec (stddev: 0.000024624263603431895) |
8921.993016840954 iter/sec (stddev: 0.00003357628815439365) |
1.38 |
This comment was automatically generated by workflow using github-action-benchmark.
Rebase conflict resolution incorrectly kept develop's concrete NexusFS version. Restores AgentVFSProtocol + AgentSearchProtocol decoupling in constructor, _grep(), and _glob() methods.
9f26eb6 to
2da730e
Compare
Type Safety Progress 📉Current: 265 type: ignore comments ✅ Progress! Keep eliminating type suppressions! |
test_delegation.py had broken imports (AgentLoopConfig, CheckpointNotFoundError, etc.) that caused ImportError during pytest collection → orphan Python processes → macOS CI hung for 2h52m. This file is superseded by test_copilot_orchestrator.py (1073 lines, 36 tests, all passing).
Type Safety Progress 📉Current: 265 type: ignore comments ✅ Progress! Keep eliminating type suppressions! |
Closes #2761
Summary
sys_read/sys_writefor files@rpc_exposesyscalls:sys_proc_spawn,sys_proc_kill,sys_proc_wait,sys_proc_list,sys_dispatchTaskManagerProtocolin contractsChanges
Contracts (Tier 0)
contracts/vfs_hooks.py— addProcessSpawnHookContext,ProcessTerminateHookContext,VFSProcessHookprotocolcontracts/agent_runtime_types.py— addTaskManagerProtocol,ProcessManagerProtocol,ToolDispatcherProtocol, data typesCore (Tier 0)
core/kernel_dispatch.py— add process hook slot with register/intercept methodscore/nexus_fs.py— add 5sys_proc_*andsys_dispatchsyscalls viarun_sync()bridgecore/config.py— addprocess_managerandtool_dispatcherto SystemServicesSystem Services (Tier 1)
system_services/agent_runtime/agent_loop.py— reasoning loop (message → LLM → tool calls → respond)system_services/agent_runtime/copilot_orchestrator.py— copilot/worker delegation with inherit-and-restrict permissionssystem_services/agent_runtime/process_audit_hook.py— audit logging for spawn/terminate eventsFactory
factory/_system.py— degradable boot block for ProcessManager + ToolDispatcherfactory/orchestrator.py— wire into SystemServices + register ProcessAuditHookTests (266 passing)
Test plan
uv run pytest tests/unit/core/test_process_syscalls.py tests/unit/core/test_kernel_dispatch_process.py -v— 20 tests passuv run pytest tests/unit/system_services/ -v— 80+ tests passuv run pytest tests/e2e/self_contained/test_multi_agent_orchestration_e2e.py -v— 10 tests passruff check+ruff format— clean