Skip to content

feat(agent-org): add multi-target Group work and Linked Inbox - #1085

Draft
ShiboSheng wants to merge 4 commits into
codex/agent-org-pr8-stabilizationfrom
codex/issue-764-group-inbox
Draft

feat(agent-org): add multi-target Group work and Linked Inbox#1085
ShiboSheng wants to merge 4 commits into
codex/agent-org-pr8-stabilizationfrom
codex/issue-764-group-inbox

Conversation

@ShiboSheng

Copy link
Copy Markdown
Collaborator

Problem

Related to #764.

The stabilized Agent Org stack can preserve formal Task execution and Root FIFO ordering, but Group composer Member mentions still lack one atomic, durable user-directed-work ingress. A transport retry can therefore not rely on one immutable multi-target envelope, and Members cannot safely delegate linked side quests through org_send_message without mixing them into formal Task/work-episode authority.

PR9 must add that missing execution layer without replacing the PR8 Stabilization formal trigger, exact formal Inbox drain, work episode, completion, or Root queue behavior. The design document is the controlling specification; final Group-feed projection and default rollout remain PR10 work.

Solution

  • Add a source-neutral user-directed-work authority with canonical Inbox classification, frozen server-owned limits, root/parent causality, per-Member FIFO identity, exact lifecycle state, idempotency digests, and bounded startup recovery.
  • Replace the old single-target Group write with an ordered multi-target transaction. Validation is all-or-nothing; each Member receives an independent Inbox row, Turn identity, FIFO sequence, receipt, runtime, and terminal result.
  • Read recipients from structured member://<canonical_member_id> composer pills. The first send freezes the body, ordered targets, and per-target IDs; Retry after an unknown transport outcome reuses that envelope instead of creating duplicate work.
  • Authorize Linked Inbox sends from persisted call context, not model-supplied claims. Linked peers are snapshot-checked, Coordinator remains reachable through the existing Root FIFO, and TaskExecution cannot use user-directed peer authority.
  • Keep Direct Member work as the highest-priority intervention while Direct, Group, and Linked sources share one Member runtime lane. Paused user-directed work can answer without resuming the Team or mutating the formal graph.
  • Delete user-directed causal rows from leaves to roots before deleting Team sessions, fixing the foreign-key failure found during packaged-app Delete acceptance.
  • Add isolated test-only fault/evidence endpoints for response-loss and commit-before-kick validation. They cannot perform visible send, session switch, Pause/Resume, Archive, or Delete actions.

The rollout gate remains off by default. Zero-Member and Coordinator-only composer sends continue through the stabilized Root path; mixed Coordinator/Member selection is rejected. Final N-channel Group projection removal, localization sweep, default rollout, and PR10 feed performance work are deliberately excluded.

Potential risks

  • This stacked, unpublished schema is updated canonically and intentionally has no migration from intermediate PR-stack databases. Developers testing older stack states must reset/fresh-create Agent Org data. Rollback is to disable the rollout gate or revert these four commits and reset only unpublished test data.
  • The PR must merge after PR fix(agent-org): stabilize real-provider lifecycle convergence #1079 (codex/agent-org-pr8-stabilization). If that base advances, this branch needs a deliberate rebase plus affected schema, formal-path, packaged-app, and recovery checks.
  • Multi-target sends add bounded Provider concurrency and durable rows. Server-owned limits (10 Group targets, 32 pending roots per Member, 8 downstream deliveries per root, depth 2), one active Member runtime, and non-polling keyset recovery bound the exposure.
  • Static screenshots are not attached: the important acceptance properties are ordering, retry identity, restart recovery, Pause/Resume state, and persisted causality, which a still image cannot establish. They were verified in one exact packaged Tauri artifact through visible UI actions plus SQLite/runtime evidence.
  • Two repository-wide quality commands remain blocked by unchanged baseline files, documented below. PR9-scoped checks and the owning crate checks pass; this PR does not expand scope to repair unrelated Canvas runtime imports or workspace test layout.

Verification

