Skip to content

fix(agent-org): delete all runs for a root conversation - #658

Closed
ShiboSheng wants to merge 1 commit into
codex/issue-642-runtime-submission-defensefrom
codex/issue-642-multi-run-deletion
Closed

fix(agent-org): delete all runs for a root conversation#658
ShiboSheng wants to merge 1 commit into
codex/issue-642-runtime-submission-defensefrom
codex/issue-642-multi-run-deletion

Conversation

@ShiboSheng

Copy link
Copy Markdown
Collaborator

Problem

PR1 records exact Run-to-Session ownership and PR2 blocks fenced Agent Org runtime installation and submissions, but deleting an Agent Org Root still handles only one Run. A Root with historical and live Runs can therefore be rejected or partially handled instead of deleting the complete conversation safely.

Solution

Add a dedicated multi-Run Root deletion protocol that plans every Run from exact agent_org_run_sessions mappings, establishes the durable Root fence, cancels and quiesces starting/running/paused runtimes, rechecks topology, and removes all Run- and Session-owned SQLite state in one BEGIN IMMEDIATE transaction. Failed commits retain the fence and cancelled state for restart-safe retry; successful commits return a deduplicated Root/Worker receipt and perform runtime/cache/filesystem cleanup afterward.

The PR also adds bounded 1,024 Run/Session validation, rollback and concurrency coverage, two production HTTP E2E scenarios, and the existing rendered Tauri sidebar deletion regression for completed/running/paused Roots.

Potential risks

  • This is a stacked Draft PR and requires PR2 (codex/issue-642-runtime-submission-defense) first.
  • A non-cooperative runtime causes a bounded 10-second failure; the durable fence remains and deletion must be retried after the runtime stops.
  • Filesystem cleanup occurs after the durable commit. Failures are logged and do not resurrect SQLite state. Persistent Shell Replay cleanup jobs remain intentionally scoped to a separate follow-up PR.
  • Downgrading to a version that does not understand an unfinished deletion fence is unsupported.
  • Repository-wide strict Clippy and rustfmt gates are currently blocked by pre-existing files outside this diff; PR-owned Rust files pass rustfmt, and no-deps Clippy shows only baseline warnings outside PR3 files.

Verification

  • PASS — cargo test -p agent_core --lib state::commands::session::agent_org_delete_tests -- --nocapture (11/11)
  • PASS — cargo test -p agent_core --lib (3189 passed, 0 failed, 2 ignored on clean rerun; first run had one transient SQLite lock in an unrelated sidebar test, which passed alone)
  • PASS — cargo check -p e2e-test
  • PASS — cargo run -p e2e-test -- --list (212 scenarios; both new scenarios registered)
  • PASS — agent-org-multi-run-root-delete-production-command (5/5 checks)
  • PASS — agent-org-multi-run-root-delete-rollback-retry (6/6 checks)
  • PASS — existing agent-org-session-delete-ui.spec.mjs via isolated WDIO/Tauri (3/3)
  • PASS — focused deletion receipt Vitest tests (5/5)
  • PASS — pnpm run typecheck
  • PASS — pnpm run check:circular
  • PASS — changed-file rustfmt and Prettier checks
  • PASS — git diff --check
  • FAIL (baseline) — strict workspace Clippy stops on seven existing orgtrack_core warnings; no-deps checks contain no PR3-file warnings after fixes
  • FAIL (baseline) — package rustfmt check reports existing Plan Approval, Shell Replay, and skills-loader formatting outside this diff

Scope and size

  • 17 files; 3,291 additions and 1,618 deletions (4,909 raw lines)
  • Production additions: 1,192
  • Test/debug additions: 2,099
  • Deleted old implementation: 1,618
  • Mechanical-only movement: 0
  • No IPC/wire shape, user-visible UI, dependency, or lockfile changes

@ShiboSheng ShiboSheng closed this Aug 6, 2026
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.

1 participant