Skip to content

chat: project a provisioning cloud sandbox draft into the transcript like the Agents window - #341822

Closed
Osvaldo Ortega (osortega) wants to merge 1 commit into
osortega/cloud-sandbox-transcript-progressfrom
osortega/cloud-sandbox-preparation-transcript
Closed

Osvaldo Ortega (osortega) wants to merge 1 commit into
osortega/cloud-sandbox-transcript-progressfrom
osortega/cloud-sandbox-preparation-transcript

Conversation

@osortega

Copy link
Copy Markdown
Contributor

Summary

Stacked on #341697 (base branch osortega/cloud-sandbox-transcript-progress), which is stacked on #341695.

With #341697, provisioning a cloud sandbox on a draft's first send shows a shimmer progress row in the chat view, but the prompt stays in the (disabled) input until newChatSessionItem returns — the chat model flow has no session to put the request in before then. The Agents window feels instant because its ChatView creates a view-owned throwaway ChatModel with the prompt as a request and streams the preparation steps underneath (_showPreparationInput). This PR brings that experience to the editor's ChatWidget.

Changes (ChatWidget only)

  • Pending send tracking. _acceptInput records the first send of an untitled contributed draft (_trackPendingNewSessionSend: prompt, parsed request, attachments, mode, history/focus options) around chatService.sendRequest.
  • Projection. The existing autorun on IChatSessionsService.onDidChangeNewSessionPreparation now calls _renderNewSessionPreparation. When a preparation appears for the draft this widget is sending, it:
    • accepts the input (history, dictation, attachments cleared — exactly what used to happen on 'sent'),
    • creates a ChatModel that is never registered as a session and shares the draft's resource, seeded with the draft's input state minus text/attachments, so the mode/model/permission pickers and the Cloud/repository/approval chips do not change,
    • adds the prompt as its request and sets it on the widget; the steps are streamed as an in-transcript progressMessage (shimmer: true, stable id) plus setTranscriptProgress(…, { inTranscript: true, onCancel }), so Stop cancels provisioning and the input stays disabled.
  • Settling. 'sent' → the existing swap to the materialized session happens and the projection is disposed. 'rejected' / thrown (including Stop → CancellationError) → the draft model is shown again with its prompt and attachments restored. Navigating away drops the projection while the send keeps running. The projection outlives the controller clearing its progress until the send settles, so there is no flicker while the real session loads.
  • setModel keeps its resource-equality no-op except when moving to or from the projection (same resource by design), and ignores setModel(draft) while the draft is projected.
  • Preparations this widget did not send (e.g. another widget's draft) keep the chat: start cloud sandbox sessions from a draft participant like the cloud agent #341697 progress-row behaviour. Redundant re-renders from the global preparation signal are skipped.

Testing

  • chatWidget.test.ts (acceptInput submission harness extended): projection shows the prompt with the draft's pickers seeded and the input accepted once, steps update in place, the projection survives the controller clearing progress, hands over to the materialized session; rejected and cancelled sends restore the prompt and attachments; navigating away drops the projection; a foreign preparation renders as a progress row only.
  • Whole contrib/chat/test/browser folder: 11202 passing; sessions/contrib/chat tests (shared ChatWidget): 1152 passing. ESLint clean.
  • Manual: Chat view → Cloud → send a prompt. The prompt moves into the transcript immediately with "Creating Cloud Session for owner/repo: Setting up cloud container → Connecting… → Cloning repository (n%) → Starting Copilot agent" shimmering below it and the input cleared; Stop cancels and brings the prompt back; otherwise the real session takes over seamlessly.

…s window

While a cloud sandbox is provisioned on a draft's first send, the editor
kept the prompt in the (disabled) input with only a progress row, because
the chat model flow has no session until newChatSessionItem returns. The
Agents window instead shows the prompt as a request with the preparation
steps shimmering underneath, via a view-owned throwaway ChatModel.

Do the same in ChatWidget: when a controller publishes preparation for the
draft this widget is sending, accept the input, create a read-only
projection model that shares the draft's resource (so pickers and session
options stay put) with the prompt as its request, and stream the steps as
in-transcript progress with Stop wired to cancel. The projection is dropped
when the send settles: a sent request hands over to the materialized
session as before, a rejected or cancelled one brings the draft back with
its prompt and attachments. Preparations this widget did not send still
render as a progress row.
@osortega

Copy link
Copy Markdown
Contributor Author

Closing: this reimplemented in the widget what the platform already provides. The Copilot cloud provider handles the first send of a draft through a chat participant on the untitled session (prompt appears immediately, provisioning steps are ordinary response progress) and then commits the session via fireSessionCommitted, which the chat view already handles. #341697 is being reworked to that pattern, which makes this projection unnecessary.

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