Automated

  • pnpm exec vitest run src/engines/ChatPanel/hooks/groupChatRouting.test.ts src/engines/ChatPanel/hooks/useAgentOrgGroupChatController.test.ts src/engines/ChatPanel/hooks/useInputArea/__tests__/composerMemberPillSnapshot.test.ts src/engines/ChatPanel/hooks/useInputArea/__tests__/submissionErrors.test.ts — 4 files, 17 tests passed.
  • pnpm typecheck — passed.
  • pnpm run lint — exited 0 with 0 errors and 5 pre-existing warnings in unchanged ProjectManager files.
  • Targeted ESLint and Prettier checks over changed frontend files — passed; every commit hook ran without bypass.
  • cd src-tauri && cargo fmt --all --check — passed.
  • cd src-tauri && cargo test -p agent_core --lib — 3,413 passed, 0 failed, 2 ignored.
  • cd src-tauri && cargo clippy -p agent_core --all-targets -- -D warnings — passed.
  • cd src-tauri && cargo check -p org2 — passed.
  • git diff --check 6ffddb8b1e3814ca8caf080915048a91e2322f10..HEAD — passed.
  • pnpm run check:circular — blocked before cycle analysis because Madge cannot resolve two existing ?raw imports in unchanged src/engines/ChatPanel/blocks/CanvasInlineCard/reactArtifactDocument.ts.
  • cd src-tauri && cargo clippy --all-targets -- -D warnings — PR9 owners passed, then the workspace test target stopped on pre-existing clippy::items-after-test-module in unchanged src-tauri/src/api/agent/test/workspace.rs.

Packaged Tauri App and real Provider

  • Built the frozen branch with ORGII_AGENT_ORG_REDESIGN=1 pnpm run tauri:build:fast.
  • Verified artifact: ORG2-PR9-BuildFast-Handoff-v2.app; executable SHA-256 e473c056c04618349f5b047841cfc12b018de87aae605f274ac3f52c57cf9cc0.
  • Used real codexmaggie / gpt5.4mini provider work in an isolated discount-calculator repository. Implementer and Reviewer received independent Group roots, edited/checked the real fixture, used real org_send_message, and produced persisted linked replies and test results.
  • Verified Working queues Group work without interrupting the formal Task; Idle stays Idle; Paused accepts Member side work without auto-resume; Coordinator cannot mutate the formal graph while paused; Resume is explicit.
  • Verified Direct Member work keeps priority while later Group work retains its FIFO position and completes after End Direct Work.
  • Verified a real 10-Member burst produces 10 independent Inbox/Turn/root/FIFO/results with at most one active runtime per Member. An 11th target is rejected before write with zero Provider request.
  • Injected response loss, used the visible Retry action, and verified the same immutable IDs with no duplicate Inbox, sequence, or wake.
  • Injected commit-before-kick, quit and relaunched the packaged App, and verified pending-only recovery with no duplicate or replay of started side effects.
  • Used Computer Use for all visible actions: Team open/create, structured pills, input/send/Retry, Member and Root A-to-B-to-A switching, Stop, Direct Member work, End Direct Work, Pause, paused send, Resume, Archive, archived read-only state, confirmation dialogs, and final Delete.
  • Final Delete removed the isolated Team, all 11 sessions, Inbox/context/user-directed authority rows, and left 0 foreign-key violations; SQLite quick_check returned ok. Relaunch confirmed the deleted Team stayed absent.

Lifecycle and performance

  • Foreground 5 minutes: 60 samples, RSS 230,736–234,336 KiB, average 232,250 KiB, average CPU 1.512%.
  • Ordinary New Session idle 5 minutes: RSS 234,912–234,944 KiB, average 234,925 KiB, average CPU 0.830%.
  • Hidden/minimized 5 minutes: RSS 235,168–235,232 KiB, average 235,176 KiB, average CPU 0.163%.
  • Durable row counts remained stable; no periodic scan, wake storm, retained listener/timer growth, or staircase memory growth was observed. Recovery is startup-only, single-flight, keyset-bounded to 100 rows with a 50 ms yield.

Review structure

  1. feat(agent-core): add user-directed work authority
  2. feat(agent-core): add atomic group member delivery
  3. feat(agent-core): add linked inbox routing
  4. feat(chat): wire structured group member delivery

