feat(agent-org): flatten Team definitions and freeze capabilities - #825
Open
ShiboSheng wants to merge 8 commits into
Open
feat(agent-org): flatten Team definitions and freeze capabilities#825ShiboSheng wants to merge 8 commits into
ShiboSheng wants to merge 8 commits into
Conversation
Replace recursive Agent Org hierarchies with stable flat Member rosters and persist additional Writer grants independently from canonical undirected Member communication links. Freeze the roster and both capability sets into immutable launch snapshots while keeping PR7 Writer authority and PR9 peer messaging fail closed. Replace the communication matrix with per-Member connection summaries and a right-side peer panel backed by one canonical draft pair set. Preserve trusted full-replace validation, atomic persistence, stable Member identities, locale parity, and the PR1 lifecycle contracts. Verification: - cargo test -p agent_core agent_org -- --nocapture (227 passed) - npm test -- --run src/scaffold/WizardSystem/variants/AgentOrg/MemberCommunicationPanel.test.ts src/scaffold/WizardSystem/variants/AgentOrg/orgTree.test.ts src/api/tauri/rpc/schemas/agentOrgs.test.ts (16 passed) - cargo check -p agent_core --all-targets && cargo check -p org2 --all-targets - cargo clippy -p agent_core -p org2 --all-targets -- -D warnings - npm run lint - npm run check:circular - ORGII_AGENT_ORG_REDESIGN=1 npm run tauri:build:fast
Reset only the exact published legacy Agent Org run schema while preserving ordinary sessions and unknown layouts. Keep retained Team member sessions out of standalone SDE pagination so orphan coordinators cannot consume page capacity or trigger Retry. Verification: - cargo test -p agent_core core::session::persistence -- --nocapture (34 passed) - cargo test -p org2 agent_sessions::session_directory::aggregation::tests -- --nocapture (13 passed) - npm test -- --run src/store/session/sessionAtom/__tests__/sidebarLoaders.test.ts src/api/tauri/rpc/__tests__/sessionAggregateSchemas.test.ts (28 passed) - cargo check -p agent_core --all-targets && cargo check -p org2 --all-targets - cargo clippy -p agent_core -p org2 --all-targets -- -D warnings - npm run lint - npm run check:circular - ORGII_AGENT_ORG_REDESIGN=1 npm run tauri:build:fast - Packaged real-data SDE pagination exhausted 10 -> 20 -> 21 without Retry Pre-commit hook ran. Total eslint: 0, total circular: 0
…formed members parse_org_members silently dropped any member entry without a string 'name', which cascaded into Writer-grant and communication-link removal on update — silent member deletion. Malformed entries are now hard, structured errors naming the entry index and offending field. update_org also replaced members wholesale with runtime_config: None, destroying persisted per-member runtime configuration. Survivors now keep the stored runtime_config, merged by member_id.
…tore The run store's private serialize_launch_snapshot duplicated validate + to_string without the size cap; it now imports the shared definitions::orgs::serialize_launch_snapshot, which validates structurally and enforces the 256KB cap exactly once at the write boundary. Read/context/task-persist paths no longer serialize the snapshot just to check its size.
…owner Store commits fsync under the store mutex. The model tools (create/update/remove_org in execute_text) and the launch path (apply_member_launch_overrides) ran them directly on the async executor, while the Tauri commands each hand-rolled their own offloading. AgentOrgsStore now exposes async wrappers (insert/replace/remove/ apply_member_launch_overrides/save_trusted_settings _async) built on a single run_blocking helper; the Tauri commands, model tool actions, and launch all go through them. org_store plumbing switched from &AgentOrgsStore to &Arc<AgentOrgsStore> so callers can share ownership with the blocking task.
…opy, naming - COORDINATOR_MEMBER_ID moves to core_types::agent_org as the single source of truth; the definitions store and the run coordination layer both import it (agent_org_runs keeps its public re-export). - Frontend member cap now mirrors MAX_AGENT_ORG_MEMBERS via AgentOrgs/config/agentConstants.ts instead of hardcoding 50 in AgentTeamFormSections.isOrgDraftValid. - Stale 'team hierarchy' empty-state copy replaced with flat-team wording in all 13 locales (agentOrgs.orgWizard.noMembers). - OrgDefinition::member_count() renamed to participant_count() with a doc comment for the coordinator-inclusive semantics. - Dropped the vestigial _org_store State params from debug_agent_org_execute_tool_as_agent and debug_agent_org_emit_member_idle.
Use an actual empty string for the empty-id path so the test no longer conflates it with a whitespace-only identifier. This keeps the selected test correction independent of the rejected ce3f5d3 validator changes.
Keep the selected shared write-path serializer self-contained without taking ce3f5d3 read-path changes, validate malformed model-update IDs before unknown-ID lookup, and port the late-launch regression fixture to the flat frozen snapshot contract.\n\nCo-authored-by: Neonforge <[email protected]>
This was referenced Aug 16, 2026
ShiboSheng
marked this pull request as ready for review
August 17, 2026 04:10
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.
Problem
Agent Org Team definitions still used the recursive hierarchy contract while the long-lived runtime introduced by PR #824 needs a stable, flat launch contract. Writer grants and Member communication policy were not represented as independent, validated capabilities, and the legacy Agent Org runtime schema could prevent upgraded installations from starting a new Team. The superseded PR #786 also mixed its PR2 work with an incomplete PR1 merge and audit follow-ups that were not all intended to ship.
Solution
This PR is a clean PR2 stack on the exact current head of PR #824. It replaces recursive Team definitions with
Coordinator + flat Members, assigns stable Member IDs, persists independent additional TaskGraphWriter grants and canonical undirected Member communication links, and freezes roster/grants/links into the immutable launch snapshot used by PR1 materialization and recovery.The Team settings UI uses one canonical pair draft set: each Member row shows its Writer state and connected count, while a right-side panel edits at most the other 49 Members. The panel has no independent save action; the main Team form performs the single trusted full-replace save. New Teams and newly added Members explicitly materialize all default communication pairs.
The PR also retains the narrowly scoped P0 fixes from the original PR2: exact recognition and transactional reset of the official 15-column legacy Agent Org runtime envelope, plus exclusion of orphan Agent Org Member sessions from standalone SDE pagination. Ordinary Rust/CLI Sessions and all non-Agent-Org data remain untouched.
Supersedes #786
Fixes #757
Potential risks
codex/issue-756-pr1-clean-rebuildso the review diff contains PR2 only.agent_org_runsfingerprint causes the four Agent Org runtime envelope tables to be rebuilt. Old Team runs are intentionally abandoned and are not recoverable by reverting this code; ordinary Rust/CLI Sessions are preserved. Unknown schemas fail closed and are never destructively reset.Architecture and performance audit
spawn_blockingownership boundary; no latency improvement is claimed from static inspection alone.HashSetindexes, and a communication panel renders at most 49 peers.Verification
Passed:
cargo fmt --all -- --checkwas also run. It reports three pre-existing formatting differences in PR #824 files outside this PR diff:core/tools/impls/coding/render_inline_canvas.rscore/tools/tests/ui_metadata_tests.rssession-persistence/src/turn_window.rsNot run in this rebuild:
Commit provenance
Cherry-picking and adapting the selected work onto the current PR #824 head produced new commit hashes. The exact mapping is:
5738470865863d4364704aa3f9a45326cc4edc5cb0ceb1df38aa187a70d9b68e88c6cf040b6c523d844b00f3bba47fe237f10afc22f0abb8dae228c83d6c82b184226bdbaa7656df0fspawn_blockingowner.a40a1697b99d0f5a3413595335b8ca3bd4ab6de9cIntentionally excluded commits have no corresponding commit in this PR:
4ac8568— excluded because this PR is rebuilt directly on the selected, current PR feat(agent-org): add authoritative Team lifecycle #824 stack instead of using the old merge commit.ce3f5d3— excluded in its entirety; none of its validator, read-path, quarantine, or migration changes are included.Rollback
The branch can be reverted as a unit before merge. After an exact legacy runtime reset has committed, reverting the application cannot reconstruct discarded old Team run envelopes; recovery is to continue with newly created Team runs. Ordinary Session data is outside the reset scope.