feat(agent-org): track exact run session ownership - #652
Draft
ShiboSheng wants to merge 1 commit into
Draft
Conversation
Persist canonical Coordinator and Rust worker ownership so historical workers cannot resolve to a newer Run under the same Root Session. Add transactional mapping creation, safe legacy backfill, exact resolver precedence, lifecycle integration, a bounded Timeline backend, and a multi-Run deletion guard while preserving CLI rejection. Verification: - cargo test -p agent_core --lib agent_org_runs (50 passed) - cargo test -p session_persistence --lib turn_intents (12 passed) - cargo clippy -p agent_core -p session_persistence -p org2 --all-targets -- -D warnings - pnpm run typecheck - pnpm run check:circular - Agent Org HTTP E2E (15 assertions passed) - pnpm run tauri:build:fast - Computer Use and user manual acceptance passed Pre-commit hook ran. Total eslint: 0, 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
Agent Org currently infers a Session's Run from the Root Session or the newest Run under that Root. That assumption is safe only while one Root owns one Run. Once sequential Runs are introduced, an old Rust Worker can be misidentified as belonging to a newer Run, affecting Run View, Inbox, Wake, Recovery, Watchdog, Finality, and deletion behavior.
Legacy data also needs a safe upgrade path: unambiguous ownership should be restored automatically, while duplicate live Runs, conflicting Turn Intents, and unsupported historical CLI records must never be silently reassigned or activated.
Solution
agent_org_runsand canonical Coordinator/Rust Worker ownership inagent_org_run_sessions.code_sessions.Refs #642
Part of #635
Potential risks
develop, strict package-wide Clippy is currently blocked by pre-existing warnings in unchangedorgtrack_coreandagent_corelines. The commit hook passed its scoped changed-file Clippy, and every diagnostic from the post-rebase package command was checked against this PR's diff.Verification
Passed on the implemented diff:
cargo test -p agent_core --lib agent_org_runs— 50 passed.cargo test -p agent_core --lib validation_rejects_cli— 3 passed.cargo test -p agent_core --lib launch_validation_rejects_cli— 1 passed.cargo test -p agent_core --lib agent_org_wake— 1 passed.cargo test -p agent_core --lib agent_org_watchdog— 7 passed.cargo test -p agent_core --lib agent_org_plan_approvals— 18 passed.cargo test -p session_persistence --lib turn_intents— 12 passed.agent-org-app-restart-transitions-running-runs-to-paused— 15 assertions passed through production Run View, restart/recovery, resume, and deletion-guard paths.pnpm run typecheck— passed.pnpm run check:circular— passed; 6,207 files processed, no circular dependency.git diff --check— passed.pnpm run tauri:build:fast— passed in 360.6 seconds.Integration with the latest
develop(2c02a4127):cargo test -p agent_core --lib agent_org_runs— 50 passed.cargo test -p session_persistence --lib turn_intents— 12 passed.pnpm run typecheck— passed.pnpm run check:circular— passed.eslint: 0, circular: 0.Known repository-baseline checks:
cargo clippy -p agent_core -p session_persistence -p e2e-test -p org2 --all-targets -- -D warningsreaches unchangedorgtrack_corewarnings and fails on seven existing diagnostics outside this PR.--no-depspackage check also reports existing warnings in unchanged Agent Core provider/tool files. One reported function inlaunch_helpers.rsis an unchanged pre-existing function; this PR only reorders validation later in that file.git diff --check.Audit