Skip to content

feat(agent-org): flatten Team definitions and freeze capabilities - #835

Draft
ShiboSheng wants to merge 3 commits into
codex/issue-756-pr1-selected-rebuildfrom
codex/issue-757-pr2-selected-rebuild
Draft

feat(agent-org): flatten Team definitions and freeze capabilities#835
ShiboSheng wants to merge 3 commits into
codex/issue-756-pr1-selected-rebuildfrom
codex/issue-757-pr2-selected-rebuild

Conversation

@ShiboSheng

@ShiboSheng ShiboSheng commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Problem

Replaces #825.

Fixes #757.

Agent Org Team definitions still used the recursive hierarchy contract while the long-lived runtime introduced by the PR1 stack needs a stable, flat launch contract. Writer grants and Member communication policy were not represented as independent, validated capabilities, the legacy Agent Org runtime schema could prevent upgraded installations from starting a new Team, and cached workstation tabs could retain a pre-flat Team snapshot after an upgrade.

Solution

This PR is stacked directly on #834 (codex/issue-756-pr1-selected-rebuild) and contains exactly three adapted commits.

  • Replace recursive Team definitions with Coordinator + flat Members, assign stable Member IDs, persist independent additional TaskGraphWriter grants and canonical undirected Member communication links, and freeze roster/grants/links into the immutable launch snapshot.
  • Replace the communication matrix with per-Member connection summaries and a right-side peer panel backed by one canonical draft pair set. The main Team form remains the single trusted full-replace save boundary.
  • Recognize and transactionally reset only the exact official 15-column legacy Agent Org runtime envelope, while preserving ordinary Rust/CLI Sessions and failing closed for unknown layouts.
  • Exclude orphan Agent Org Member sessions from standalone SDE pagination.
  • Validate cached Agent Org tab snapshots against the current RPC schema, discard stale legacy snapshots, and prefer the canonical definition loaded by ID.

Writer grants and communication links are stored and frozen but remain inactive until their later feature slices.

Potential risks

  • This PR depends on feat(agent-org): add authoritative team lifecycle #834 and must not merge before it.
  • An exact legacy 15-column agent_org_runs fingerprint causes the four Agent Org runtime envelope tables to be rebuilt. Old Team runs are intentionally abandoned and cannot be recovered by reverting; ordinary Rust/CLI Sessions remain outside the reset scope.
  • Legacy recursive Team definition files are backed up byte-for-byte and reset to the new built-ins rather than guessed into a flat topology.
  • A stale cached Team snapshot is discarded. If the canonical Team no longer exists, the tab shows the existing empty/not-found state instead of rendering incompatible data.
  • Packaged/rendered WDIO acceptance, screenshots, and a live-provider recovery walkthrough were not rerun for this clean-history Draft.

Architecture and performance audit

Reviewed ownership, flat types, lifecycle integration, persistence, RPC schema compatibility, initialization parity, resolver symmetry, naming, and removed recursive surfaces. No new polling loop, timer, subscription, worker, or cache was added. Team payloads remain bounded at 50 Members and 1,225 canonical edges, and the communication panel renders at most 49 peers.

The local UI-consistency pass found design-system Buttons, explicit dialog labeling, icon-only labels, and no newly added arbitrary pixel Tailwind values. The repository's declared frontend-ui-audit skill file is unavailable, so no skill-format audit report was generated.

Verification

Passed on this PR tip:

  • cargo check -p agent_core -p org2 -p session_persistence --all-targets
  • cargo test -p agent_core agent_org -- --nocapture — 227 passed.
  • cargo test -p org2 orphan_org_members_do_not_break_standalone_cursor_or_has_more -- --nocapture — 1 passed.
  • pnpm run typecheck
  • focused Vitest across Agent Org RPC schemas, canonical pair helpers, communication panel, Run View store/hooks, and workstation tab storage — 7 files, 50 tests passed.
  • node --check on the three changed Agent Org E2E/support files.
  • git diff --check codex/issue-756-pr1-selected-rebuild...HEAD
  • Commit hooks, including scoped Rust Clippy.

The complete stacked tip was also verified after PR3 was added; those results are recorded in #836.

cargo fmt --all -- --check reports formatting differences already present on origin/develop in untouched files. No changed hunk in this PR contributes to that output.

Commit provenance

Selected source commit Adapted commit Purpose
b0ceb1df39bc05f4818802585b94a2d80d3dca5a 710ee9b59433f48ae9a1eed6afc3507848a25d0c Flat Team capabilities, immutable launch snapshot, and communication UI.
ba47fe237d2b0d71d4c0bd2c00566274aacff972 a73d12d7b86782c5e0e8cb5459ce4a825a3c965c Exact legacy runtime reset and orphan Member-session pagination fix.
34e7e973a4de33042e6ae244c1376e8b2ef13c2e c28004e1b7a9f5c460dd670fefdff987291110d9 Reject legacy cached Team snapshots.

Rollback

The branch can be reverted as a unit before merge. After an exact legacy runtime reset has committed, reverting cannot reconstruct discarded old Team run envelopes; recovery is to continue with newly created Team runs. Ordinary Session data is outside the reset scope.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant