feat(agent-org): add idempotent task graph writers - #956
Draft
ShiboSheng wants to merge 1 commit into
Draft
Conversation
Pre-commit hook ran. Total eslint: 5, total circular: 0
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
PR7 of the Agent Org design tracked by #762 requires model-initiated durable writes to be exactly-once and requires configured Task Graph Writers to edit graph state without gaining another member's Task-owner lifecycle authority.
On the PR6 baseline, retries of the same tool call could re-enter a business mutation because the mutation and its replay evidence were not committed together. Writer authority and sparse graph patches also crossed several independent paths, and an Idle Root user submission passed admission but was rejected by the execute-time lifecycle fence before the Provider could decide whether to create formal work. Cancellation/replacement could additionally leave now-undrainable formal Inbox rows blocking quiescence after the old Provider Turn ended naturally.
Solution
BEGIN IMMEDIATEtransaction. An identical retry replays without mutating; changed canonical parameters conflict; stale authority and storage failures leave no receipt.Idle -> Runninginside the first formal Task writer transaction. The same Team can consequently repeatWorking -> Idle -> Working -> Idlewithout creating a new Team or Root Session.The production rollout gate remains off by default. This PR enables only the Root Coordinator and configured Writer boundaries required by PR7; Member Direct and Group user-directed work remain out of scope.
Potential risks
Stacked PR
codex/issue-761-archive-team-delete)Verification
Automated checks:
cargo test -p agent_core --lib— 3,245 passed, 2 ignored, 0 failed.pnpm run cargo:test— 1,113 passed, 1 ignored, 0 failed.cargo clippy -p agent_core --all-targets -- -D warnings— passed.cargo fmt --all -- --check— passed.pnpm test— 1,116 test files / 8,777 tests passed.pnpm lint— 0 errors; 5 unrelated baseline warnings.pnpm typecheck— passed.git diff --check— passed.Real packaged-App / Provider journey:
orlando > GPT 5.6 Lunathrough visible UI.localStoragepersistence while preserving the original game controls.Idle performance sampling across five two-second samples showed stable RSS (233,104-233,120 KiB) and 3.4-4.3% process CPU while the packaged UI and automation bridge were open. PR7 adds no polling loop, timer, worker, or retained cache; receipt lookup is a primary-key read and lifecycle cleanup runs only at a Turn boundary.
No UI source files changed, so no product UI screenshots are attached to this backend/runtime PR.