Architecture ownership/types/wire/persistence/lifecycle and the background-work lifecycle matrix were audited. Frontend design-system usage was reviewed manually because the configured frontend-ui-audit skill file was unavailable; no audit report is claimed.

@Harry19081 Harry19081 added enhancement New feature or request agent Agent runtime, behavior, memory, providers, or orchestration project-management Projects, work items, routines, GitHub work, or team inbox security Security-sensitive behavior, credentials, secrets, or advisories labels Aug 30, 2026
@ShiboSheng
ShiboSheng force-pushed the codex/issue-764-group-inbox branch from 3a97ebc to 430820a Compare August 31, 2026 17:36
@ShiboSheng
ShiboSheng force-pushed the codex/issue-764-group-inbox branch from 430820a to 153649b Compare August 31, 2026 17:56
@ShiboSheng
ShiboSheng force-pushed the codex/issue-764-group-inbox branch from 153649b to 46b993f Compare August 31, 2026 18:13
@ShiboSheng
ShiboSheng force-pushed the codex/issue-764-group-inbox branch from 46b993f to 2791b26 Compare September 1, 2026 03:07
@ShiboSheng
ShiboSheng force-pushed the codex/issue-764-group-inbox branch from 2791b26 to f3901fd Compare September 1, 2026 03:22
@ShiboSheng
ShiboSheng force-pushed the codex/issue-764-group-inbox branch from f3901fd to 3aa1d98 Compare September 1, 2026 03:33
@ShiboSheng
ShiboSheng force-pushed the codex/issue-764-group-inbox branch 2 times, most recently from 0f5312c to b77a336 Compare September 1, 2026 04:15
Persist source-neutral user-directed receipts, frozen limits, causal context, lifecycle state, and recovery ownership while preserving formal-work boundaries and Direct Member compatibility.\n\nVerification:\n- cargo test -p agent_core --lib — 3413 passed, 0 failed, 2 ignored\n- cargo clippy -p agent_core --all-targets -- -D warnings — passed

Pre-commit hook ran. Total eslint: 5, total circular: 0
Validate ordered Member targets as one transaction, allocate independent receipts and FIFO positions, and route every source through the existing Member runtime without disturbing formal task execution.\n\nVerification:\n- cargo test -p agent_core --lib — 3413 passed, 0 failed, 2 ignored\n- packaged BuildFast Group, Working, Paused, retry, and 10-target scenarios — passed

Pre-commit hook ran. Total eslint: 5, total circular: 0
Authorize linked Member and Coordinator side quests from persisted turn context, make call receipts transactional and idempotent, keep formal claims isolated, and delete causal user-directed rows safely before Team sessions.\n\nVerification:\n- cargo test -p agent_core --lib — 3413 passed, 0 failed, 2 ignored\n- packaged BuildFast linked side quest, restart recovery, and Delete scenarios — passed

Pre-commit hook ran. Total eslint: 5, total circular: 0
Submit canonical Member pill snapshots through the multi-target RPC, preserve immutable retry envelopes after unknown transport outcomes, surface typed limits, and expose isolated fault/evidence support for packaged-app acceptance.\n\nVerification:\n- pnpm exec vitest run src/engines/ChatPanel/hooks/groupChatRouting.test.ts src/engines/ChatPanel/hooks/useAgentOrgGroupChatController.test.ts src/engines/ChatPanel/hooks/useInputArea/__tests__/composerMemberPillSnapshot.test.ts src/engines/ChatPanel/hooks/useInputArea/__tests__/submissionErrors.test.ts — 17 passed\n- pnpm typecheck — passed\n- targeted ESLint and Prettier — passed

Pre-commit hook ran. Total eslint: 5, total circular: 0
@ShiboSheng
ShiboSheng force-pushed the codex/issue-764-group-inbox branch from b77a336 to 46966c6 Compare September 1, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Agent runtime, behavior, memory, providers, or orchestration enhancement New feature or request project-management Projects, work items, routines, GitHub work, or team inbox security Security-sensitive behavior, credentials, secrets, or advisories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants