Skip to content

[Bug]: Checkpoint rollback ("Edit from here" / revert) past a clarifying-question turn leaves the question card and "Waiting for input" badge stuck open #41219

Open

Description

@gpu004

What I observed

When a provider turn completes with a pending message-mode user_input clarifying question (responseCapability: { type: "message" }), ProviderEventIngestor.dismissNativeUserInputs intentionally leaves it in status: "pending" so the user can answer it as a new message.

If the user instead clicks Edit from here or Revert to checkpoint to roll back past that turn (checkpoint.rollback), CheckpointRollbackService (apps/server/src/orchestration-v2/CheckpointRollbackService.ts:513-534) marks the rolled-back run and its rootNode as status: "rolled_back", but never cancels pending runtimeRequests (or their user_input_request turn items / child nodes) owned by runsToRollback.

Because neither ProjectionStore.getThreadShell (apps/server/src/orchestration-v2/ProjectionStore.ts:8514), threadShellFromProjection, getThreadSnapshotWindow, nor client-side derivePendingThreadRequests (packages/client-runtime/src/state/threadRequests.ts:247-276) filters out pending requests belonging to rolled_back runs, the rolled-back turn's question remains stuck open on the rewound thread across web, desktop, and mobile.

Reproduction

  • Commit: main @ 9d3054a7bb
  • Environment: macOS 27.2.1, Node v26.13.1

UI steps (single user, single device, no race):

  1. Start a thread and run a turn where the agent asks a clarifying question (a message-mode user_input request emitted by Codex/Claude/OpenCode or recovered across restart) and the turn finishes.
  2. Click Edit from here or Revert to checkpoint on Turn 1 to roll back to checkpoint 0.
  3. Observe the composer, sidebar, and Resume controls on the rewound thread.

Programmatic server repro (ThreadManagementService + OrchestratorV2 + OrchestrationEffectWorkerV2):

  1. Dispatch thread.create and message.dispatch (start_immediately).
  2. Emit a node.updated (kind: "user_input_request", status: "waiting"), runtime_request.updated (kind: "user_input", status: "pending", responseCapability: { type: "message" }), and turn_item.updated (type: "user_input_request", responseMode: "message", status: "waiting"), then complete the turn (provider_turn.updated + turn.terminal with status: "completed").
  3. Dispatch checkpoint.rollback to checkpoint 0 (ordinalWithinScope: 0, restoreFiles: false) and drain OrchestrationEffectWorkerV2.
  4. Read getThreadProjection, getThreadSnapshotWindow, and getThreadShell.

Expected behavior

Rolling back a run cancels all pending runtimeRequests (and updates their user_input_request turn items and child nodes) owned by runsToRollback, clearing shell.pendingRuntimeRequest, the composer question card, and the sidebar "Waiting for input" badge.

Actual behavior

The run is marked rolled_back and visibleTurnItems is empty, yet runtimeRequests[0] stays status: "pending", windowTurnItems still contains the waiting user_input_request, derivePendingThreadRequests still derives the question card, and getThreadShell still returns pendingRuntimeRequest.

In the UI, the rolled-back question card stays open in the composer, the sidebar stays on "Waiting for input", answering sends the dead question's response into the rewound thread, manual Resume (canResumeThread) and usage-limit auto-resume remain blocked, and t3_pending_request keeps reporting the stale question.

Evidence

Output from running the deterministic Effect/SQLite server repro (getThreadProjection, getThreadSnapshotWindow, getThreadShell after checkpoint.rollback to checkpoint 0):

{
  "rollbackCount": 1,
  "runs": [{ "id": "run:thread:thread%3Arepro-rollback-q:ordinal:1", "status": "rolled_back" }],
  "runtimeRequests": [{ "id": "req:clarify-auth", "status": "pending" }],
  "windowRuntimeRequests": [{ "id": "req:clarify-auth", "status": "pending" }],
  "windowTurnItems": [
    { "id": "item:clarify-auth", "type": "user_input_request", "status": "waiting" },
    { "id": "...checkpoint...", "type": "checkpoint", "status": "completed" }
  ],
  "pendingCardsDerivedByClient": ["req:clarify-auth"],
  "shellPendingRuntimeRequest": {
    "id": "req:clarify-auth",
    "kind": "user_input",
    "createdAt": "1970-01-01T00:00:01.000Z",
    "blocking": false
  },
  "visibleTurnItemsCount": 0
}

Additional investigation

  • How found: Stateful property-based testing of OrchestratorV2 and its projections, minimized to a deterministic non-PBT Vitest/Effect repro.
  • Verified: Confirmed still present on origin/main (9d3054a7bb); CheckpointRollbackService.ts:513-534 only emits run.updated and node.updated for run and rootNode.
  • Duplicate check: Searched open and closed issues/PRs for rollback pending question, revert question pending, rollback runtimeRequest, user_input rollback, and edit from here question — no matching issue found.
  • Impact: Major degradation whenever a user rewinds/edits past a clarifying-question turn.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions