fix(team): converge run-scoped wakes into a run at the enqueue choke-point#690
Merged
Conversation
…point InheritRunningBatch now falls back to bind_system_enqueue when there is no inheritable active run, so agent-initiated run-scoped wakes (team_send_message and team_shutdown_agent) land inside a SystemLifecycle run instead of being hard-rejected with 'no active team run for run-scoped wake' or silently enqueued run-less. Removes the now-redundant service-layer guard. Updates two session unit tests that encoded the prior run-less shutdown behavior to assert the new invariant (shutdown opens a SystemLifecycle run).
ColeMatthewBienek
added a commit
to ColeMatthewBienek/AionCore
that referenced
this pull request
Jul 27, 2026
…un completions Upstream iOfficeAI#690 (c6fdcde) fixed the underlying bug — run-scoped wakes now converge into a SystemLifecycle run at the enqueue choke-point instead of rejecting with "no active team run for run-scoped wake" before the mailbox write, which silently lost 5 of 8 teammate deliverables in a live 7-agent session diagnosed independently against the same root cause. This adds the delivery-level coverage iOfficeAI#690 does not have: - run-less teammate->lead send must be PERSISTED to the mailbox and must WAKE the recipient with a run-scoped turn (not just open a run) - permutation loop: repeated sends across run completions, both directions, must deliver 100% (persist + wake per message) - test-only all_messages() accessor on FullMockTeamRepo Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Fixes Sentry
ELECTRON-3RC("团队协作: no active team run", reported on AionUi2.1.41).Agent-initiated, run-scoped wakes (
team_send_messageand the same-sourceteam_shutdown_agent) issued during a run-less window no longer hard-reject withno active team run for run-scoped wake(mapped toRuntimeContextMissing) or silently enqueue run-less. They now converge into an activeSystemLifecycleteam run at the single enqueue choke-point.This closes the residual variant left open by #680 (
38facd70), which converged system/lifecycle wakes but kept the guard as a probe and did not cover the agent-initiated path.Root cause
A user message opens a team run and the leader enters a long turn. When every batch of that run is judged terminal,
apply_work_summary'sno_workbranch marks the runCompleted, socurrent_active_run_id()returnsNonewhile the leader agent is still inside its turn. In this run-less window:team_send_message(→send_agent_message_from_agent) was hard-rejected by the service-layer guardrequire_active_team_run_for_team_work.CausalBinding::InheritRunningBatchresolved toteam_run_id: Noneincoordinator.rs::acquire_enqueuewhen there was no inheritable active batch, so no new run was opened.team_shutdown_agentused the same binding but skipped the guard, so it silently ran run-less.A correct fix therefore had to address both the guard rejection and the binding that failed to open a run.
What changed (5 files, +138 / -35)
Production code:
crates/aionui-team/src/work_coordinator/coordinator.rs— inacquire_enqueue, theCausalBinding::InheritRunningBatchbranch now falls back tobind_system_enqueuewhen there is no inheritable active run (attach-or-create semantics, matching the adjacentSystemInitiatedbranch). Behavior is unchanged when there is an inheritable batch; only this one branch changed.crates/aionui-team/src/service.rs— removed the now-obsoleterequire_active_team_run_for_team_workguard: both its call insend_agent_message_from_agentand the function definition. With the choke-point guaranteeing a run on enqueue, the guard no longer has meaning.Tests:
crates/aionui-team/src/session.rs— updates confined tomod tests(no production change); two existing unit tests updated to the new invariant and renamed.crates/aionui-team/src/team_run/tests.rs— new unit test plus an updated assertion inmcp_message_inherits_the_callers_running_batch_causality.crates/aionui-team/tests/session_service_integration.rs— the former "requires active team run" send test converted to a GREEN regression (renamed); new same-source shutdown regression test added.Testing
Run in the AionCore worktree; all green:
cargo test -p aionui-team— 410 lib tests + all integration suites pass, 0 failed.cargo clippy -p aionui-team -- -D warnings— clean.cargo fmt --all -- --check— no diff.just push) passed: 7480 tests run, 7480 passed, 18 skipped.Scope and risk
apply_work_summarymarking a runCompletedwhile the agent is still in a turn) and the separateteam_task_update"Task not found" issue are explicitly out of scope; the latter is tracked separately.Backgroundwould not be covered bybind_system_enqueue. This is a single-enum-choice review point rather than scattered guards.