feat(agent-org): flatten team capabilities - #786
Closed
ShiboSheng wants to merge 9 commits into
Closed
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
ShiboSheng
force-pushed
the
fix/issue-757-flat-team-capabilities
branch
from
August 12, 2026 17:11
7f90f99 to
8aa187a
Compare
ShiboSheng
marked this pull request as ready for review
August 12, 2026 17:13
Collaborator
Author
|
orgii://cloud/session/ref?v=1&org=bfa7b134-2486-45fa-81ad-a369441fafb4&owner=776dbd69-ac1d-4f72-a0d4-69cb4f2667dd&session=codexapp-rollout-2026-08-12T00-30-58-019ff1a9-b497-7f60-9e6e-2086cceb7a6d |
…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.
…ff order, ids, links - Boot reconcile of default template teams now reconciles ONLY structural identity (canonical member ids exist, canonical agent ids restored, removed canonical members re-added and re-linked). User edits survive a boot: member name/role/runtime_config, user-added members, description, plan approval policy, Writer grants, deliberate link deletions. - Per-org quarantine: one invalid on-disk definition no longer blocks the whole store until restart. Valid orgs load normally; invalid entries are quarantined (id/name + error), round-trip verbatim on every save, block only writes touching their id/name, and are listed via quarantined_definitions(). File-level corruption keeps full Blocked. Diagnostics document the fix-file-and-restart requirement. - org_names_referencing_agent fails safe: quarantined raw entries and fully blocked files are scanned as raw text, so the agent-deletion guard still protects references the store could not interpret. - Legacy sniff now runs only on version-less/array files. A valid schemaVersion:2 envelope can never be backup-reset by nested children/hierarchyMode keys inside field values. - Both validators reject member ids with leading/trailing whitespace instead of validating the trimmed id while storing the raw one. - validate_launch_snapshot is structural-only; the 256KB cap moved to serialize_launch_snapshot on the write path. - save_trusted_settings materializes full connectivity when INSERTing a new multi-member team with empty links; updates keep caller links verbatim so deliberate deletions survive.
…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.
…tion A single-space member id now fails with the dedicated leading/trailing-whitespace error instead of the generic empty-or-reserved message; keep an actually-empty case for the empty-id path and assert the new message for the untrimmed one.
# Conflicts: # src-tauri/crates/agent-core/src/core/coordination/agent_org_runs/store.rs # src-tauri/crates/agent-core/src/core/session/launch/launch_helpers.rs
Collaborator
Author
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
Fixes #757.
PR1 establishes the authoritative long-lived Team lifecycle, but the persisted Team definition still models a recursive hierarchy and does not provide trusted, independently configurable Writer grants and Member communication links. Later TaskGraphWriter and peer-messaging work needs stable flat Member identities and immutable launch-time capability facts; it must not infer authority from role, hierarchy, UI state, or a mutable template.
The rollout also exposed two upgrade-boundary failures that prevented the PR1+PR2 product from being exercised safely on existing installations:
agent_org_runsschema cannot serve the new lifecycle columns;org_member_idand could consume standalone SDE page capacity, producing an empty filtered page withhasMore=trueand a visible Retry state.Solution
This stacked PR targets
fix/issue-756-authoritative-team-lifecycleand delivers the PR2 definition/capability boundary:1..=50flat Members carrying stablemember_idvalues.roleis display/expertise only.AgentOrgLaunchSnapshot; runtime capability indexes compile toHashSetmembership checks. Running Teams never reread mutable templates.For the upgrade boundary, schema initialization recognizes only the exact published 15-column legacy run fingerprint. A match resets exactly
agent_org_initial_inputs,agent_org_member_materializations,agent_org_run_progress, andagent_org_runsin one transaction, then recreates the single canonical schema. Current schemas remain idempotent; unknown or locally modified layouts fail closed and are never destructively reset. Ordinary Rust/CLI Sessions and other data are untouched.Standalone SDE pagination now excludes any Session with
org_member_idin SQL beforeLIMIT. This preserves page capacity and keyset cursor semantics without deleting or modifying retained historical Sessions; valid current Team roots continue to use the Agent Org stream.Potential risks
developonly after PR1 lands and the resulting diff is reverified.ORGII_AGENT_ORG_REDESIGN=1; enabling the incomplete stack early exposes configured/frozen Writer and communication facts but intentionally does not activate PR7 graph-write or PR9 peer-send behavior.Verification
cargo test -p agent_core agent_org -- --nocapture— 227 passed.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/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.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— passed.cargo clippy -p agent_core -p org2 --all-targets -- -D warnings— passed.npm run lint— passed.npm run check:circular— no circular dependencies across 6,350 modules.cargo fmt --all -- --checkandgit diff --check— passed.ORGII_AGENT_ORG_REDESIGN=1 npm run tauri:build:fast— passed; produced the packagedORG2.appfrom this worktree.~/.orgii: the standalone SDE stream advanced 10 -> 20 -> 21 rows, then exhausted normally with no Retry, empty page, cursor stall, or new pagination/schema error in the log. No historical Session was deleted or modified by the pagination fix.Architecture review covered compilation, structure/dead code, naming, semantic ownership, default branches, domain leakage, developer clarity, wire shape, initialization parity, and resolver symmetry. No new wire or duplicate lifecycle owner was introduced by the follow-up.
Performance verdict: pass. Pagination remains one bounded keyset query using the existing ordered sidebar and root-membership indexes; no polling, cache, retained state, dependency, or frontend retry path was added.
frontend-ui-auditcould not be rerun during final handoff because its referencedSKILL.mdis absent from both the workspace and user skill directories. Existing UI unit/rendered specs and packaged manual acceptance are recorded above; the PR remains Draft for review evidence completion.