Skip to content

fix(agent-org): harden recovery, task orchestration, and run finality#382

Closed
ShiboSheng wants to merge 2 commits into
developfrom
fix/issue-272-agent-org-recovery-backend
Closed

fix(agent-org): harden recovery, task orchestration, and run finality#382
ShiboSheng wants to merge 2 commits into
developfrom
fix/issue-272-agent-org-recovery-backend

Conversation

@ShiboSheng

@ShiboSheng ShiboSheng commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Part 1 of #272.

This is the backend half of #373, split out so the Agent Org runtime, persistence, recovery, scheduling, and task invariants can be reviewed independently from the UI.

Combined reference: #373

What changed

  • Replaces best-effort watchdog heuristics with a pure Recovery Analyzer and a side-effecting Recovery Executor.
  • Adds durable, fingerprinted recovery attempts with UTC 1/5/15-minute backoff.
  • Makes Agent Org Wake dispatch idempotent and rechecks Run state before provider execution.
  • Separates Run, Session, Task, Inbox, turn-intent, approval, and recovery-budget state.
  • Enforces coordinator-owned task assignment, dynamic dependency graphs, durable TaskOutput, and transaction-local mutation outcomes.
  • Adds atomic task-graph creation, plan-approval persistence, worker stop correction, restart recovery, and Run completion certificates.
  • Prevents ownerless worker auto-claim, stale-owner theft, terminal Run mutation, empty provider nudges, and unsupported CLI Agent Org launches.
  • Keeps the Rust implementation, Tauri commands, persistence changes, backend tests, and architecture audits together.

Issue #272 coverage

  • E1: detects tasks with no recoverable eligible member and escalates typed repair reasons.
  • E2: evaluates unread Inbox delivery per member; one member no longer suppresses another.
  • E3: preserves and tests the conservative active-worker guard.
  • E4: failed work returns to coordinator-controlled reassignment without wasteful peer auto-claim.
  • E5: persists member/coordinator recovery budgets and stable reason fingerprints.
  • E6/E7: cleans stale budgets, handles corrupt timestamps, filters Running runs in SQL, uses EXISTS, skips missed watchdog ticks, and removes repeated task × member scanning.
  • Repairs the four Inbox-drain eligibility fixtures called out in the issue discussion.

Review boundaries

  • 81 files under src-tauri/**
  • 4 backend architecture-audit reports
  • No frontend src/** or browser E2E files

Stacked frontend: #383

Verification

  • PROTOC=/tmp/protoc-28.3/bin/protoc cargo test -p agent_core --lib agent_org178 passed
  • PROTOC=/tmp/protoc-28.3/bin/protoc cargo test -p agent_core --lib lifecycle::tests -- --test-threads=15 passed
  • PROTOC=/tmp/protoc-28.3/bin/protoc cargo check -p org2 — passed
  • Husky scoped Clippy — passed for agent_core, core_types, e2e-test, org2, and session_persistence
  • git diff --cached --check — passed
  • Split boundary check — backend diff contains only src-tauri/** and architecture-audit files

Known target-branch baseline

Full workspace cargo clippy --all-targets -- -D warnings is currently blocked by unchanged warnings in the latest develop orgtrack-core and unrelated agent_core paths. The repository's scoped pre-commit Clippy passed for this change.

Split the deterministic Agent Org recovery, task authority, planner approval, wake dispatch, restart handling, and run-finality backend from the combined #373 change so it can be reviewed independently of the UI.

Verification:
- PROTOC=/tmp/protoc-28.3/bin/protoc cargo test -p agent_core --lib agent_org (178 passed)
- PROTOC=/tmp/protoc-28.3/bin/protoc cargo test -p agent_core --lib lifecycle::tests -- --test-threads=1 (5 passed)
- PROTOC=/tmp/protoc-28.3/bin/protoc cargo check -p org2
- git diff --cached --check
- Full strict Clippy is blocked by unchanged develop warnings in orgtrack-core and agent-core

Pre-commit hook ran. Total eslint: 0, total circular: 0
Keep the backend recovery, planner approval, and finality audit trail with the backend half of the #373 split so reviewers can evaluate the invariants alongside the Rust implementation.

Verification:
- git diff --cached --check

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.

2 participants