Skip to content

fix(agent-org): disable edit/resend and checkpoint restore #785

Description

@ShiboSheng

Effort

Delivery boundary P50 P90 Substantive files
Disable Agent Org history mutation in UI and fail closed at the backend truncate boundary 180 review lines 350 review lines 3–6

Description

Agent Org sessions currently expose the ordinary Session Edit/Resend and Restore checkpoint actions. Those actions assume a linear single-agent transcript, but an Agent Org turn may already have produced durable state across Coordinator/Member sessions, TaskGraph, Inbox, materialization receipts, file history, and Team lifecycle.

A packaged-build reproduction after a Team entered Idle showed that the generic edit-resend path destructively truncates history before the backend discovers that the Agent Org lifecycle does not permit the replacement turn.

Product decision: Agent Org sessions do not support editing/resending historical messages or restoring historical checkpoints. Users should create a new Team Session to rerun modified instructions.

Steps to Reproduce

  1. Create and run an Agent Org Team Session.
  2. Let the Team finish and enter Idle.
  3. Edit the original user message.
  4. Submit Resend.
  5. Reopen or refresh the Session.

Expected Behavior

Agent Org Coordinator and Member sessions do not expose Edit/Resend or Restore checkpoint.

A stale frontend or direct IPC call to the transcript truncation boundary fails before changing transcript/events, files, snapshots, TaskGraph, Inbox, plan approvals, run state, Session state, or timestamps.

Ordinary Rust SDE and CLI Sessions retain their existing edit/resend and restore behavior.

Actual Behavior

The frontend currently performs this sequence:

  1. Cancels the turn boundary.
  2. Truncates visible and persisted history and may rewind files.
  3. Attempts to submit the edited replacement message.
  4. The backend correctly rejects the new turn with:
    team_idle: Agent Org run ... has no formal activation for a new turn
  5. The truncation is not rolled back, so the old transcript tail is gone while the replacement turn never starts.

Observed logs:

[SessionService] Failed to send message ... team_idle: Agent Org run ... has no formal activation for a new turn
[useEditUserMessage] edit truncate/resubmit failed

Environment

  • OS: macOS
  • App version / commit: packaged build:fast from the PR1 + PR2 stacked worktree
  • Feature gate: ORGII_AGENT_ORG_REDESIGN=1
  • Agent type: Agent Org Coordinator backed by rust_agent

Scope

  • Hide or disable Edit/Resend for Agent Org Coordinator and Member sessions.
  • Hide or disable Restore checkpoint for Agent Org Coordinator and Member sessions.
  • Add a backend fail-closed guard at the transcript truncation boundary.
  • Resolve Agent Org identity from persisted canonical state so the guard survives restart and does not depend only on an in-memory runtime.
  • Reject before cancelling turns, invalidating scheduler state, truncating events/messages/snapshots, deleting plan approvals, or reverting files.
  • Preserve ordinary Rust SDE and CLI Session behavior.

Out of scope:

  • Team rewind, replay, or reactivation.
  • activation_generation changes.
  • Agent Org lifecycle, immutable launch snapshot, TaskGraph, Inbox, materialization, RPC/wire, or definition changes.

Acceptance Criteria

  • Agent Org messages expose neither Edit/Resend nor Restore checkpoint.
  • Direct backend truncate calls for every canonical Agent Org participant fail with a stable diagnostic.
  • Rejection leaves transcript/events, files, snapshots, TaskGraph, Inbox, plan approvals, run status/generation, Session status, and timestamps unchanged.
  • The guard works after app restart using persisted Agent Org identity.
  • Ordinary Rust SDE and CLI edit/resend and checkpoint restore continue to work.
  • Frontend tests cover action visibility for ordinary and Agent Org sessions.
  • Backend tests prove rejection occurs before every destructive side effect.
  • Packaged regression confirms an Idle Team cannot be damaged by stale/direct invocation.

Relevant Code

  • src/engines/ChatPanel/ChatHistory/hooks/useEditUserMessage.ts
  • src/engines/ChatPanel/ChatHistory/hooks/useRestoreCheckpoint.ts
  • src/engines/ChatPanel/ChatItems/UserChatItem.tsx
  • src-tauri/crates/agent-core/src/state/commands/session/persistence.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Effort: LowUXImprovements to user experience, workflow smoothnessbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions