Repository navigation
fix: copy foreign Agent Matrices when creating teams and preserve provenance #3068
Description
Problem
New Team lists agents from all loaded projects, but reduces selected paths to portable basenames before calling create_team. The backend resolves those names only in the destination project. Selecting a foreign agent therefore fails with Agent 'ac-healer' not found; an existing destination homonym can instead be bound silently. The selected source identity is lost.
Confirmed on main 6bff4a5. Prior investigation used 7b4191f; intervening main changes affect only pty/watchers/mod.rs. Relevant evidence: NewTeamModal.tsx portableAgentRef/handleCreate; entity_creation.rs list_all_agents, create_team, normalize_team_config_for_project, resolve_agent_ref.
User-validated behavior
- Keep selecting foreign agents in New Team. On successful creation, copy each selected foreign Agent Matrix completely into the destination project and bind the team, coordinator and repository assignments to those destination agents. Preserve the original and make files independent.
- During selection/review/repository assignments, show foreign agents as
name@sourceProject, with the entire suffix dimmed. Destination-local agents show only their name, with no@suffix. Classification uses current project membership, not historical provenance. A copied agent is subsequently local to its destination. - Preserve all regular Matrix files/directories, including hidden/unknown files, config, Role, memory/archives, plans, skills, inbox and outbox. Do not rebuild defaults, sanitize selected content or rewrite arbitrary internal paths. Do not read real agents' private state during development; use synthetic fixtures.
- Persist the validated source project and copy timestamp inside the copied Matrix. Proposed contract already reviewed for feasibility: root
.ac-copy-provenance.json,schemaVersion: 1, orderedcopies[]entries containingsourceProjectName,sourceProjectPath,sourceAgentRef,copiedAt(UTC RFC3339, completion of this Matrix copy). This is the deliberate exception to copying that metadata file byte-for-byte; all other files retain their bytes. - A copy of a copy retains every prior event unchanged in order and appends exactly one event for its immediate source. Original A -> copy B -> copy C -> copy D yields histories of 1/2/3 events, retaining identical prefixes. Do not sort, deduplicate, replace old dates or update ancestors. Missing history means only unrecorded history; do not invent creation dates. Invalid/unsupported existing history fails without resetting or overwriting it.
- Reject destination homonyms and ambiguous same-name selections without overwrite, merge, automatic rename or silent local substitution. Reject unsupported links/reparse/special entries explicitly rather than silently omitting Matrix content. On copy/metadata/team publication failure, report the error and recover only operation-owned artifacts, preserving pre-existing or externally modified content.
- Preserve local-only creation, portable persisted team refs and existing create/reload/close flow. Handle disk work outside the async/UI thread. No snapshot guarantee for actively changing files; failures/observable source changes must not count as successful copies.
Scope and acceptance
Application implementation is now authorized by the user's explicit “avanza”, following acceptance of prototype v4. Earlier prototype comment templates said no implementation; that earlier hold is superseded. Standing authorization permits proceeding after exact-version specialist consensus within this scope.
Scope: New Team and necessary additive Rust/IPC/types support, focused tests. Excludes Edit Team behavior redesign, global import tooling, new app success/filesystem/decision screens, actual private-Matrix operations, release/version bump, installing a build or unrelated cleanup. Prototype result/filesystem panels are explanatory, not new product surfaces. No final build requested.
Acceptance: synthetic multi-project fixtures demonstrate whole-tree byte preservation and independence; three successive copies preserve 1/2/3 histories; source trees remain unchanged; metadata matches immediate source and UTC time; collision/error cases do not clobber existing data; frontend tests cover labels in both wizard steps and repository assignments, preserving source identity in payload and local compatibility. Existing relevant checks and required CI must pass on the delivered commits.
Evidence and related issues
Room 24 has immutable prototypes v1-v4, user decisions and feasibility reports in room-shared/cross-project-agent-evidence and room-shared/cross-project-agent-*. User accepted v4 (SHA256 C6C40068087F36FF688E26CB2C4BF9215A8DA94886F3477CB1920BA00B149974). Architecture proposal rev2 and lineage review are candidates, not an implementation plan; a canonical reviewed plan is still required.
Related but distinct: #76 tracks older coordinator/portable-reference normalization; #357 tracks CLI-created team member matching in Edit Team. This issue addresses foreign-Matrix import and provenance, without expanding either older issue's scope.
Activity
mblua commentedon Oct 17, 2026
Technical score
Raw sum: 78. Final: round((78 - 10) / 190 * 99) + 1 = 36/100.
Excluded ceremony: issue/branch/PR creation, messaging, consensus rounds, CI waiting, merge/cleanup, versioning and final-report overhead.
Band 26-55. Delivery path Full because it changes an IPC contract and persistence across Rust/frontend. Category vetoes: state >=10, concurrency >=10 require architect contract; verification >=8 requires review of meaningful proof. Author: ac-architect-v5. Reviewers: owning Rust/frontend devs, Rust Grinch and architecture Grinch, exact matching digests and phase-executable verdicts where partitioned. No final build requested. Standing authorizations applies within user-approved scope; no extra human gate after consensus unless a real scope exception arises.
mblua commentedon Oct 17, 2026
I3068 round 1: no consensus
Rejected candidate v1: D:/0_repos/AgentsCommander_iac/.ac/plans/3068-cross-project-agent-copy/plan-v1-cross-project-agent-copy.md (epic.md identical).
Root SHA256: 2F9C3EAB0AD295F9D04C3D6DC87756077A984DC947BC2CC23B6997E8675EA0D0.
Phase hashes remain as independently verified in each report. No implementation authorized from this candidate.
Author: NEEDS_ANOTHER_ROUND. Rust dev, UI dev, Rust Grinch and architecture Grinch: CHANGES_REQUIRED. Approval count: 0/4 reviewers. Round 1 is comparison baseline.
Reports: room-shared/i3068-round1-ac-dev-rust-v5-review.md, i3068-round1-ac-dev-webpage-ui-v5-review.md, i3068-round1-ac-dev-rust-grinch-v5-review.md, i3068-round1-ac-architect-grinch-v5-review.md. Author workflow contrast in messaging/20261017-155011-room24-ac-architect-v5-to-room24-ac-tech-lead-v5-workflow-review.md.
Consolidated material corrections for next candidate:
Optional comments do not become blockers: merging P01/P02 only if partition contract permits; extra local clippy where CI already covers it. Architect owns choices. Existing Full partition has three phases because persistence/IPC/frontend ownership are distinct contracts; no need to invent another exception. Preserve exact required participants and all accepted behavior. Reuse valid PRE/candidate evidence not affected by corrections. No new product screens, private Matrix access or final build.
Next round: receive completed reports (all received), verify idle peer set, dry-run and real room purge, cold author new immutable version, then all original reviewers independently vote exact new digest set. No vote transfer. User-visible failed-round report published before this next gate.
mblua commentedon Oct 17, 2026
Plan v2 approved under standing user authorization
All original participants reviewed the same immutable v2 set: architect certified READY; Rust dev, UI dev, Rust Grinch and architecture Grinch returned PLAN_APPROVED. Round 1 had 0/4 approvals; round 2 has 4/4. All six consolidated corrections resolved, no new blockers. User explicitly instructed “avanza”; no additional routine approval needed.
Canonical root: D:/0_repos/AgentsCommander_iac/.ac/plans/3068-cross-project-agent-copy/plan-v2-cross-project-agent-copy.md
Plan-SHA256: 664D6CD1FB4EC3FD0E63E24514F0510E85ED2B66C1A2616A187F4916A9F9E9BF
Native sub-issue links verified. Mapping/immutable authorization receipt are separate from frozen Markdown; no plan bytes changed to add issue numbers. Implement sequentially from synchronized main after dependency merges. No final distributable build requested. Prototype explanation/result/filesystem panels remain out of product scope.
mblua commentedon Oct 17, 2026
P01 delivered through PR #3075, merged at
08bb43a71dc4f3e0903ce18e2072e97904aa6120. #3071 is closed; #3068 remains open.Adds private complete/independent Matrix-copy helpers, cumulative provenance and conservative owned-output cleanup. Source and prior lineage are preserved. No IPC or New Team activation in this phase: that follows in #3072 and #3073.
Validation: independent Rust and architecture reviews passed; Windows local full suite at integrated parent passed (6354 library tests, 26 ignored), all 16 focused tests passed on final head, strict Clippy/cognitive checks passed, and full module pair/SCC comparison preserved the existing topology. Full remote CI 39055434901 is green for final head
05510e15, including Windows/Linux/macOS, frontend, portable snapshots, smoke, guards, Sonar and security checks. The single Windows reader-demand timeout did not recur in the bounded check; no root cause or unrelated repair is claimed.Local repo is clean on main, equal to origin/main at the merge SHA; feature branch is removed. No distributable build was requested. Next authorized work: P02/#3072, additive source identity and copy integration in create_team; then P03/#3073 for external-project labels and payload.
mblua commentedon Oct 17, 2026
Delivered P02 via PR #3082, merged at 2026-10-17T23:50:16Z.
Merge/main SHA: e86896d. Reviewed/tested PR head: b7033fb.
create_team now accepts optional source identity, validates and copies foreign Matrices before exclusive team publication, preserves cumulative provenance and local-call compatibility, and rolls back only owned unchanged output. Discovery reports canonical project identity/locality. The frontend consumer remains the next phase.
Evidence: both independent code/integration reviews PASS; local Rust format/check/strict Clippy/cognitive wrapper, all 29 focused tests, 9 layering tests, full suite 6717 passed/0 failed/32 ignored. PRE/POST pairs and SCCs unchanged. Exact-head CI run39076334013 attempt2 SUCCESS; all required/triggered checks green, reconciled against ruleset15279066.
The initial ProjectPanel frontend assertion failure did not reproduce in the one authorized same-head recurrence; original logs retained, cause unknown. Earlier lost local execution receipt is likewise preserved as UNKNOWN, with successful recovery and later independent exact-head validation recorded.
Incoming Settings/container UI (#3077) and message archive (#3090) deltas were independently classified as unrelated and documented on the PR. Inherited Markdown line breaks in upstream release documentation remain explicitly recorded; P02-owned whitespace checks passed.
Post-merge cleanup verified: clean main equals origin/main at the merge SHA; feature local/remote/tracking refs removed. The feature fetch refspec added by the requested git-chequear-rama-principal skill was removed before the post-deletion fetch, preserving main's refspec.
No final distributable build was requested.
Epic #3068 remains open. Remaining child: #3073/P03, New Team labels and source-identity payload, starting after the required safe handoff/clear and per-phase cold gate. Frozen plan v2 and approved mapping are unchanged.
mblua commentedon Oct 19, 2026
Delivered in three merged phases:
@sourceProjectlabels.The team now binds selected foreign agents to independent destination copies, preserving regular Matrix content and appending immediate-source/time provenance without rewriting previous history. Synthetic fixtures cover whole-tree bytes/independence, three successive 1/2/3-event histories, unchanged sources, collision/error recovery, labels/source identity and existing local/context-alert behavior. Local agents retain name-only labels, including agents copied previously.
Final P03 merge/main:
0f953c5b88606da75a1d3bc9ec9025231f2407be. All three phase merge commits are ancestors; all three native child issues are closed. P03 has exactly seven approved paths over its merge target and each matches the validated feature file; the final Git tree matches the expected clean merge of the independently reviewed target and validated head.The exact P03 feature head
dc4b998cd54772e73d3ac9cace9e1f188265fdd6passed full CI run 39179217461: all 14 required contexts, all 23 check runs and the Snyk status succeeded, including required Windows/Linux/macOS and portable-terminal coverage. Local corrected frontend: 274 files/4,178 tests plus all frontend guards PASS. Independently qualified Rust verification: 6,729 passed/0 failed/32 ignored, all required layering guards, cargo check and structural checks PASS. Both source/final-proof reviews passed.Newer target deltas from PR #3115 and #3066 were independently classified as unrelated, documented on PR #3102, and the exact green head was retained under the landing policy. This does not relabel earlier failed/cancelled executions or claim a new Rust execution on the eventual merged tree. Existing best-effort discovery/reload behavior remains as documented on the PR.
Post-merge cleanup is verified: clean local
main == origin/main, feature branch/ref removed, main-only fetch configuration restored. Every delegated report and command settled; eight room peers are closed; final purge dry-run returneddry_run_ready/exit 0 and real purge returnedpurged/exit 0. No final distribution build, installation, release or version bump was requested. No remaining work in this epic.