Repository navigation
Description
Issue
A submitted V2 Orchestrate turn can disappear permanently from the conversation after the user switches to another SimpleChat conversation/page and returns. Refreshing does not restore the submitted question, planning state, or failure. The sidebar can still show the conversation title while the thread says there are no messages.
The initial question is rendered optimistically, but the normal planning path does not save it to conversation history until a valid plan is ready. A planner failure therefore leaves no durable user message or recoverable planning attempt for navigation/reload to restore.
Priority: P0, selected by the reporting admin because submitted messages are being lost. Assignee: Paul Lizer (@paullizer). Suggested roadmap size: L because durable planning, browser recovery, and regression coverage span frontend and backend boundaries.
Steps to Reproduce
- Open a new conversation in the V2 UI and enable Orchestrate.
- Submit a request while planning is delayed, or cause the planner to reject an invalid plan/unsatisfied selected requirement.
- Switch to another SimpleChat conversation or page, then return to the original conversation.
- Refresh the page.
- Observe that the question and planning/failure state are missing rather than restored.
The reported example involved one selected workbook, but the persistence defect is not specific to workbook content.
Expected Behavior
- Once the server accepts a valid, authorized, content-checked request, its user message and stable turn identity are durably saved before slow planning work.
- Navigation is not cancellation. Returning or refreshing restores the accepted question and an authoritative planning, awaiting-clarification, awaiting-review, failed, cancelled, or completed state.
- A planner failure remains visible and explicitly recoverable after reload. Recovery retains the original permitted selections and does not silently substitute ordinary chat or another model.
- Reopening/reloading does not duplicate a user message, planning submission, execution, or external effect, and does not grant approval to manual/timed plans.
Actual Behavior
The original question exists only in the live page state until planning succeeds. Navigating away clears the displayed message list; returning fetches server history, which has no saved question for a failed initial planning turn. A full reload also loses the in-memory planning context and failure.
Impact
Users lose submitted requests and the evidence of what happened to them. They cannot reliably distinguish still-running work, rejected planning, disconnected transport, or an empty conversation. Existing recovery of persisted runs does not cover this pre-plan gap.
Notes
Read-only live evidence
Correlated Azure Application Insights / Log Analytics records for the reported turn on 2026-11-05 UTC show:
- 20:55:25: selected-source preparation and request resolution started.
- 20:55:37.982882:
[ORCHESTRATION_PLANNER] The request could not be planned.withstage=selected_requirements,reason=invalid_plan_or_missing_requirement,error_type=PlanValidationError, andvalidation_code=plan_invalid. - 20:55:39: the conversation's messages were requested again; a page reload follows in the correlated timeline.
- The planning HTTP request was recorded as 200. That is transport acceptance, not proof that a plan/message was committed; the failure was inside the SSE response.
Raw user prompts, source content, credentials, subscription identifiers, and personal data are intentionally omitted.
Confirmed source boundaries
Source inspected: application/single_app/config.py version 0.261.410. App Service console execution-outcome records immediately before and after the incident also identify the running application as 0.261.410. The container uses a latest image tag; its exact image digest/commit has not been verified.
application/single_app/route_backend_orchestration.py:_persist_planned_turn()calls_save_turn_message()only after planning produces a valid plan. Normal planner-error branches emit SSE errors without saving the initial question or a durable failed planning attempt.- The same route's planning generator is request-bound and is closed with its response.
_stream_execution()already separates run execution from the browser connection, but initial planning does not use that boundary. application/v2_ui/src/stores/chatStore.ts:beginOrchestrationTurn()adds an optimistic question;selectConversation()clears the visible messages and replaces them with fetched history.application/v2_ui/src/lib/orchestrationController.ts: the initial turn context and active controller are in-memory maps.application/v2_ui/src/lib/orchestrationResume.ts: recovery reads saved runs, which cannot restore a turn that failed before a run was created.- Existing planning-retry browser tests cover same-page retries and isolation from other conversations, but not recovery of a failed initial submission after reload.
Acceptance criteria
- Persist an accepted question and stable planning identity before slow source/model planning; report storage failures explicitly instead of acknowledging a save that did not occur.
- Persist safe terminal planner failures/cancellations and the canonical inputs needed for an explicit retry.
- Separate planning ownership from the observing SSE connection, with safe stale-worker/interruption handling rather than a permanent Planning indicator.
- Restore planning/clarification/review/failure states on conversation open, refresh, and a fresh browser context without depending only on sessionStorage.
- Reconcile the optimistic question with its saved ID; keep exactly one question and isolate late events from other/deleted conversations.
- Preserve ownership checks, source reauthorization, content screening, manual/timed approval rules, and duplicate-execution fencing.
- Add deterministic real-route regressions for pre-plan persistence, model/validation/storage failures, disconnect, duplicate submission, cancellation, and recovery; add browser regressions for navigate-away/return and reload.
- Include fix documentation and the third-segment application version bump when implementation is approved. No application changes or deployment have been made during the investigation.
Related but not duplicates: #1785 concerns multi-turn test-oracle and saved-memory investigation; #1021 is the broader turn-orchestration feature.
Investigation update: reproduced durability boundary
A session-only diagnostic probe exercised the real authenticated Flask planning route, repository offline storage doubles using the installed Cosmos SDK response shape, and controlled provider responses. It changed no application code or production data.
| Initial-turn outcome | Saved user messages | Required durability assertion |
|---|---|---|
| Still planning, before a plan is returned | 0 | Failed: question is not durable |
| Planner rejects an invalid plan | 0 | Failed: question/failure cannot be reloaded |
| Planner asks for clarification | 0 | Failed: question is absent from conversation history |
| Valid plan is returned | 1 | Passed control |
Result: 3 intentional failing durability assertions, 1 passing control. These reproduce the current defect; they do not represent an implemented fix. The probe lives in session artifacts, not in the repository's committed test suite.
The App Service console independently confirms the same selected-requirements planner failure recorded by Application Insights. Console execution-outcome telemetry surrounding the incident reports application version 0.261.410.
Admin-confirmed behavior for implementation
- Work already authorized by the original Auto submission must continue server-side after navigation or refresh and restore its current state when the user returns.
- Manual/review plans still require approval; reload is not a new approval or permission to replay external effects.
- The fix must include pre-plan durability, durable failures and clarification recovery, browser-independent planning, and the Auto planning-to-execution handoff. Saving the question alone is necessary but not sufficient.
- Implementation and deployment remain unstarted pending plan approval.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsPending Evaluation
Activity
Fix durable orchestration planning and turn recovery