Skip to content

bug(sessions): preserve current drafts across agent replacement #807

Description

@Juliusolsson05

The existing central replaceSession in workspace/hook/actions/session.ts captures oldDraft before awaiting backend spawn, then copies only that text into the successor. It drops draft images. Provider switching currently works around the image omission in its own core.

Expected: ordinary reload/replacement preserves the latest unsent text and attachments supported by the destination provider. An intentional rewind may then replace that composer with the selected historical prompt, as its existing contract specifies.

Actual/source evidence: edits during asynchronous spawn are overwritten by the pre-spawn snapshot; ordinary reload drops attachments. Reproduce with a draft, begin reload while the backend response is delayed, edit the draft before spawn resolves, then inspect the replacement. Attach an image on a provider that supports images to exercise attachment loss.

Impact: unsent user work can be lost during lifecycle operations. Discovered while exposing the existing operations through the external toolkit, not introduced by its wrappers. A deterministic real-hook regression is being added with the existing replacement handoff harness and a delayed spawn boundary.

Environment: current main implementation after #794; source inspection and controlled renderer lifecycle test. Refs #793, #795.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions